Fix register corruption in pvclock_scale_delta
PATCH 1/1 Fix register corruption in pvclock_scale_delta
The 128-bit multiply in pvclock.h was missing an output constraint for EDX which caused a register corruption to appear. Thanks to Ulrich for diagnosing the EDX corruption and Avi for providing this fix (which now I am sending back to you Avi..)
Zach
Quoted 1 line
From Avi and Ulrich, fix constraints for 128-bit multiply
arch/x86/include/asm/pvclock.h +7 -2
@@ -22,6 +22,8 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)u64 product;#ifdef __i386__u32 tmp1, tmp2; +#else +ulong tmp;#endif if (shift <0 )
@@ -42,8 +44,11 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );#elif defined(__x86_64__) __asm__ ( -"mul %%rdx ; shrd $32,%%rdx,%%rax" - :"=a" (product) :"0" (delta),"d" ((u64 )mul_frac) ); +"mul %[mul_frac] ; shrd $32, %[hi], %[lo]" + : [lo]"=a" (product), + [hi]"=d" (tmp) + :"0" (delta), + [mul_frac]"rm" ((u64 )mul_frac));#else #error implement me!#endif
Quoted 1 line · Zachary Amsden
The 128-bit multiply in
pvclock.hwas missing an output constraint for EDX which caused a register corruption to appear. Thanks to Ulrich for diagnosing the EDX corruption and Avi for providing this fix (which now I am sending back to you Avi..)
Applied and queued, thanks.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 3 lines · Avi Kivity
Quoted 2 lines · Zachary Amsden
The 128-bit multiply in
pvclock.hwas missing an output constraint for EDX which caused a register corruption to appear.
Was there any particular symptom associated with corruption at that particular point or just general badness?
Quoted 5 lines
Thanks to Ulrich
Quoted 2 lines
for diagnosing the EDX corruption and Avi for providing this fix (which now I am sending back to you Avi..)
Applied and queued, thanks.
Seems like a stable candidate also?
Ian.
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Avi Kivity
Quoted 2 lines · Zachary Amsden
The 128-bit multiply in
pvclock.hwas missing an output constraint for EDX which caused a register corruption to appear.Was there any particular symptom associated with corruption at that particular point or just general badness?
Quoted 7 lines
Quoted 5 lines
Thanks to Ulrich
Quoted 2 lines
for diagnosing the EDX corruption and Avi for providing this fix (which now I am sending back to you Avi..)
Applied and queued, thanks.
Seems like a stable candidate also?
Yes. I see it's merged; Marcelo, can you backport it?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Avi Kivity
Quoted 2 lines · Zachary Amsden
The 128-bit multiply in
pvclock.hwas missing an output constraint for EDX which caused a register corruption to appear.Was there any particular symptom associated with corruption at that particular point or just general badness?
Time went backwards and forwards as vcpus were migrated across cpus.
The problem was in the host, not the guest, so Xen should not be affected.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 11 lines · Avi Kivity
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Avi Kivity
Quoted 2 lines · Zachary Amsden
The 128-bit multiply in
pvclock.hwas missing an output constraint for EDX which caused a register corruption to appear.Was there any particular symptom associated with corruption at that particular point or just general badness?
Time went backwards and forwards as vcpus were migrated across cpus.
Oops!
Quoted 1 line
The problem was in the host, not the guest, so Xen should not be affected.
Good to know, thanks!
Ian.