[PATCH v1 2/2] KVM: arm64: Fix bpages backing allocation size in hyp_trace

Vincent Donnefort vdonnefort at google.com
Fri Oct 9 01:39:15 PDT 2026


On Thu, Oct 08, 2026 at 08:13:29PM +0100, Fuad Tabba wrote:
> On Thu, 8 Oct 2026 at 11:42, Vincent Donnefort <vdonnefort at google.com> wrote:
> >
> > hyp_trace_buffer_alloc_bpages_backing() computes nr_bpages as
> > (PAGE_ALIGN(size) / PAGE_SIZE) + 1, whereas trace_remote_alloc_buffer()
> > takes into account the buffer page header.
> >
> > Align the bpages backing allocation by using
> > __calc_nr_pages_ring_buffer_desc(). There's no need to validate
> > nr_bpages again, it has been before with trace_buffer_desc_size().
> >
> > Fixes: 3aed038aac8d ("KVM: arm64: Add trace remote for the nVHE/pKVM hyp")
> 
> Should this have Cc: stable too, like patch 1? The undercount is there
> since 3aed038aac8d for small buffers, and 442ffa742daa6
> ("tracing/remotes: Account for ring buffer page header in size
> calculation") makes it reachable at ordinary sizes.
> 
> Reviewed-by: Fuad Tabba <fuad.tabba at linux.dev>
> Tested-by: Fuad Tabba <fuad.tabba at linux.dev>
> 
> Cheers,
> /fuad
> 
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe at android.com.
>

Yeah I wasn't sure, because __calc_nr_pages_ring_buffer_desc() was introduced
later.

But I can figure it out once the patch fails to apply and provide the
appropriate backport.

Thanks for the review.

-- 
Vincent



More information about the linux-arm-kernel mailing list