From: Zachary Amsden <zamsden@redhat.com>
To: Avi Kivity <avi@redhat.com>, kvm <kvm@vger.kernel.org>,
Linux-kernel <linux-kernel@vger.kernel.org>,
Ulrich Obergfell <uobergfe@redhat.com>
Subject: [PATCH x86 kvm] Fix register corruption in pvclock_scale_delta
Date: Wed, 15 Jun 2011 20:50:04 -0700 [thread overview]
Message-ID: <4DF97D6C.2080900@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
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
[-- Attachment #2: x86-kvm-pvclock-scale-delta-constraint-fix.patch --]
[-- Type: text/plain, Size: 957 bytes --]
>From Avi and Ulrich, fix constraints for 128-bit multiply
Signed-off-by: Zachary Amsden <zamsden@redhat.com>
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index 31d84ac..a518c0a 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -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
next reply other threads:[~2011-06-16 3:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-16 3:50 Zachary Amsden [this message]
2011-06-19 12:44 ` [PATCH x86 kvm] Fix register corruption in pvclock_scale_delta Avi Kivity
2011-06-22 9:35 ` Ian Campbell
2011-06-22 9:39 ` Avi Kivity
2011-06-22 9:40 ` Avi Kivity
2011-06-22 9:52 ` Ian Campbell
-- strict thread matches above, loose matches on Subject: below --
2011-08-30 8:58 Duncan Sands
2011-08-30 11:39 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DF97D6C.2080900@redhat.com \
--to=zamsden@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=uobergfe@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.