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 <[email protected]>
---
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 */
 }
 
 

Reply via email to