public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
@ 2006-12-13  9:45 Avi Kivity
       [not found] ` <457FCBB9.5070800-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-13  9:45 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 250 bytes --]

If you've experienced this problem, please test the attached patch (to 
qemu, not the kernel module) and report back.  The patch basically tells 
the guest that the msr doesn't exist.

-- 
error compiling committee.c: too many arguments to function


[-- Attachment #2: msr_star-intel-fix.patch --]
[-- Type: text/x-patch, Size: 1021 bytes --]

Index: qemu/qemu-kvm.c
===================================================================
--- qemu/qemu-kvm.c	(revision 4089)
+++ qemu/qemu-kvm.c	(working copy)
@@ -408,6 +408,7 @@
 {
     CPUState **envs = opaque;
     CPUState *saved_env;
+    uint32_t eax = *rax;
 
     saved_env = env;
     env = envs[0];
@@ -421,6 +422,27 @@
     *rcx = env->regs[R_ECX];
     *rbx = env->regs[R_EBX];
     *rax = env->regs[R_EAX];
+    // don't report long mode/syscall if no native support
+    if (eax == 0x80000001) {
+	unsigned long h_eax = eax, h_edx;
+
+
+	// horrible hack to workaround gcc 3 register pressure trouble
+	asm (
+#ifdef __x86_64__
+	     "push %%rbx; push %%rcx; cpuid; pop %%rcx; pop %%rbx"
+#else
+	     "push %%ebx; push %%ecx; cpuid; pop %%ecx; pop %%ebx"
+#endif
+	     : "+a"(h_eax), "=d"(h_edx));
+
+	// long mode
+	if ((h_edx & 0x20000000) == 0)
+	    *rdx &= ~0x20000000ull;
+	// syscall
+	if ((h_edx & 0x00000800) == 0)
+	    *rdx &= ~0x00000800ull;
+    }
     env = saved_env;
     return 0;
 }

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found] ` <457FCBB9.5070800-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-13 17:04   ` Michael Riepe
  2006-12-13 19:26   ` Michael Riepe
  1 sibling, 0 replies; 17+ messages in thread
From: Michael Riepe @ 2006-12-13 17:04 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f



Avi Kivity wrote:
> If you've experienced this problem, please test the attached patch (to
> qemu, not the kernel module) and report back.  The patch basically tells
> the guest that the msr doesn't exist.

That doesn't help, the messages are still there.

-- 
Michael "Tired" Riepe <michael-0QoEqw4nQxo@public.gmane.org>
X-Tired: Each morning I get up I die a little

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found] ` <457FCBB9.5070800-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  2006-12-13 17:04   ` Michael Riepe
@ 2006-12-13 19:26   ` Michael Riepe
       [not found]     ` <45805400.3060308-0QoEqw4nQxo@public.gmane.org>
  1 sibling, 1 reply; 17+ messages in thread
From: Michael Riepe @ 2006-12-13 19:26 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Oh well...

I was wondering which stupid piece of sh^H^Hcode generated so many wrong
rdmsr instructions without looking at the CPU feature flags. So I
grepped through the linux kernel and glibc sources as well as some other
likely suspects and found - nothing.

Guess what? It's qemu!

In qemu-kvm.c (around line 329 in save_regs()) it starts to call
kvm_get_msrs(), and one of the MSRs it wants to read is MSR_STAR. When I
removed MSR_STAR from the list (which fortunately has no consequences on
my Core Duo), the messages were gone.

-- 
Michael "Tired" Riepe <michael-0QoEqw4nQxo@public.gmane.org>
X-Tired: Each morning I get up I die a little

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]     ` <45805400.3060308-0QoEqw4nQxo@public.gmane.org>
@ 2006-12-14  9:22       ` Avi Kivity
       [not found]         ` <458117E4.4010807-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-14  9:22 UTC (permalink / raw)
  To: Michael Riepe; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Michael Riepe wrote:
> Oh well...
>
> I was wondering which stupid piece of sh^H^Hcode generated so many wrong
> rdmsr instructions without looking at the CPU feature flags. So I
> grepped through the linux kernel and glibc sources as well as some other
> likely suspects and found - nothing.
>
> Guess what? It's qemu!
>
> In qemu-kvm.c (around line 329 in save_regs()) it starts to call
> kvm_get_msrs(), and one of the MSRs it wants to read is MSR_STAR. When I
> removed MSR_STAR from the list (which fortunately has no consequences on
> my Core Duo), the messages were gone.
>   

Yes, you're right.

I'll commit the previous patch (which is correct, even if no guest 
actually uses syscall), and teach qemu not to read MSR_STAR when it 
isn't available.



-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]         ` <458117E4.4010807-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-14 10:14           ` Avi Kivity
       [not found]             ` <45812407.7010803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-14 10:14 UTC (permalink / raw)
  To: Michael Riepe; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Avi Kivity wrote:
