All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Stefan Pietsch <stefan.pietsch@lsexperts.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	kvm@vger.kernel.org, 707257@bugs.debian.org
Subject: Re: Bug#707257: linux-image-3.8-1-686-pae: KVM crashes with "entry failed, hardware error 0x80000021"
Date: Wed, 26 Jun 2013 13:47:03 +0300	[thread overview]
Message-ID: <20130626104703.GW18508@redhat.com> (raw)
In-Reply-To: <51C8AF51.8060401@sp.consulting.lsexperts.de>

On Mon, Jun 24, 2013 at 10:42:57PM +0200, Stefan Pietsch wrote:
> On 24.06.2013 14:30, Gleb Natapov wrote:
> > On Mon, Jun 24, 2013 at 01:59:34PM +0200, Stefan Pietsch wrote:
> >> As soon as I remove "kvmvapic.bin" the virtual machine boots with
> >> qemu-kvm 1.5.0. I just verified this with Linux kernel 3.10.0-rc5.
> >> "emulate_invalid_guest_state=0" or "emulate_invalid_guest_state=1" make
> >> no difference.
> >>
> >> Please send your patches.
> > Here it is, run with it and kvmvapic.bin present. See what is printed in
> > dmesg after the failure.
> > 
> > 
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > index f4a5b3f..65488a4 100644
> > --- a/arch/x86/kvm/vmx.c
> > +++ b/arch/x86/kvm/vmx.c
> > @@ -3385,6 +3385,7 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
> >  {
> >  	struct vcpu_vmx *vmx = to_vmx(vcpu);
> >  	u32 ar;
> > +	unsigned long rip;
> >  
> >  	if (vmx->rmode.vm86_active && seg != VCPU_SREG_LDTR) {
> >  		*var = vmx->rmode.segs[seg];
> > @@ -3408,6 +3409,9 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
> >  	var->db = (ar >> 14) & 1;
> >  	var->g = (ar >> 15) & 1;
> >  	var->unusable = (ar >> 16) & 1;
> > +	rip = kvm_rip_read(vcpu);
> > +	if ((rip == 0xc101611c || rip == 0xc101611a) && seg == VCPU_SREG_FS)
> > +		printk("base=%p limit=%p selector=%x ar=%x\n", var->base, var->limit, var->selector, ar);
> >  }
> >  
> >  static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)
> 
> 
> Booting kernel Linux 3.10-rc5 with your patch applied produces these
> messages in dmesg when starting a virtual machine:
> 
> emulate_invalid_guest_state=0
> [  118.732151] base=ffff0000 limit=  (null) selector=f0000fff ar=0
> [  118.732341] base=ffff0000 limit=  (null) selector=f0000fff ar=0
> 
I've butchered printk format, but it gives me the idea of what is going
on anyway. Can you try the patch below with
emulate_invalid_guest_state=0|1?


diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index f4a5b3f..eb062ce 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3395,19 +3395,20 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
 		var->selector = vmx_read_guest_seg_selector(vmx, seg);
 		return;
 	}
+
 	var->base = vmx_read_guest_seg_base(vmx, seg);
 	var->limit = vmx_read_guest_seg_limit(vmx, seg);
 	var->selector = vmx_read_guest_seg_selector(vmx, seg);
 	ar = vmx_read_guest_seg_ar(vmx, seg);
+	var->unusable = (ar >> 16) & 1;
 	var->type = ar & 15;
 	var->s = (ar >> 4) & 1;
 	var->dpl = (ar >> 5) & 3;
-	var->present = (ar >> 7) & 1;
+	var->present = !var->unusable;
 	var->avl = (ar >> 12) & 1;
 	var->l = (ar >> 13) & 1;
 	var->db = (ar >> 14) & 1;
 	var->g = (ar >> 15) & 1;
-	var->unusable = (ar >> 16) & 1;
 }
 
 static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)

--
			Gleb.

  reply	other threads:[~2013-06-26 10:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <518A7323.7000302@sp.consulting.lsexperts.de>
     [not found] ` <1368061686.4131.225.camel@deadeye.wl.decadent.org.uk>
     [not found]   ` <518BF14E.3070509@sp.consulting.lsexperts.de>
     [not found]     ` <5194C254.4000201@sp.consulting.lsexperts.de>
2013-05-19  1:00       ` Bug#707257: linux-image-3.8-1-686-pae: KVM crashes with "entry failed, hardware error 0x80000021" Ben Hutchings
2013-05-19 12:32         ` Gleb Natapov
2013-05-29 15:05           ` Stefan Pietsch
2013-05-29 17:20             ` Ben Hutchings
2013-06-05 11:57           ` Stefan Pietsch
2013-06-05 12:10             ` Gleb Natapov
2013-06-05 12:51               ` Stefan Pietsch
2013-06-06  6:42                 ` Gleb Natapov
2013-06-06  7:20                   ` Gleb Natapov
2013-06-06 11:35                   ` Stefan Pietsch
2013-06-06 11:40                     ` Gleb Natapov
2013-06-06 12:10                       ` Stefan Pietsch
2013-06-09  9:43                         ` Gleb Natapov
2013-06-13 11:57                           ` Stefan Pietsch
2013-06-13 13:42                             ` Paolo Bonzini
2013-06-13 13:46                               ` Paolo Bonzini
2013-06-13 14:59                               ` Stefan Pietsch
2013-06-16  0:25                                 ` Stefan Pietsch
2013-06-17 16:07                                   ` Paolo Bonzini
2013-06-18 16:35                                     ` Stefan Pietsch
2013-06-19 13:41                                   ` Gleb Natapov
2013-06-19 14:12                                     ` Stefan Pietsch
2013-06-19 14:38                                       ` Gleb Natapov
2013-06-20 17:01                                         ` Stefan Pietsch
2013-06-23  7:51                                           ` Gleb Natapov
2013-06-23 16:51                                             ` Stefan Pietsch
2013-06-23 17:36                                               ` Gleb Natapov
2013-06-24 11:43                                                 ` Stefan Pietsch
2013-06-24 11:47                                                   ` Gleb Natapov
2013-06-24 11:59                                                     ` Stefan Pietsch
2013-06-24 12:30                                                       ` Gleb Natapov
2013-06-24 20:42                                                         ` Stefan Pietsch
2013-06-26 10:47                                                           ` Gleb Natapov [this message]
2013-06-27 14:09                                                             ` Stefan Pietsch
2013-06-27 20:01                                                               ` Gleb Natapov

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=20130626104703.GW18508@redhat.com \
    --to=gleb@redhat.com \
    --cc=707257@bugs.debian.org \
    --cc=ben@decadent.org.uk \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=stefan.pietsch@lsexperts.de \
    /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.