[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: "Grall, Julien" <julien@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: "Halder, Ayan Kumar" <ayankuma@xxxxxxx>
- Date: Mon, 28 Sep 2026 12:45:42 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R+TZNTxDHduF/MR3CtBRY0uDHTxC01WijTB/qwDhWhw=; b=skERil94IjNlSJ0dCrCOMubvn7PW3evj05T65nMByIwCNgjVTbmwcdETzOhOzaGKj1dllDDjOaZku1wHn3OSjopu+fkw46vX3XiuSga4zvvUyhb7L7ovXKv/iO2VZpWFlfwl4ZmuOfdEIkeVW/e8E3Nvp2QsjhFG+U4JTIW1s3ua8gcebj5yP5pJeFJ8UZ9NGCH0SufH+Vbkp5GvLnetjET70D8mzdcS5N9xeus+BMre8sXlxZnHKGPyM7nsmPom15aFmsu2uWL/vpL7BjRcVknQQegsdiOsrdObWPI8WsNJDEECUJqp74A79pcxquiawjqIPJ68ORe1tc8dIY7weA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SFeq+uUjZHYlbih0lj9WsorK3njhI7bNv7F8wlV35c+Yj/SewSanbBdoyT4VzlMXmnHQnJjrCesA/G+Yav83ny8E81MLHqTpxfU9EwSHPJX1NCIob/TVuQQVmvDWtTVVQWjmNdXmc6NFtXyO3/uJ3MVHba/hMzDceUhHH/xlDlu34ycl2U5F4acqfmX4a5y+UpCIW+b7veF9gn3qBTfZNz4R3Tpz7t9Wmf1x6eENSBI5MXUdU2j6IG1glMCtU2ViNe16om8YpIpDR63yetrdUbqSHrVQGt1yaIEOyS5wLhdk09LNaQpzxTeusTNZSGSmEDvZ8wvteS8PadFyCdBcWQ==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- 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: Mon, 28 Sep 2026 11:46:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 18/09/2026 08:50, Grall, Julien wrote:
Hi Ayan,
Hi Julien,
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:
I have fixed this. Please see
[PATCH v5] xen/arm: gic: Add GIC SGI boot/self tests in Xen
Reviewed-by: Julien Grall <julien@xxxxxxx>
I have kept your R-b. :)
- Ayan
|