sparse: makes dom0 boot on SMP
PATCH 1/1 sparse: makes dom0 boot on SMP
Hi,
recently, i have been unable to boot dom0 with SMP on an x86 and x86_64 box with the latest changeset. today, i was able to boot dom0 reliably by unapplying the patch from changeset 7275 to 7276 (that is included as the first attachment as a reference).
starting with a fresh pull, i am able to boot dom0 by making NS_PER_TICK a signed long long instead of unsigned long long (patch included as second attachment).
i assume the original motivation of changing NS_PER_TICK to a 64-bit value was for the jiffies_to_st function, since it includes a multiply, delta * NS_PER_TICK.
The only other function NS_PER_TICK seems to appear in is timer_interrupt(). i do not know why the original change from signed to unsigned would cause dom0 to fail on my smp machines. perhaps someone with more knowledge of time.c can shed some light?
thanks,
ryan
linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c +1 -1
@@ -1578,7 +1578,7 @@void smp_resume (void ) {smp_intr_init (); -local_setup_timer_irq (); +local_setup_timer (); }void vcpu_prepare (int vcpu)
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c +4 -4
@@ -122,7 +122,7 @@static u64 processed_system_time;/* System time (ns) at last processing. */ static DEFINE_PER_CPU(u64, processed_system_time); -#define NS_PER_TICK (1000000000L/HZ) +#define NS_PER_TICK (1000000000ULL/HZ)static inline void __normalize_time (time_t *sec,s64 *nsec) {
@@ -800,9 +800,9 @@ delta = j - jiffies;/* NB. The next check can trigger in some wrap-around cases, * but that's ok: we'll just end up with a shorter timeout. */ -if (delta <1 ) +if (delta <1 ) delta =1 ; - st = processed_system_time + (delta *NS_PER_TICK ); + st = processed_system_time + ((u64 )delta *NS_PER_TICK ); }while (read_seqretry (&xtime_lock, seq));return st;
@@ -816,7 +816,7 @@ {unsigned int cpu =smp_processor_id ();unsigned long j; - +/* s390 does this /before/ checking rcu_pending(). We copy them. */ cpu_set (cpu, nohz_cpu_mask);
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c +1 -1
@@ -122,7 +122,7 @@static u64 processed_system_time;/* System time (ns) at last processing. */ static DEFINE_PER_CPU(u64, processed_system_time); -#define NS_PER_TICK (1000000000ULL/HZ) +#define NS_PER_TICK (1000000000LL/HZ)static inline void __normalize_time (time_t *sec,s64 *nsec) {
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · Ryan Grimm
i assume the original motivation of changing
NS_PER_TICKto a 64-bit value was for thejiffies_to_stfunction, since it includes a multiply, delta *NS_PER_TICK.The only other function
NS_PER_TICKseems to appear in istimer_interrupt(). i do not know why the original change from signed to unsigned would cause dom0 to fail on my smp machines. perhaps someone with more knowledge oftime.ccan shed some light?
Yes, that change is definitely broken. It can cause the kernel to spin in the following loops if delta is ever -ve (because s64 gets promoted to u64 by std C rules, -ve becomes *big* +ve):
while ( delta > NS_PER_TICK )
.....
I'll change it back -- the main thing was to make 'delta' a 64-bit quantity in jiffies_to_st(), which is independent of whether NS_PER_TICK is signed or not.
-- Keir