Re: [PATCH v4 04/17] KVM: arm64: Add a heap allocator for the pKVM hyp

Vincent Donnefort <[email protected]>
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel
Message-ID <[email protected]>
On Tue, Aug 18, 2026 at 03:22:55PM +0100, Fuad Tabba wrote:
> Hi Vincent,
> 
> On Fri, 31 Jul 2026 at 15:36, 'Vincent Donnefort' via kernel-team
> <[email protected]> wrote:
> ...
> > +static int hyp_allocator_destroy_chunk(struct hyp_allocator *allocator,
> > +                                      struct chunk_hdr *prev,
> > +                                      struct chunk_hdr *chunk)
> > +{
> > +       struct chunk_hdr *next;
> > +
> > +       next = prev ? chunk_get_next(chunk) : NULL;
> > +       if (!hyp_allocator_can_destroy_chunk(allocator, prev, next, chunk))
> > +               return -EINVAL;
> > +
> > +       /* Last chunk in the allocator */
> > +       if (!prev) {
> > +               allocator->first_unmapped = chunk_unmapped(chunk);
> > +               allocator->head = allocator->tail = NULL;
> > +               return 0;
> > +       }
> 
> hyp_allocator_destroy_chunk() has only two callers, both in
> hyp_allocator_free(), and both pass a non-NULL prev. So this !prev
> branch cannot be reached, and nor can the matching "if (!prev) return
> true;" in hyp_allocator_can_destroy_chunk() or the false arm of "next
> = prev ? chunk_get_next(chunk) : NULL".
> 
> The empty-allocator reset it looks like it is handling already happens
> in hyp_allocator_reclaim_chunk(), in the addr == allocator->start
> case. Could these be dropped?

Ha yes, correct, that's leftover of the Android version. I can then remove that
allocator argument in hyp_allocator_can_destroy_chunk().

> 
> With that:
> 
> Reviewed-by: Fuad Tabba <[email protected]>
> 
> Cheers,
> /fuad
> 
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.