> Michael Riepe wrote:
>> Oh well...
>>
>> I was wondering which stupid piece of sh^H^Hcode generated so many wrong
>> rdmsr instructions without looking at the CPU feature flags. So I
>> grepped through the linux kernel and glibc sources as well as some other
>> likely suspects and found - nothing.
>>
>> Guess what? It's qemu!
>>
>> In qemu-kvm.c (around line 329 in save_regs()) it starts to call
>> kvm_get_msrs(), and one of the MSRs it wants to read is MSR_STAR. When I
>> removed MSR_STAR from the list (which fortunately has no consequences on
>> my Core Duo), the messages were gone.
>>   
>
> Yes, you're right.
>
> I'll commit the previous patch (which is correct, even if no guest 
> actually uses syscall), and teach qemu not to read MSR_STAR when it 
> isn't available.
>

A patch is attached.  Please test.

(note it changes libkvm too)


-- 
error compiling committee.c: too many arguments to function


[-- Attachment #2: avoid-msr-star-if-not-available.patch --]
[-- Type: text/x-patch, Size: 4120 bytes --]

Index: qemu/qemu-kvm.c
===================================================================
--- qemu/qemu-kvm.c	(revision 4110)
+++ qemu/qemu-kvm.c	(working copy)
@@ -16,6 +16,8 @@
 
 int kvm_allowed = 1;
 kvm_context_t kvm_context;
+static struct kvm_msr_list *kvm_msr_list;
+static int kvm_has_msr_star;
 
 #define NR_CPU 16
 static CPUState *saved_env[NR_CPU];
@@ -127,7 +129,7 @@
     struct kvm_regs regs;
     struct kvm_sregs sregs;
     struct kvm_msr_entry msrs[MSR_COUNT];
-    int rc;
+    int rc, n;
 
     /* hack: save env */
     if (!saved_env[0])
@@ -201,19 +203,21 @@
     kvm_set_sregs(kvm_context, 0, &sregs);
 
     /* msrs */
-    set_msr_entry(&msrs[0], MSR_IA32_SYSENTER_CS,  env->sysenter_cs);
-    set_msr_entry(&msrs[1], MSR_IA32_SYSENTER_ESP, env->sysenter_esp);
-    set_msr_entry(&msrs[2], MSR_IA32_SYSENTER_EIP, env->sysenter_eip);
-    set_msr_entry(&msrs[3], MSR_STAR,              env->star);
-    set_msr_entry(&msrs[4], MSR_IA32_TSC, env->tsc);
+    n = 0;
+    set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_CS,  env->sysenter_cs);
+    set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_ESP, env->sysenter_esp);
+    set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_EIP, env->sysenter_eip);
+    if (kvm_has_msr_star)
+	set_msr_entry(&msrs[n++], MSR_STAR,              env->star);
+    set_msr_entry(&msrs[n++], MSR_IA32_TSC, env->tsc);
 #ifdef TARGET_X86_64
-    set_msr_entry(&msrs[5], MSR_CSTAR,             env->cstar);
-    set_msr_entry(&msrs[6], MSR_KERNELGSBASE,      env->kernelgsbase);
-    set_msr_entry(&msrs[7], MSR_FMASK,             env->fmask);
-    set_msr_entry(&msrs[8], MSR_LSTAR  ,           env->lstar);
+    set_msr_entry(&msrs[n++], MSR_CSTAR,             env->cstar);
+    set_msr_entry(&msrs[n++], MSR_KERNELGSBASE,      env->kernelgsbase);
+    set_msr_entry(&msrs[n++], MSR_FMASK,             env->fmask);
+    set_msr_entry(&msrs[n++], MSR_LSTAR  ,           env->lstar);
 #endif
 
-    rc = kvm_set_msrs(kvm_context, 0, msrs, MSR_COUNT);
+    rc = kvm_set_msrs(kvm_context, 0, msrs, n);
     if (rc == -1)
         perror("kvm_set_msrs FAILED");
 }
