Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-17 Thread Peter Zijlstra
On Sat, Jun 15, 2019 at 01:41:31AM +0300, Kirill A. Shutemov wrote: > On Fri, Jun 14, 2019 at 03:43:35PM +0200, Peter Zijlstra wrote: > > Not really, it all 'works' because clflush_cache_range() includes mb() > > and page_address() has an address dependency on the store, and there are > > no other

Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-14 Thread Kirill A. Shutemov
On Fri, Jun 14, 2019 at 03:43:35PM +0200, Peter Zijlstra wrote: > On Fri, Jun 14, 2019 at 04:28:36PM +0300, Kirill A. Shutemov wrote: > > On Fri, Jun 14, 2019 at 01:04:58PM +0200, Peter Zijlstra wrote: > > > On Fri, Jun 14, 2019 at 11:34:09AM +0200, Peter Zijlstra wrote: > > > > On Wed, May 08, 201

Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-14 Thread Peter Zijlstra
On Fri, Jun 14, 2019 at 04:28:36PM +0300, Kirill A. Shutemov wrote: > On Fri, Jun 14, 2019 at 01:04:58PM +0200, Peter Zijlstra wrote: > > On Fri, Jun 14, 2019 at 11:34:09AM +0200, Peter Zijlstra wrote: > > > On Wed, May 08, 2019 at 05:43:33PM +0300, Kirill A. Shutemov wrote: > > > > > > > +

Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-14 Thread Kirill A. Shutemov
On Fri, Jun 14, 2019 at 01:04:58PM +0200, Peter Zijlstra wrote: > On Fri, Jun 14, 2019 at 11:34:09AM +0200, Peter Zijlstra wrote: > > On Wed, May 08, 2019 at 05:43:33PM +0300, Kirill A. Shutemov wrote: > > > > > + lookup_page_ext(page)->keyid = keyid; > > > > + lookup_page_ext(pag

Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-14 Thread Kirill A. Shutemov
On Fri, Jun 14, 2019 at 11:34:09AM +0200, Peter Zijlstra wrote: > On Wed, May 08, 2019 at 05:43:33PM +0300, Kirill A. Shutemov wrote: > > > +/* Prepare page to be used for encryption. Called from page allocator. */ > > +void __prep_encrypted_page(struct page *page, int order, int keyid, bool > >

Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-14 Thread Peter Zijlstra
On Fri, Jun 14, 2019 at 11:34:09AM +0200, Peter Zijlstra wrote: > On Wed, May 08, 2019 at 05:43:33PM +0300, Kirill A. Shutemov wrote: > > > + lookup_page_ext(page)->keyid = keyid; > > + lookup_page_ext(page)->keyid = 0; Also, perhaps paranoid; but do we want something like:

Re: [PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-06-14 Thread Peter Zijlstra
On Wed, May 08, 2019 at 05:43:33PM +0300, Kirill A. Shutemov wrote: > +/* Prepare page to be used for encryption. Called from page allocator. */ > +void __prep_encrypted_page(struct page *page, int order, int keyid, bool > zero) > +{ > + int i; > + > + /* > + * The hardware/CPU does

[PATCH, RFC 13/62] x86/mm: Add hooks to allocate and free encrypted pages

2019-05-08 Thread Kirill A. Shutemov
Hook up into page allocator to allocate and free encrypted page properly. The hardware/CPU does not enforce coherency between mappings of the same physical page with different KeyIDs or encryption keys. We are responsible for cache management. Flush cache on allocating encrypted page and on retur