[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 for 4.23] Add GIC SGI boot/self tests in Xen
- To: "Halder, Ayan Kumar" <ayankuma@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: "Grall, Julien" <julien@xxxxxxx>
- Date: Fri, 18 Sep 2026 09:50:43 +0200
- Authentication-results: eu.smtp.expurgate.cloud; none
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monne <roger@xxxxxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>
- Delivery-date: Fri, 18 Sep 2026 07:50:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi Ayan,
On 17/09/2026 14:13, Halder, Ayan Kumar wrote:
On 17/09/2026 08:57, Grall, Julien wrote:
On 16/09/2026 12:35, Ayan Kumar Halder wrote:
+static void __init expect_sgi(const cpumask_t *mask,
+ const unsigned int *before, const char
*what)
+{
+ s_time_t deadline = NOW() + MILLISECS(100);
+ unsigned int cpu;
+
+ for_each_cpu ( cpu, mask )
+ {
+ while ( sgi_count(cpu) == before[cpu] )
+ {
+ if ( NOW() > deadline )
+ panic("GIC selftest: %s: CPU%u did not receive
GIC_SGI_TEST\n",
+ what, cpu);
+ cpu_relax();
+ }
+ }
+
+ printk("GIC selftest: CPU%u: %s: OK\n", smp_processor_id(), what);
+}
+
+/*
+ * "All but self" is only meaningful once every CPU can take an SGI,
so it is
+ * run by whichever CPU observes that it is the last one to get here.
+ */
+static int __init gic_sgi_selftest(void)
+{
+ static atomic_t __initdata seen = ATOMIC_INIT(0);
+ unsigned int before[NR_CPUS] = { };
Sorry I didn't spot this earlier. NR_CPUS can be quite large (up to
16K). So this will blow up the stack.
We discussed this offline at Xen Summit. But I will answer here as well.
As this is a test, we have hardcoded NR_CPUS = 4 in automation/scripts/
qemu-boot-selftest-arm64.sh.
I agree with your current test harness we only test 4 CPUs. However,
this is not enforced by the Kconfig in Xen. So anyone could modify the
script (or write their own) with a much higher number of NR_CPUS
(possibly to match the number of pCPUs on their hardware).
Depending on the value, they could face a stack overflow.
If there are 16K CPUs, our test only checks for 4 cpus only.
However if there is still a concern ....
I would preferred if this is solved. Assuming this is fixed:
Reviewed-by: Julien Grall <julien@xxxxxxx>
Cheers,
--
Julien Grall
|