public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [PATCH -v3] KVM: Add VT-x machine check support
Date: Mon, 08 Jun 2009 16:56:29 +0800	[thread overview]
Message-ID: <1244451389.8361.592.camel@yhuang-dev.sh.intel.com> (raw)
In-Reply-To: <4A2CD04D.7070603@redhat.com>

On Mon, 2009-06-08 at 16:48 +0800, Avi Kivity wrote:
> Huang Ying wrote:
> > From: Andi Kleen <ak@linux.intel.com>
> >
> > VT-x needs an explicit MC vector intercept to handle machine checks in the 
> > hyper visor.
> >
> > It also has a special option to catch machine checks that happen
> > during VT entry.
> >
> > Do these interceptions and forward them to the Linux machine check
> > handler. Make it always look like user space is interrupted because
> > the machine check handler treats kernel/user space differently.
> >
> > Thanks to Jiang Yunhong for help and testing.
> >
> >   
> 
> Noticed an additional problem.  See below.
> 
> >  static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> >  {
> >  	struct vcpu_vmx *vmx = to_vmx(vcpu);
> > @@ -2616,6 +2640,10 @@ static int handle_exception(struct kvm_v
> >  	vect_info = vmx->idt_vectoring_info;
> >  	intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
> >  
> > +	ex_no = intr_info & INTR_INFO_VECTOR_MASK;
> > +	if (ex_no == MC_VECTOR)
> > +		return handle_machine_check(vcpu, kvm_run);
> > +
> >   
> 
> It isn't sufficient to check the vector number; you also need to check 
> the interrupt type.  See for example is_page_fault() and is_no_device().
> 
> I suggest you add an is_machine_check() along similar lines.  Later we 
> can collapse all those functions to use a single helper.

OK. I will do this.

> > --- a/arch/x86/include/asm/kvm_host.h
> > +++ b/arch/x86/include/asm/kvm_host.h
> > @@ -382,6 +382,8 @@ struct kvm_vcpu_arch {
> >  	u64 mcg_status;
> >  	u64 mcg_ctl;
> >  	u64 *mce_banks;
> > +
> > +	u32 exit_reason;
> >  };
> >   
> 
> Please move this into struct vcpu_vmx.

OK.

Best Regards,
Huang Ying


      reply	other threads:[~2009-06-08  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  8:32 [PATCH -v3] KVM: Add VT-x machine check support Huang Ying
2009-06-08  8:48 ` Avi Kivity
2009-06-08  8:56   ` Huang Ying [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=1244451389.8361.592.camel@yhuang-dev.sh.intel.com \
    --to=ying.huang@intel.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@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