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

[xen master] timer: fix NR_CPUS=1 build with gcc13



commit c890499871ccad848fd633f32fd703c5c6c137da
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Sep 18 15:06:59 2023 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 18 15:06:59 2023 +0200

    timer: fix NR_CPUS=1 build with gcc13
    
    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>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxx>
---
 xen/common/timer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/common/timer.c b/xen/common/timer.c
index a2a18b2fb2..0fddfa7487 100644
--- a/xen/common/timer.c
+++ b/xen/common/timer.c
@@ -357,6 +357,7 @@ bool timer_expires_before(struct timer *timer, s_time_t t)
 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, unsigned int 
new_cpu)
 
     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 */
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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