[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] timer: fix NR_CPUS=1 build with gcc13


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 14 Sep 2023 16:32:01 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=oOEq8i9HTQF6kGAQWG9si/GkDBn4LNSFlY9R4GX6KqQ=; b=dbOYBN8GpTGJk9npcESMUCFP6hMng5H9lJLzUjYR9OSYo9EOM1wTkK8I+iskK/hweVtvdR+DNntFkLG3lHxqK8KkaHjPu1krrf90rx9QukqMzonXJNQ2D48b/2vWYf9AYe4M9FVITk7yiqzNQbs0Ywe+Vz4yG/jgfoTwCfWpyXCFPRYNgUmMDV4Ph6GI278wY5HXiMvVKE8ktDQkrIxltJNF7ZIRWNU6eNVGYi7BZBB6jrzQfmjAGDUufpI+h8yZvS2mwbt5rIVonvq5VjLQELkqK+qFxhqFd18tI754O3gq7j/4jdicyE97X8ZJJO+9Qc1GlvoZLeHC9H6eF3lGLA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q3WZ0xVPWb45mcwJEDmdFt2qQUZPHH34+vcNYfhwJR+BFi5nTy5YNpckt2JgasWDB4nIwKSf5clnZW6MURcfBSV7KkoJslP0eslVLdNhP/dR9quyrHVdlg6sTCpUJea8OM9Msb5fz1bR6enbT8cipHtN75o7NQCtnZBpOR+zwlmKoC07SZNhDnO6ZGzpOscFPKMoHUsqzOTEcOSsaAEpRjMSZJ2KLGvtafhvYqRLybL7/V72wY5jUBgQIPaKEWLmQgCXA+7ozSveaF62HQBsxVxez9h+QfosjnNvOr7CPWLqbStl7CMUvvXw94+sSJaMgffet7yyODSFbDDfFRZFew==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 14 Sep 2023 14:32:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Gcc13 apparently infers from "if ( old_cpu < new_cpu )" that "new_cpu"
is >= 1, and then (on x86) complains about "per_cpu(timers, new_cpu)"
exceeding __per_cpu_offset[]'s bounds (being an array of 1 in such a
configuration). Make the code conditional upon there being at least 2
CPUs configured (otherwise there simply is nothing to migrate [to]).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: Warn if it looks like an actual migration was (bogusly) requested.

--- a/xen/common/timer.c
+++ b/xen/common/timer.c
@@ -357,6 +357,7 @@ bool timer_expires_before(struct timer *
 void migrate_timer(struct timer *timer, unsigned int new_cpu)
 {
     unsigned int old_cpu;
+#if CONFIG_NR_CPUS > 1
     bool_t active;
     unsigned long flags;
 
@@ -404,6 +405,11 @@ void migrate_timer(struct timer *timer,
 
     spin_unlock(&per_cpu(timers, old_cpu).lock);
     spin_unlock_irqrestore(&per_cpu(timers, new_cpu).lock, flags);
+#else /* CONFIG_NR_CPUS == 1 */
+    old_cpu = read_atomic(&timer->cpu);
+    if ( old_cpu != TIMER_CPU_status_killed )
+        WARN_ON(new_cpu != old_cpu);
+#endif /* CONFIG_NR_CPUS */
 }
 
 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.