* [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 2:51 ` Rusty Russell
0 siblings, 0 replies; 14+ messages in thread
From: Rusty Russell @ 2007-03-22 2:51 UTC (permalink / raw)
To: Andi Kleen, Avi Kivity, Andrew Morton
Cc: lkml - Kernel Mailing List, kvm-devel
Grrr.... Andi refused to take my "rdmsr64" patch which moved to a
function-like interface for MSRs, dismissing it as pointless churn.
paravirt_ops cleanups changed a macro to an inline and spotted this
kvm bug.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff -r 47c6ee74a5c5 drivers/kvm/vmx.c
--- a/drivers/kvm/vmx.c Thu Mar 22 12:57:44 2007 +1100
+++ b/drivers/kvm/vmx.c Thu Mar 22 13:38:24 2007 +1100
@@ -1127,7 +1127,7 @@ static int vmx_vcpu_setup(struct kvm_vcp
u64 data;
int j = vcpu->nmsrs;
- if (rdmsr_safe(index, &data_low, &data_high) < 0)
+ if (rdmsr_safe(index, data_low, data_high) < 0)
continue;
if (wrmsr_safe(index, data_low, data_high) < 0)
continue;
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 2:51 ` Rusty Russell
0 siblings, 0 replies; 14+ messages in thread
From: Rusty Russell @ 2007-03-22 2:51 UTC (permalink / raw)
To: Andi Kleen, Avi Kivity, Andrew Morton
Cc: kvm-devel, lkml - Kernel Mailing List
Grrr.... Andi refused to take my "rdmsr64" patch which moved to a
function-like interface for MSRs, dismissing it as pointless churn.
paravirt_ops cleanups changed a macro to an inline and spotted this
kvm bug.
Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
diff -r 47c6ee74a5c5 drivers/kvm/vmx.c
--- a/drivers/kvm/vmx.c Thu Mar 22 12:57:44 2007 +1100
+++ b/drivers/kvm/vmx.c Thu Mar 22 13:38:24 2007 +1100
@@ -1127,7 +1127,7 @@ static int vmx_vcpu_setup(struct kvm_vcp
u64 data;
int j = vcpu->nmsrs;
- if (rdmsr_safe(index, &data_low, &data_high) < 0)
+ if (rdmsr_safe(index, data_low, data_high) < 0)
continue;
if (wrmsr_safe(index, data_low, data_high) < 0)
continue;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 7:20 ` Avi Kivity
0 siblings, 0 replies; 14+ messages in thread
From: Avi Kivity @ 2007-03-22 7:20 UTC (permalink / raw)
To: Rusty Russell
Cc: Andi Kleen, Andrew Morton, lkml - Kernel Mailing List, kvm-devel
Rusty Russell wrote:
> Grrr.... Andi refused to take my "rdmsr64" patch which moved to a
> function-like interface for MSRs, dismissing it as pointless churn.
>
> paravirt_ops cleanups changed a macro to an inline and spotted this
> kvm bug.
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> diff -r 47c6ee74a5c5 drivers/kvm/vmx.c
> --- a/drivers/kvm/vmx.c Thu Mar 22 12:57:44 2007 +1100
> +++ b/drivers/kvm/vmx.c Thu Mar 22 13:38:24 2007 +1100
> @@ -1127,7 +1127,7 @@ static int vmx_vcpu_setup(struct kvm_vcp
> u64 data;
> int j = vcpu->nmsrs;
>
> - if (rdmsr_safe(index, &data_low, &data_high) < 0)
> + if (rdmsr_safe(index, data_low, data_high) < 0)
> continue;
> if (wrmsr_safe(index, data_low, data_high) < 0)
> continue;
>
>
>
My rdmsr_safe (x86_64, i386 is similar/same) is
#define rdmsr_safe(msr,a,b) \
({ int ret__; \
asm volatile ("1: rdmsr\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: movl %4,%0\n" \
" jmp 2b\n" \
".previous\n" \
".section __ex_table,\"a\"\n" \
" .align 8\n" \
" .quad 1b,3b\n" \
".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b))\
:"c"(msr), "i"(-EIO), "0"(0)); \
ret__; })
Which seems quite happy to accept pointers to the values. The one in
asm/i386/paravirt.h has a similar calling convention.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 7:20 ` Avi Kivity
0 siblings, 0 replies; 14+ messages in thread
From: Avi Kivity @ 2007-03-22 7:20 UTC (permalink / raw)
To: Rusty Russell
Cc: Andrew Morton, Andi Kleen, lkml - Kernel Mailing List, kvm-devel
Rusty Russell wrote:
> Grrr.... Andi refused to take my "rdmsr64" patch which moved to a
> function-like interface for MSRs, dismissing it as pointless churn.
>
> paravirt_ops cleanups changed a macro to an inline and spotted this
> kvm bug.
>
> Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
>
> diff -r 47c6ee74a5c5 drivers/kvm/vmx.c
> --- a/drivers/kvm/vmx.c Thu Mar 22 12:57:44 2007 +1100
> +++ b/drivers/kvm/vmx.c Thu Mar 22 13:38:24 2007 +1100
> @@ -1127,7 +1127,7 @@ static int vmx_vcpu_setup(struct kvm_vcp
> u64 data;
> int j = vcpu->nmsrs;
>
> - if (rdmsr_safe(index, &data_low, &data_high) < 0)
> + if (rdmsr_safe(index, data_low, data_high) < 0)
> continue;
> if (wrmsr_safe(index, data_low, data_high) < 0)
> continue;
>
>
>
My rdmsr_safe (x86_64, i386 is similar/same) is
#define rdmsr_safe(msr,a,b) \
({ int ret__; \
asm volatile ("1: rdmsr\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: movl %4,%0\n" \
" jmp 2b\n" \
".previous\n" \
".section __ex_table,\"a\"\n" \
" .align 8\n" \
" .quad 1b,3b\n" \
".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b))\
:"c"(msr), "i"(-EIO), "0"(0)); \
ret__; })
Which seems quite happy to accept pointers to the values. The one in
asm/i386/paravirt.h has a similar calling convention.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 7:49 ` Rusty Russell
0 siblings, 0 replies; 14+ messages in thread
From: Rusty Russell @ 2007-03-22 7:49 UTC (permalink / raw)
To: Avi Kivity
Cc: Andi Kleen, Andrew Morton, lkml - Kernel Mailing List, kvm-devel,
Jeremy Fitzhardinge
On Thu, 2007-03-22 at 09:20 +0200, Avi Kivity wrote:
> My rdmsr_safe (x86_64, i386 is similar/same) is
Erk. Andrew, please drop that patch, and take this one.
It was actually Jeremy's paravirt cleanup patch which changed the
calling convention of rdmsr_safe() to match rdmsr().
I went "oh it's that fucking rdmsr interface" and "fixed" kvm.
Sorry for the bad patch,
Rusty.
==
rdmsr_safe() takes pointers. rdmsr() modifies its arguments. What a
mess.
Fix rdmsr_safe() with !CONFIG_PARAVIRT.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff -r a7f78e8eacc8 include/asm-i386/msr.h
--- a/include/asm-i386/msr.h Thu Mar 22 12:38:35 2007 +1100
+++ b/include/asm-i386/msr.h Thu Mar 22 18:40:35 2007 +1100
@@ -96,12 +96,12 @@ static inline void wrmsrl (unsigned long
(native_write_msr(msr, ((unsigned long long)val2 << 32) | val1))
/* rdmsr with exception handling */
-#define rdmsr_safe(msr,val1,val2) \
+#define rdmsr_safe(msr,p1,p2) \
({ \
int __err; \
- unsigned long long __val = native_read_msr(msr, &__err); \
- val1 = __val; \
- val2 = __val >> 32; \
+ unsigned long long __val = native_read_msr(msr, &__err);\
+ (*p1) = __val; \
+ (*p2) = __val >> 32; \
__err; \
})
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 7:49 ` Rusty Russell
0 siblings, 0 replies; 14+ messages in thread
From: Rusty Russell @ 2007-03-22 7:49 UTC (permalink / raw)
To: Avi Kivity
Cc: Andrew Morton, Andi Kleen, Jeremy Fitzhardinge,
lkml - Kernel Mailing List, kvm-devel
On Thu, 2007-03-22 at 09:20 +0200, Avi Kivity wrote:
> My rdmsr_safe (x86_64, i386 is similar/same) is
Erk. Andrew, please drop that patch, and take this one.
It was actually Jeremy's paravirt cleanup patch which changed the
calling convention of rdmsr_safe() to match rdmsr().
I went "oh it's that fucking rdmsr interface" and "fixed" kvm.
Sorry for the bad patch,
Rusty.
==
rdmsr_safe() takes pointers. rdmsr() modifies its arguments. What a
mess.
Fix rdmsr_safe() with !CONFIG_PARAVIRT.
Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
diff -r a7f78e8eacc8 include/asm-i386/msr.h
--- a/include/asm-i386/msr.h Thu Mar 22 12:38:35 2007 +1100
+++ b/include/asm-i386/msr.h Thu Mar 22 18:40:35 2007 +1100
@@ -96,12 +96,12 @@ static inline void wrmsrl (unsigned long
(native_write_msr(msr, ((unsigned long long)val2 << 32) | val1))
/* rdmsr with exception handling */
-#define rdmsr_safe(msr,val1,val2) \
+#define rdmsr_safe(msr,p1,p2) \
({ \
int __err; \
- unsigned long long __val = native_read_msr(msr, &__err); \
- val1 = __val; \
- val2 = __val >> 32; \
+ unsigned long long __val = native_read_msr(msr, &__err);\
+ (*p1) = __val; \
+ (*p2) = __val >> 32; \
__err; \
})
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 7:55 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 14+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-22 7:55 UTC (permalink / raw)
To: Rusty Russell
Cc: Avi Kivity, Andi Kleen, Andrew Morton,
lkml - Kernel Mailing List, kvm-devel
Rusty Russell wrote:
> It was actually Jeremy's paravirt cleanup patch which changed the
> calling convention of rdmsr_safe() to match rdmsr().
>
Oops, my little mind hobgoblin is getting out of control...
J
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 7:55 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 14+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-22 7:55 UTC (permalink / raw)
To: Rusty Russell
Cc: Andrew Morton, Andi Kleen, lkml - Kernel Mailing List, kvm-devel
Rusty Russell wrote:
> It was actually Jeremy's paravirt cleanup patch which changed the
> calling convention of rdmsr_safe() to match rdmsr().
>
Oops, my little mind hobgoblin is getting out of control...
J
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 21:30 ` Andrew Morton
0 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2007-03-22 21:30 UTC (permalink / raw)
To: Rusty Russell
Cc: Avi Kivity, Andi Kleen, lkml - Kernel Mailing List, kvm-devel,
Jeremy Fitzhardinge
On Thu, 22 Mar 2007 18:49:30 +1100
Rusty Russell <rusty@rustcorp.com.au> wrote:
> rdmsr_safe() takes pointers. rdmsr() modifies its arguments. What a
> mess.
>
> Fix rdmsr_safe() with !CONFIG_PARAVIRT.
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> diff -r a7f78e8eacc8 include/asm-i386/msr.h
> --- a/include/asm-i386/msr.h Thu Mar 22 12:38:35 2007 +1100
> +++ b/include/asm-i386/msr.h Thu Mar 22 18:40:35 2007 +1100
> @@ -96,12 +96,12 @@ static inline void wrmsrl (unsigned long
> (native_write_msr(msr, ((unsigned long long)val2 << 32) | val1))
>
> /* rdmsr with exception handling */
> -#define rdmsr_safe(msr,val1,val2) \
> +#define rdmsr_safe(msr,p1,p2) \
> ({ \
> int __err; \
> - unsigned long long __val = native_read_msr(msr, &__err); \
> - val1 = __val; \
> - val2 = __val >> 32; \
> + unsigned long long __val = native_read_msr(msr, &__err);\
> + (*p1) = __val; \
> + (*p2) = __val >> 32; \
> __err; \
> })
Linus's tree has
/* rdmsr with exception handling */
#define rdmsr_safe(msr,a,b) ({ int ret__; \
asm volatile("2: rdmsr ; xorl %0,%0\n" \
"1:\n\t" \
".section .fixup,\"ax\"\n\t" \
"3: movl %4,%0 ; jmp 1b\n\t" \
".previous\n\t" \
".section __ex_table,\"a\"\n" \
" .align 4\n\t" \
" .long 2b,3b\n\t" \
".previous" \
: "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \
: "c" (msr), "i" (-EFAULT));\
ret__; })
(secret decoder ring: resize your xterm to 100 cols to read the above. Sigh).
Which tree are you patching??
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 21:30 ` Andrew Morton
0 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2007-03-22 21:30 UTC (permalink / raw)
To: Rusty Russell
Cc: Jeremy Fitzhardinge,
lkml-MRDXTZLjjMs8G+1z+Pypc6QD96bmaF075NbjCUgZEJk, Mailing List,
Andi Kleen, kvm-devel
On Thu, 22 Mar 2007 18:49:30 +1100
Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org> wrote:
> rdmsr_safe() takes pointers. rdmsr() modifies its arguments. What a
> mess.
>
> Fix rdmsr_safe() with !CONFIG_PARAVIRT.
>
> Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
>
> diff -r a7f78e8eacc8 include/asm-i386/msr.h
> --- a/include/asm-i386/msr.h Thu Mar 22 12:38:35 2007 +1100
> +++ b/include/asm-i386/msr.h Thu Mar 22 18:40:35 2007 +1100
> @@ -96,12 +96,12 @@ static inline void wrmsrl (unsigned long
> (native_write_msr(msr, ((unsigned long long)val2 << 32) | val1))
>
> /* rdmsr with exception handling */
> -#define rdmsr_safe(msr,val1,val2) \
> +#define rdmsr_safe(msr,p1,p2) \
> ({ \
> int __err; \
> - unsigned long long __val = native_read_msr(msr, &__err); \
> - val1 = __val; \
> - val2 = __val >> 32; \
> + unsigned long long __val = native_read_msr(msr, &__err);\
> + (*p1) = __val; \
> + (*p2) = __val >> 32; \
> __err; \
> })
Linus's tree has
/* rdmsr with exception handling */
#define rdmsr_safe(msr,a,b) ({ int ret__; \
asm volatile("2: rdmsr ; xorl %0,%0\n" \
"1:\n\t" \
".section .fixup,\"ax\"\n\t" \
"3: movl %4,%0 ; jmp 1b\n\t" \
".previous\n\t" \
".section __ex_table,\"a\"\n" \
" .align 4\n\t" \
" .long 2b,3b\n\t" \
".previous" \
: "=r" (ret__), "=a" (*(a)), "=d" (*(b)) \
: "c" (msr), "i" (-EFAULT));\
ret__; })
(secret decoder ring: resize your xterm to 100 cols to read the above. Sigh).
Which tree are you patching??
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 22:01 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 14+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-22 22:01 UTC (permalink / raw)
To: Andrew Morton
Cc: Rusty Russell, Avi Kivity, Andi Kleen,
lkml - Kernel Mailing List, kvm-devel
Andrew Morton wrote:
> Which tree are you patching??
> -
It looks like its against the previously posted "Cleanup: rationalize
paravirt wrappers" patch.
J
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-22 22:01 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 14+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-22 22:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: kvm-devel, Andi Kleen, lkml - Kernel Mailing List
Andrew Morton wrote:
> Which tree are you patching??
> -
It looks like its against the previously posted "Cleanup: rationalize
paravirt wrappers" patch.
J
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-23 1:10 ` Rusty Russell
0 siblings, 0 replies; 14+ messages in thread
From: Rusty Russell @ 2007-03-23 1:10 UTC (permalink / raw)
To: Andrew Morton
Cc: Avi Kivity, Andi Kleen, lkml - Kernel Mailing List, kvm-devel,
Jeremy Fitzhardinge
On Thu, 2007-03-22 at 14:30 -0700, Andrew Morton wrote:
> Which tree are you patching??
We crossed in the mail: you turfed out the paravirt.h cleanup patch it
applied to.
We have rolled the fixes one patch, and am testing...
Rusty.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] make KVM conform to sucky rdmsr interface
@ 2007-03-23 1:10 ` Rusty Russell
0 siblings, 0 replies; 14+ messages in thread
From: Rusty Russell @ 2007-03-23 1:10 UTC (permalink / raw)
To: Andrew Morton
Cc: kvm-devel, Andi Kleen, Jeremy Fitzhardinge, lkml - Kernel Mailing List
On Thu, 2007-03-22 at 14:30 -0700, Andrew Morton wrote:
> Which tree are you patching??
We crossed in the mail: you turfed out the paravirt.h cleanup patch it
applied to.
We have rolled the fixes one patch, and am testing...
Rusty.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-03-23 1:11 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-22 2:51 [PATCH] make KVM conform to sucky rdmsr interface Rusty Russell
2007-03-22 2:51 ` Rusty Russell
2007-03-22 7:20 ` Avi Kivity
2007-03-22 7:20 ` Avi Kivity
2007-03-22 7:49 ` Rusty Russell
2007-03-22 7:49 ` Rusty Russell
2007-03-22 7:55 ` Jeremy Fitzhardinge
2007-03-22 7:55 ` Jeremy Fitzhardinge
2007-03-22 21:30 ` Andrew Morton
2007-03-22 21:30 ` Andrew Morton
2007-03-22 22:01 ` Jeremy Fitzhardinge
2007-03-22 22:01 ` Jeremy Fitzhardinge
2007-03-23 1:10 ` Rusty Russell
2007-03-23 1:10 ` Rusty Russell
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.