Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 18:24:05 (+), Will Deacon wrote: > On Thu, Feb 04, 2021 at 06:19:36PM +, Quentin Perret wrote: > > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > > Just feels a bit backwards having __find_buddy() take an order parameter, > > > yet then

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 18:13:18 (+), Will Deacon wrote: > I was going from memory, but the loop in __hyp_alloc_pages() searches up to > HYP_MAX_ORDER, whereas this is _never_ going to succeed beyond some per-pool > order determined by the size of the pool. But I doubt it matters -- I >

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > Just feels a bit backwards having __find_buddy() take an order parameter, > yet then return a page of the wrong order! __hyp_extract_page() always > passes the p->order as the order, Gotcha, so maybe this is just a naming problem.

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 17:48:49 (+), Will Deacon wrote: > On Thu, Feb 04, 2021 at 02:52:52PM +, Quentin Perret wrote: > > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > > On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > > > > On Tuesday 02 Feb 2021

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > > On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > > > On Fri, Jan 08, 2021 at 12:15:10PM +, Quentin Perret wrote: > > > > + *

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 06:19:36PM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > Just feels a bit backwards having __find_buddy() take an order parameter, > > yet then return a page of the wrong order! __hyp_extract_page() always > > passes the

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 06:01:12PM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 17:48:49 (+), Will Deacon wrote: > > On Thu, Feb 04, 2021 at 02:52:52PM +, Quentin Perret wrote: > > > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > > > On Wed, Feb 03, 2021

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 02:52:52PM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > > > On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > > > > On Fri, Jan 08, 2021 at

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:10PM +, Quentin Perret wrote: > > > + * __find_buddy(pool, page 0, order 0) => page 1 > > > + * __find_buddy(pool, page 0,

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-03 Thread Quentin Perret
Hey Will, On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > Hi Quentin, > > Sorry for the delay, this one took me a while to grok. No need to be sorry, thanks for having a look! > On Fri, Jan 08, 2021 at 12:15:10PM +, Quentin Perret wrote: > > When memory protection is

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-02 Thread Will Deacon
Hi Quentin, Sorry for the delay, this one took me a while to grok. On Fri, Jan 08, 2021 at 12:15:10PM +, Quentin Perret wrote: > When memory protection is enabled, the hyp code will require a basic > form of memory management in order to allocate and free memory pages at > EL2. This is

[RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-01-08 Thread Quentin Perret
When memory protection is enabled, the hyp code will require a basic form of memory management in order to allocate and free memory pages at EL2. This is needed for various use-cases, including the creation of hyp mappings or the allocation of stage 2 page tables. To address these use-case,