[PATCH] KVM: selftests: Add SYNC after guest ITS setup in vgic_lpi_stress

Oliver Upton oupton at kernel.org
Fri Nov 14 12:26:15 PST 2025


On Fri, Nov 14, 2025 at 03:42:30PM +0000, Marc Zyngier wrote:
> On Fri, 14 Nov 2025 14:39:02 +0000,
> Maximilian Dittgen <mdittgen at amazon.de> wrote:
> > diff --git a/tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c b/tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c
> > index 687d04463983..e857a605f577 100644
> > --- a/tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c
> > +++ b/tools/testing/selftests/kvm/arm64/vgic_lpi_stress.c
> > @@ -118,6 +118,10 @@ static void guest_setup_gic(void)
> >  
> >  	guest_setup_its_mappings();
> >  	guest_invalidate_all_rdists();
> > +
> > +	/* SYNC to ensure ITS setup is complete */
> > +	for (cpuid = 0; cpuid < test_data.nr_cpus; cpuid++)
> > +		its_send_sync_cmd(test_data.cmdq_base_va, cpuid);
> 
> You are making an implementation assumption here. There is nothing in
> the spec that says that the GICR_TYPER.Processor_Number associated
> with a given CPU is the same thing as the CPU number that the
> selftests infrastructure give you.

This is already rather widely assumed in the selftests GIC library as
well as this test (ex. guest_invalidate_all_rdists()). I'd be happy with
an assertion in gicv3_cpu_init() that ensures
GICR_TYPER.Processor_Number == cpu.

Thanks,
Oliver



More information about the linux-arm-kernel mailing list