@@ -326,18 +330,20 @@
     tlb_flush(env, 1);
 
     /* msrs */    
-    msrs[0].index = MSR_IA32_SYSENTER_CS;
-    msrs[1].index = MSR_IA32_SYSENTER_ESP;
-    msrs[2].index = MSR_IA32_SYSENTER_EIP;
-    msrs[3].index = MSR_STAR;
-    msrs[4].index = MSR_IA32_TSC;
+    n = 0;
+    msrs[n++].index = MSR_IA32_SYSENTER_CS;
+    msrs[n++].index = MSR_IA32_SYSENTER_ESP;
+    msrs[n++].index = MSR_IA32_SYSENTER_EIP;
+    if (kvm_has_msr_star)
+	msrs[n++].index = MSR_STAR;
+    msrs[n++].index = MSR_IA32_TSC;
 #ifdef TARGET_X86_64
-    msrs[5].index = MSR_CSTAR;
-    msrs[6].index = MSR_KERNELGSBASE;
-    msrs[7].index = MSR_FMASK;
-    msrs[8].index = MSR_LSTAR;
+    msrs[n++].index = MSR_CSTAR;
+    msrs[n++].index = MSR_KERNELGSBASE;
+    msrs[n++].index = MSR_FMASK;
+    msrs[n++].index = MSR_LSTAR;
 #endif
-    rc = kvm_get_msrs(kvm_context, 0, msrs, MSR_COUNT);
+    rc = kvm_get_msrs(kvm_context, 0, msrs, n);
     if (rc == -1) {
         perror("kvm_get_msrs FAILED");
     }
@@ -597,11 +603,20 @@
 
 int kvm_qemu_create_context(void)
 {
+    int i;
+
     if (kvm_create(kvm_context, phys_ram_size, (void**)&phys_ram_base) < 0) {
 	kvm_qemu_destroy();
 	return -1;
     }
-
+    kvm_msr_list = kvm_get_msr_list(kvm_context);
+    if (!kvm_msr_list) {
+	kvm_qemu_destroy();
+	return -1;
+    }
+    for (i = 0; i < kvm_msr_list->nmsrs; ++i)
+	if (kvm_msr_list->indices[i] == MSR_STAR)
+	    kvm_has_msr_star = 1;
     return 0;
 }
 
Index: user/kvmctl.c
===================================================================
--- user/kvmctl.c	(revision 4089)
+++ user/kvmctl.c	(working copy)
@@ -339,13 +339,14 @@
 
     sizer.nmsrs = 0;
     r = ioctl(kvm->fd, KVM_GET_MSR_INDEX_LIST, &sizer);
-    if (r == -1)
+    if (r == -1 && errno != E2BIG)
 	return 0;
     msrs = malloc(sizeof *msrs + sizer.nmsrs * sizeof *msrs->indices);
     if (!msrs) {
 	errno = ENOMEM;
 	return 0;
     }
+    msrs->nmsrs = sizer.nmsrs;
     r = ioctl(kvm->fd, KVM_GET_MSR_INDEX_LIST, msrs);
     if (r == -1) {
 	e = errno;

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]             ` <45812407.7010803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-28 13:14               ` Ingo Molnar
       [not found]                 ` <20061228131445.GA1438-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 13:14 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:

> >I'll commit the previous patch (which is correct, even if no guest 
> >actually uses syscall), and teach qemu not to read MSR_STAR when it 
> >isn't available.
> 
> A patch is attached.  Please test.
> 
> (note it changes libkvm too)

hm, this patch doesnt seem to work, qemu gives me:

  Could not create KVM context

it comes from:

 3064  ioctl(3, 0x4004ae0b, 0)           = 0
 3064  ioctl(3, 0xc004ae0f, 0xbff8bd98)  = -1 E2BIG (Argument list too long)

but i have an older (2-weeks) qemu drop from branches/release/qemu - is 
that one supposed to work?

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                 ` <20061228131445.GA1438-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 13:21                   ` Avi Kivity
       [not found]                     ` <4593C4CE.4040203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-28 13:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Ingo Molnar wrote:
> * Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
>
>   
>>> I'll commit the previous patch (which is correct, even if no guest 
>>> actually uses syscall), and teach qemu not to read MSR_STAR when it 
>>> isn't available.
>>>       
>> A patch is attached.  Please test.
>>
>> (note it changes libkvm too)
>>     
>
> hm, this patch doesnt seem to work, qemu gives me:
>
>   Could not create KVM context
>
> it comes from:
>
>  3064  ioctl(3, 0x4004ae0b, 0)           = 0
>  3064  ioctl(3, 0xc004ae0f, 0xbff8bd98)  = -1 E2BIG (Argument list too long)
>
> but i have an older (2-weeks) qemu drop from branches/release/qemu - is 
> that one supposed to work?
>   

There was an accompanying bug in libkvm or qemu IIRC.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                     ` <4593C4CE.4040203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-28 13:26                       ` Ingo Molnar
       [not found]                         ` <20061228132602.GA3392-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 13:26 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:

> >hm, this patch doesnt seem to work, qemu gives me:
> >
> >  Could not create KVM context
> >
> >it comes from:
> >
> > 3064  ioctl(3, 0x4004ae0b, 0)           = 0
> > 3064  ioctl(3, 0xc004ae0f, 0xbff8bd98)  = -1 E2BIG (Argument list too 
> > long)
> >
> >but i have an older (2-weeks) qemu drop from branches/release/qemu - is 
> >that one supposed to work?
> >  
> 
> There was an accompanying bug in libkvm or qemu IIRC.

yeah, the patch changes libkvm and thus i reinstalled libkvm when i 
tested it:

-rw-r--r-- 1 mingo mingo   23326 Dec 28 14:11 user/libkvm.a
-rwxr-xr-x 1 mingo mingo 3932505 Dec 28 14:11 qemu/i386-softmmu/qemu
-rwxr-xr-x 1 root root     23326 Dec 28 14:13 /usr/local/lib/libkvm.a

and rebuilt qemu with the new libkvm, but it still gave me this warning. 
I'll do a full qemu rebuild, just to make sure it picked up the new 
library ...

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                         ` <20061228132602.GA3392-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 13:48                           ` Ingo Molnar
       [not found]                             ` <20061228134845.GA7446-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 13:48 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org> wrote:

> I'll do a full qemu rebuild, just to make sure it picked up the new 
> library ...

that did the trick. The only messages remaining are:

 kvm: unhandled wrmsr: 0xc1
 inject_general_protection: rip 0xc011b8ae

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                             ` <20061228134845.GA7446-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 13:56                               ` Avi Kivity
       [not found]                                 ` <4593CD12.7010603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-28 13:56 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Ingo Molnar wrote:
> * Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org> wrote:
>
>   
>> I'll do a full qemu rebuild, just to make sure it picked up the new 
>> library ...
>>     
>
> that did the trick. The only messages remaining are:
>
>  kvm: unhandled wrmsr: 0xc1
>  inject_general_protection: rip 0xc011b8ae
>
>   

That's a performance counter.  What guest triggers it?

I can usually shut up an unhandled rdmsr, but wrmsrs are more worrying.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                 ` <4593CD12.7010603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-28 14:02                                   ` Ingo Molnar
       [not found]                                     ` <20061228140223.GA9418-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 14:02 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:

> >that did the trick. The only messages remaining are:
> >
> > kvm: unhandled wrmsr: 0xc1
> > inject_general_protection: rip 0xc011b8ae
> >
> >  
> 
> That's a performance counter.  What guest triggers it?

a 32-bit Linux bzImage:

  c011b8ae:       0f 30                   wrmsr

 (gdb) list *0xc011b8ae
 0xc011b8ae is in setup_apic_nmi_watchdog (include/asm/msr.h:36).
 31      static inline void wrmsrl (unsigned long msr, unsigned long long val)
 32      {
 33              unsigned long lo, hi;
 34              lo = (unsigned long) val;
 35              hi = val >> 32;
 36              wrmsr (msr, lo, hi);
 37      }
 38
 39      /* wrmsr with exception handling */
 40      #define wrmsr_safe(msr,a,b) ({ int ret__;                              

the guest also obviously crashes due to this #GPF.

[ 2.6.20-rc2-rt2 kernel of course ;-) ]

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                         ` <4593D011.9020808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-28 14:08                                           ` Ingo Molnar
       [not found]                                             ` <20061228140836.GB10033-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 14:08 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:

> Ingo Molnar wrote:
> >* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
> >
> >  
> >>>that did the trick. The only messages remaining are:
> >>>
> >>>kvm: unhandled wrmsr: 0xc1
> >>>inject_general_protection: rip 0xc011b8ae
> >>>
> >>> 
> >>>      
> >>That's a performance counter.  What guest triggers it?
> >>    
> >
> >a 32-bit Linux bzImage:
> >
> >  c011b8ae:       0f 30                   wrmsr
> >
> > (gdb) list *0xc011b8ae
> > 0xc011b8ae is in setup_apic_nmi_watchdog (include/asm/msr.h:36).
> > 31      static inline void wrmsrl (unsigned long msr, unsigned long long 
> > val)
> > 32      {
> > 33              unsigned long lo, hi;
> > 34              lo = (unsigned long) val;
> > 35              hi = val >> 32;
> > 36              wrmsr (msr, lo, hi);
> > 37      }
> > 38
> > 39      /* wrmsr with exception handling */
> > 40      #define wrmsr_safe(msr,a,b) ({ int ret__;                         
> >
> >the guest also obviously crashes due to this #GPF.
> >  
> 
> The wary ones use wrmsr_safe().
> 
> >[ 2.6.20-rc2-rt2 kernel of course ;-) ]
> >
> >  
> 
> Who's the caller?  I boot 2.6.18 variants regularly and they don't touch 
> that msr.

the caller is in the gdb dump above:

> > 0xc011b8ae is in setup_apic_nmi_watchdog (include/asm/msr.h:36).

i'll change it to wrmsr_safe().

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                     ` <20061228140223.GA9418-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 14:09                                       ` Avi Kivity
       [not found]                                         ` <4593D011.9020808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-28 14:09 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Ingo Molnar wrote:
> * Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
>
>   
>>> that did the trick. The only messages remaining are:
>>>
>>> kvm: unhandled wrmsr: 0xc1
>>> inject_general_protection: rip 0xc011b8ae
>>>
>>>  
>>>       
>> That's a performance counter.  What guest triggers it?
>>     
>
> a 32-bit Linux bzImage:
>
>   c011b8ae:       0f 30                   wrmsr
>
>  (gdb) list *0xc011b8ae
>  0xc011b8ae is in setup_apic_nmi_watchdog (include/asm/msr.h:36).
>  31      static inline void wrmsrl (unsigned long msr, unsigned long long val)
>  32      {
>  33              unsigned long lo, hi;
>  34              lo = (unsigned long) val;
>  35              hi = val >> 32;
>  36              wrmsr (msr, lo, hi);
>  37      }
>  38
>  39      /* wrmsr with exception handling */
>  40      #define wrmsr_safe(msr,a,b) ({ int ret__;                              
>
> the guest also obviously crashes due to this #GPF.
>   

The wary ones use wrmsr_safe().

> [ 2.6.20-rc2-rt2 kernel of course ;-) ]
>
>   

Who's the caller?  I boot 2.6.18 variants regularly and they don't touch 
that msr.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                             ` <20061228140836.GB10033-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 14:12                                               ` Ingo Molnar
       [not found]                                                 ` <20061228141242.GA11229-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 14:12 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org> wrote:

> the caller is in the gdb dump above:
> 
> > > 0xc011b8ae is in setup_apic_nmi_watchdog (include/asm/msr.h:36).
> 
> i'll change it to wrmsr_safe().

actually, those MSRs are really architecture-defined for P6 family CPUs. 
So KVM/qemu should at least fake something there, or ignore it. These 
MSRs might be ticked by various existing kernels and distributions. 
Performance counters are ignored at the moment?

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                                 ` <20061228141242.GA11229-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 14:21                                                   ` Avi Kivity
       [not found]                                                     ` <4593D2D5.3020102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2006-12-28 14:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Ingo Molnar wrote:
> * Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org> wrote:
>
>   
>> the caller is in the gdb dump above:
>>
>>     
>>>> 0xc011b8ae is in setup_apic_nmi_watchdog (include/asm/msr.h:36).
>>>>         
>> i'll change it to wrmsr_safe().
>>     
>
> actually, those MSRs are really architecture-defined for P6 family CPUs. 
> So KVM/qemu should at least fake something there, or ignore it. These 
> MSRs might be ticked by various existing kernels and distributions. 
> Performance counters are ignored at the moment?
>   

They are unimplemented, and tricky to implement.  Just swallowing the 
wrmsr is easy, but it won't do the expected thing, whatever that is.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                                     ` <4593D2D5.3020102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-12-28 14:58                                                       ` Ingo Molnar
       [not found]                                                         ` <20061228145825.GA16057-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2006-12-28 14:58 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:

> >actually, those MSRs are really architecture-defined for P6 family 
> >CPUs. So KVM/qemu should at least fake something there, or ignore it. 
> >These MSRs might be ticked by various existing kernels and 
> >distributions. Performance counters are ignored at the moment?
> 
> They are unimplemented, and tricky to implement.  Just swallowing the 
> wrmsr is easy, but it won't do the expected thing, whatever that is.

the expected thing is to get periodic watchdog NMIs injected - but it's 
not a big problem if that doesnt work, the watchdog code detects that. 
Crashing during bootup isnt too sexy though.

	Ingo

-------------------------------------------------------------------------
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] 17+ messages in thread

* Re: [RFT] Fix for unhandled msr c0000081 problems under Intel cpus
       [not found]                                                         ` <20061228145825.GA16057-X9Un+BFzKDI@public.gmane.org>
@ 2006-12-28 15:05                                                           ` Avi Kivity
  0 siblings, 0 replies; 17+ messages in thread
From: Avi Kivity @ 2006-12-28 15:05 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Ingo Molnar wrote:
> * Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
>
>   
>>> actually, those MSRs are really architecture-defined for P6 family 
>>> CPUs. So KVM/qemu should at least fake something there, or ignore it. 
>>> These MSRs might be ticked by various existing kernels and 
>>> distributions. Performance counters are ignored at the moment?
>>>       
>> They are unimplemented, and tricky to implement.  Just swallowing the 
>> wrmsr is easy, but it won't do the expected thing, whatever that is.
>>     
>
> the expected thing is to get periodic watchdog NMIs injected - but it's 
> not a big problem if that doesnt work, the watchdog code detects that. 
> Crashing during bootup isnt too sexy though.
>   

I'll queue it for implementation then (it's just a variant of the timer 
interrupt).  Swallowing the wrmsr may be ok for Linux, but may cause 
other guests to fail unpredictably.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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] 17+ messages in thread

end of thread, other threads:[~2006-12-28 15:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-13  9:45 [RFT] Fix for unhandled msr c0000081 problems under Intel cpus Avi Kivity
     [not found] ` <457FCBB9.5070800-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-13 17:04   ` Michael Riepe
2006-12-13 19:26   ` Michael Riepe
     [not found]     ` <45805400.3060308-0QoEqw4nQxo@public.gmane.org>
2006-12-14  9:22       ` Avi Kivity
     [not found]         ` <458117E4.4010807-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-14 10:14           ` Avi Kivity
     [not found]             ` <45812407.7010803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-28 13:14               ` Ingo Molnar
     [not found]                 ` <20061228131445.GA1438-X9Un+BFzKDI@public.gmane.org>
2006-12-28 13:21                   ` Avi Kivity
     [not found]                     ` <4593C4CE.4040203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-28 13:26                       ` Ingo Molnar
     [not found]                         ` <20061228132602.GA3392-X9Un+BFzKDI@public.gmane.org>
2006-12-28 13:48                           ` Ingo Molnar
     [not found]                             ` <20061228134845.GA7446-X9Un+BFzKDI@public.gmane.org>
2006-12-28 13:56                               ` Avi Kivity
     [not found]                                 ` <4593CD12.7010603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-28 14:02                                   ` Ingo Molnar
     [not found]                                     ` <20061228140223.GA9418-X9Un+BFzKDI@public.gmane.org>
2006-12-28 14:09                                       ` Avi Kivity
     [not found]                                         ` <4593D011.9020808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-28 14:08                                           ` Ingo Molnar
     [not found]                                             ` <20061228140836.GB10033-X9Un+BFzKDI@public.gmane.org>
2006-12-28 14:12                                               ` Ingo Molnar
     [not found]                                                 ` <20061228141242.GA11229-X9Un+BFzKDI@public.gmane.org>
2006-12-28 14:21                                                   ` Avi Kivity
     [not found]                                                     ` <4593D2D5.3020102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-28 14:58                                                       ` Ingo Molnar
     [not found]                                                         ` <20061228145825.GA16057-X9Un+BFzKDI@public.gmane.org>
2006-12-28 15:05                                                           ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox