[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: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: "Grall, Julien" <julien@xxxxxxx>
- Date: Thu, 17 Sep 2026 09:57:11 +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: Thu, 17 Sep 2026 07:57:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi Ayan,
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.
There are two options:
1) Use static
2) Temporarily allocate "before"
I don't have a strong opinion on which way to go with.
Cheers,
--
Julien Grall
|