From: Jan Kiszka <jan.kiszka@siemens.com>
To: Dietmar Maurer <dietmar@proxmox.com>
Cc: Avi Kivity <avi@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: problem wit svm_get_msr on kvm-kmod-2.6.31.6
Date: Mon, 16 Nov 2009 13:02:53 +0100 [thread overview]
Message-ID: <4B013F6D.60003@siemens.com> (raw)
In-Reply-To: <90D306BE6EBC8D428A824FBBA7A3113D014275E0F5@ronja.maurer-it.com>
Dietmar Maurer wrote:
> 00000000000037c0 <svm_get_msr>:
> ...
>
> 387e: 66 90 xchg %ax,%ax
> 3880: 0f 84 8a 00 00 00 je 3910 <svm_get_msr+0x150>
> 3886: 66 90 xchg %ax,%ax
> 3888: 0f 86 c2 01 00 00 jbe 3a50 <svm_get_msr+0x290>
> 388e: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 3895: 48 8b 80 08 06 00 00 mov 0x608(%rax),%rax
> 389c: 48 89 02 mov %rax,(%rdx)
> 389f: 90 nop
> 38a0: 31 c0 xor %eax,%eax
> 38a2: c3 retq
> 38a3: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
> 38a8: 81 fe d9 01 00 00 cmp $0x1d9,%esi
> 38ae: 0f 84 7c 00 00 00 je 3930 <svm_get_msr+0x170>
> 38b4: 0f 86 46 01 00 00 jbe 3a00 <svm_get_msr+0x240>
> 38ba: 81 fe db 01 00 00 cmp $0x1db,%esi
> 38c0: 0f 84 ca 01 00 00 je 3a90 <svm_get_msr+0x2d0>
> 38c6: 81 fe dc 01 00 00 cmp $0x1dc,%esi
> 38cc: 0f 1f 40 00 nopl 0x0(%rax)
> 38d0: 75 98 jne 386a <svm_get_msr+0xaa>
> 38d2: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 38d9: 48 8b 80 80 06 00 00 mov 0x680(%rax),%rax
> 38e0: 48 89 02 mov %rax,(%rdx)
> 38e3: eb bb jmp 38a0 <svm_get_msr+0xe0>
> 38e5: 0f 1f 00 nopl (%rax)
> 38e8: 48 83 bf 78 28 00 00 cmpq $0x0,0x2878(%rdi)
> 38ef: 00
> 38f0: 0f 85 82 01 00 00 jne 3a78 <svm_get_msr+0x2b8>
> 38f6: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 38fd: 48 8b 48 50 mov 0x50(%rax),%rcx
> 3901: 0f 31 rdtsc
> 3903: 48 01 c8 add %rcx,%rax
>
> # this is svm_get_msr+0x146
> 3906: 48 89 02 mov %rax,(%rdx)
> 3909: eb 95 jmp 38a0 <svm_get_msr+0xe0>
> 390b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
> 3910: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 3917: 48 8b 80 00 06 00 00 mov 0x600(%rax),%rax
> 391e: 48 89 02 mov %rax,(%rdx)
> 3921: e9 7a ff ff ff jmpq 38a0 <svm_get_msr+0xe0>
> 3926: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
> 392d: 00 00 00
> 3930: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 3937: 48 8b 80 70 06 00 00 mov 0x670(%rax),%rax
> 393e: 48 89 02 mov %rax,(%rdx)
> 3941: e9 5a ff ff ff jmpq 38a0 <svm_get_msr+0xe0>
> 3946: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
> 394d: 00 00 00
> 3950: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 3957: 48 8b 80 28 06 00 00 mov 0x628(%rax),%rax
> 395e: 48 89 02 mov %rax,(%rdx)
> 3961: e9 3a ff ff ff jmpq 38a0 <svm_get_msr+0xe0>
> 3966: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
> 396d: 00 00 00
> 3970: 48 c7 02 65 00 00 01 movq $0x1000065,(%rdx)
> 3977: e9 24 ff ff ff jmpq 38a0 <svm_get_msr+0xe0>
> 397c: 0f 1f 40 00 nopl 0x0(%rax)
> 3980: 48 8b 87 e0 27 00 00 mov 0x27e0(%rdi),%rax
> 3987: 48 8b 80 10 06 00 00 mov 0x610(%rax),%rax
> 398e: 48 89 02 mov %rax,(%rdx)
> 3991: e9 0a ff ff ff jmpq 38a0 <svm_get_msr+0xe0>
> 3996: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
> 399d: 00 00 00
> ...
>
>
> We use the ubunto 2.6.24 kernel (http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy.git;a=summary)
>
> They have a few more patches applied:
>
> http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy.git;a=history;f=include/asm-x86/msr.h;h=cfe169475b5b50a448326ef3c34f50100ac83faf;hb=HEAD
>
> Maybe those last 2 patches can cause the problem?
Nope, it was most probably a kvm-kmod bug. Patch below should fix it.
Jan
----->
Fix native_read_tsc wrapping for x86-64
Use register constraint macros so that the return values of rdtsc are
properly picked up and no local variable is overwritten.
This is supposed to fix an oops on x86-64 with a 2.6.24 host kernel.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
x86/external-module-compat.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
index b0b9f21..b0de024 100644
--- a/x86/external-module-compat.h
+++ b/x86/external-module-compat.h
@@ -94,9 +94,10 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
static inline unsigned long long kvm_native_read_tsc(void)
{
- unsigned long long val;
- asm volatile("rdtsc" : "=A" (val));
- return val;
+ DECLARE_ARGS(val, low, high);
+
+ asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
+ return EAX_EDX_VAL(val, low, high);
}
#else /* >= 2.6.25 */
--
1.6.0.2
prev parent reply other threads:[~2009-11-16 12:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-16 9:42 problem wit svm_get_msr on kvm-kmod-2.6.31.6 Dietmar Maurer
2009-11-16 10:18 ` Avi Kivity
2009-11-16 10:46 ` Dietmar Maurer
2009-11-16 10:52 ` Avi Kivity
2009-11-16 11:17 ` Dietmar Maurer
2009-11-16 12:01 ` Avi Kivity
2009-11-16 12:03 ` Jan Kiszka
2009-11-16 12:06 ` Avi Kivity
2009-11-16 12:08 ` Jan Kiszka
2009-11-16 12:11 ` Avi Kivity
2009-11-17 8:14 ` Dietmar Maurer
2009-11-17 9:50 ` Jan Kiszka
2009-11-17 9:59 ` Jan Kiszka
2009-11-17 12:18 ` Avi Kivity
2009-11-17 17:00 ` Jan Kiszka
2009-11-18 7:07 ` Dietmar Maurer
2009-11-17 9:59 ` Dietmar Maurer
2009-11-16 12:02 ` Jan Kiszka [this message]
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=4B013F6D.60003@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=dietmar@proxmox.com \
--cc=kvm@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox