All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Remove user space triggerable MCE error message
@ 2011-01-15  9:00 Jan Kiszka
  2011-01-17  0:54 ` Huang Ying
  2011-01-20 16:04 ` Marcelo Tosatti
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Kiszka @ 2011-01-15  9:00 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Huang Ying

From: Jan Kiszka <jan.kiszka@siemens.com>

This case is a pure user space error we do not need to record. Moreover,
it can be misused to flood the kernel log. Remove it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/kvm/x86.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9dda70d..7f7e4a5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2575,9 +2575,6 @@ static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
 	if (mce->status & MCI_STATUS_UC) {
 		if ((vcpu->arch.mcg_status & MCG_STATUS_MCIP) ||
 		    !kvm_read_cr4_bits(vcpu, X86_CR4_MCE)) {
-			printk(KERN_DEBUG "kvm: set_mce: "
-			       "injects mce exception while "
-			       "previous one is in progress!\n");
 			kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
 			return 0;
 		}
-- 
1.7.1

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

* Re: [PATCH] KVM: x86: Remove user space triggerable MCE error message
  2011-01-15  9:00 [PATCH] KVM: x86: Remove user space triggerable MCE error message Jan Kiszka
@ 2011-01-17  0:54 ` Huang Ying
  2011-01-17  7:11   ` Jan Kiszka
  2011-01-20 16:04 ` Marcelo Tosatti
  1 sibling, 1 reply; 6+ messages in thread
From: Huang Ying @ 2011-01-17  0:54 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

On Sat, 2011-01-15 at 17:00 +0800, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This case is a pure user space error we do not need to record. Moreover,
> it can be misused to flood the kernel log. Remove it.

I don't think this is a pure user space error.  This happens on real
hardware too, if the Machine Check exception is raised during early boot
stage or the second MC exception is raised before the first MC exception
is processed/cleared.

So I use printk here to help debugging these issues.

To avoid flooding the kernel log, we can use ratelimit.

Best Regards,
Huang Ying

> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  arch/x86/kvm/x86.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 9dda70d..7f7e4a5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2575,9 +2575,6 @@ static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
>  	if (mce->status & MCI_STATUS_UC) {
>  		if ((vcpu->arch.mcg_status & MCG_STATUS_MCIP) ||
>  		    !kvm_read_cr4_bits(vcpu, X86_CR4_MCE)) {
> -			printk(KERN_DEBUG "kvm: set_mce: "
> -			       "injects mce exception while "
> -			       "previous one is in progress!\n");
>  			kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
>  			return 0;
>  		}



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

* Re: [PATCH] KVM: x86: Remove user space triggerable MCE error message
  2011-01-17  0:54 ` Huang Ying
@ 2011-01-17  7:11   ` Jan Kiszka
  2011-01-17  7:31     ` Huang Ying
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2011-01-17  7:11 UTC (permalink / raw)
  To: Huang Ying; +Cc: Avi Kivity, Marcelo Tosatti, kvm

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

On 2011-01-17 01:54, Huang Ying wrote:
> On Sat, 2011-01-15 at 17:00 +0800, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> This case is a pure user space error we do not need to record. Moreover,
>> it can be misused to flood the kernel log. Remove it.
> 
> I don't think this is a pure user space error.  This happens on real
> hardware too, if the Machine Check exception is raised during early boot
> stage or the second MC exception is raised before the first MC exception
> is processed/cleared.
> 
> So I use printk here to help debugging these issues.
> 
> To avoid flooding the kernel log, we can use ratelimit.

With user space I meant qemu, and maybe "error" was the wrong term. This
code path is only triggered if qemu decides to. And there you may also
print this event (and you already do).

Another reason to not rely on catching this case here: KVM_X86_SET_MCE
is obsolete on current kernels. Qemu will use a combination of
KVM_SET_MSRS and KVM_SET_VCPU_EVENTS in the future, only falling back to
this interface on pre-vcpu-events kernels. Then you need to debug this
in user space anyway as the triple fault will no longer make it to the
kernel.

Jan

> 
> Best Regards,
> Huang Ying
> 
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  arch/x86/kvm/x86.c |    3 ---
>>  1 files changed, 0 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 9dda70d..7f7e4a5 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -2575,9 +2575,6 @@ static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
>>  	if (mce->status & MCI_STATUS_UC) {
>>  		if ((vcpu->arch.mcg_status & MCG_STATUS_MCIP) ||
>>  		    !kvm_read_cr4_bits(vcpu, X86_CR4_MCE)) {
>> -			printk(KERN_DEBUG "kvm: set_mce: "
>> -			       "injects mce exception while "
>> -			       "previous one is in progress!\n");
>>  			kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
>>  			return 0;
>>  		}
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

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

* Re: [PATCH] KVM: x86: Remove user space triggerable MCE error message
  2011-01-17  7:11   ` Jan Kiszka
@ 2011-01-17  7:31     ` Huang Ying
  2011-01-17  8:01       ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Huang Ying @ 2011-01-17  7:31 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm

On Mon, 2011-01-17 at 15:11 +0800, Jan Kiszka wrote:
> On 2011-01-17 01:54, Huang Ying wrote:
> > On Sat, 2011-01-15 at 17:00 +0800, Jan Kiszka wrote:
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> This case is a pure user space error we do not need to record. Moreover,
> >> it can be misused to flood the kernel log. Remove it.
> > 
> > I don't think this is a pure user space error.  This happens on real
> > hardware too, if the Machine Check exception is raised during early boot
> > stage or the second MC exception is raised before the first MC exception
> > is processed/cleared.
> > 
> > So I use printk here to help debugging these issues.
> > 
> > To avoid flooding the kernel log, we can use ratelimit.
> 
> With user space I meant qemu, and maybe "error" was the wrong term. This
> code path is only triggered if qemu decides to.

Not only decided by qemu, but also decided by guest OS.  If guest OS
does not clear the MSR or guest OS does not set the X86_CR4_MCE bit in
the cr4, the triple fault will be triggered.

> And there you may also
> print this event (and you already do).

Sorry, which print do you mean?  I can not find similar print in user
space.

> Another reason to not rely on catching this case here: KVM_X86_SET_MCE
> is obsolete on current kernels. Qemu will use a combination of
> KVM_SET_MSRS and KVM_SET_VCPU_EVENTS in the future, only falling back to
> this interface on pre-vcpu-events kernels. Then you need to debug this
> in user space anyway as the triple fault will no longer make it to the
> kernel.

OK.  Then, I think it will be helpful for debugging if we can print
something like this in user space implementation.

Best Regards,
Huang Ying



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

* Re: [PATCH] KVM: x86: Remove user space triggerable MCE error message
  2011-01-17  7:31     ` Huang Ying
@ 2011-01-17  8:01       ` Jan Kiszka
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2011-01-17  8:01 UTC (permalink / raw)
  To: Huang Ying; +Cc: Avi Kivity, Marcelo Tosatti, kvm

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

On 2011-01-17 08:31, Huang Ying wrote:
> On Mon, 2011-01-17 at 15:11 +0800, Jan Kiszka wrote:
>> On 2011-01-17 01:54, Huang Ying wrote:
>>> On Sat, 2011-01-15 at 17:00 +0800, Jan Kiszka wrote:
>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>> This case is a pure user space error we do not need to record. Moreover,
>>>> it can be misused to flood the kernel log. Remove it.
>>>
>>> I don't think this is a pure user space error.  This happens on real
>>> hardware too, if the Machine Check exception is raised during early boot
>>> stage or the second MC exception is raised before the first MC exception
>>> is processed/cleared.
>>>
>>> So I use printk here to help debugging these issues.
>>>
>>> To avoid flooding the kernel log, we can use ratelimit.
>>
>> With user space I meant qemu, and maybe "error" was the wrong term. This
>> code path is only triggered if qemu decides to.
> 
> Not only decided by qemu, but also decided by guest OS.  If guest OS
> does not clear the MSR or guest OS does not set the X86_CR4_MCE bit in
> the cr4, the triple fault will be triggered.

Right, but qemu has full access to the state and can detect this.

> 
>> And there you may also
>> print this event (and you already do).
> 
> Sorry, which print do you mean?  I can not find similar print in user
> space.

Err, it's not yet there for the kvm case, I was starring at the tcg code
path.

> 
>> Another reason to not rely on catching this case here: KVM_X86_SET_MCE
>> is obsolete on current kernels. Qemu will use a combination of
>> KVM_SET_MSRS and KVM_SET_VCPU_EVENTS in the future, only falling back to
>> this interface on pre-vcpu-events kernels. Then you need to debug this
>> in user space anyway as the triple fault will no longer make it to the
>> kernel.
> 
> OK.  Then, I think it will be helpful for debugging if we can print
> something like this in user space implementation.

qemu_log_mask(CPU_LOG_RESET, "Triple fault\n");

(and there will be a message on the monitor if raised manually)

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

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

* Re: [PATCH] KVM: x86: Remove user space triggerable MCE error message
  2011-01-15  9:00 [PATCH] KVM: x86: Remove user space triggerable MCE error message Jan Kiszka
  2011-01-17  0:54 ` Huang Ying
@ 2011-01-20 16:04 ` Marcelo Tosatti
  1 sibling, 0 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2011-01-20 16:04 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, kvm, Huang Ying

On Sat, Jan 15, 2011 at 10:00:53AM +0100, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This case is a pure user space error we do not need to record. Moreover,
> it can be misused to flood the kernel log. Remove it.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Applied, thanks.


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

end of thread, other threads:[~2011-01-20 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15  9:00 [PATCH] KVM: x86: Remove user space triggerable MCE error message Jan Kiszka
2011-01-17  0:54 ` Huang Ying
2011-01-17  7:11   ` Jan Kiszka
2011-01-17  7:31     ` Huang Ying
2011-01-17  8:01       ` Jan Kiszka
2011-01-20 16:04 ` Marcelo Tosatti

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.