linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [PATCH] Add MCE support to KVM
Date: Tue, 14 Apr 2009 10:04:57 +0800	[thread overview]
Message-ID: <1239674697.20762.34.camel@yhuang-dev.sh.intel.com> (raw)
In-Reply-To: <49E337D7.5050502@redhat.com>

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

On Mon, 2009-04-13 at 21:02 +0800, Avi Kivity wrote:
> Huang Ying wrote:
> > On Sat, 2009-04-11 at 20:04 +0800, Avi Kivity wrote:
> >   
> >>>> Why not always allocate it on vcpu setup?
> >>>>     
> >>>>         
> >>> Because the MCE bank number is not fixed, it is based on mcg_cap from
> >>> user space.
> >>>   
> >>>       
> >> Right, but we can allocate the maximum number, no?  it's a fairly small 
> >> amount of memory.
> >>     
> >
> > OK. If you are OK with 8k extra memory usage.
> >   
> 
> Let's make it 64 banks like Andi suggests.  Return the number in the 
> KVM_CHECK_EXTENSION call (we do the same for memory slots) so userspace 
> can adjust.

OK. I will change this.

> >>
> >> kvm does feature negotiation (really, feature advertising) using 
> >> KVM_CAP_... and KVM_CHECK_EXTENSION.  So there's no need for this.
> >>     
> >
> > It is not only feature advertising, but also something like CPUID. Based
> > on CPU type specified in command line (qemu -cpu ?), different mcg_cap
> > can be used to determine number of MCE banks and various features of MCE
> > (MCG_CTL_P, MCG_TES_P, MCG_CMCI, etc) for specified CPU type. With KVM
> > feature advertising, we can only check whether MCE simulation is
> > supported, but can not set parameters of MCE simulation.
> >
> > Maybe this interface can be changed to KVM_SET_MSRS, with
> > MSR_IA32_MCG_CAP be set by kvm-qemu. But MSR_IA32_MCG_CAP is read-only
> > by spec, and current interface can not distinguishes between MSR set
> > from guest system and MSR setup from kvm-qemu. I think there should be
> > other read-only MSRs need to be setup during guest system
> > creation/setup. How about add a interface such as KVM_SETUP_MSRS to
> > setup the value of read-only MSRs?
> >   
> 
> Then we would need to tell which read-only MSRs are setup writeable and 
> which aren't...

Maybe something like only if KVM_CAP_MCE is advertised, the MCE related
read-only RO-MSRs can be setup. Other RO-MSRs setup code can be added
following the similar rules.

And interface is something like follow?

long kvm_arch_vcpu_ioctl(...)
{
    ...
    case KVM_SETUP_RO_MSRS:
        r = msr_io(vcpu, argp, kvm_setup_ro_msr, 0);
    ...
}

int kvm_setup_ro_msr(...)
{
    /* return 1 for setup un-writable MSR, otherwise 0 */
}

> I'm okay with an ioctl to setup MCE, but just make sure userspace has 
> all the information to know what the kernel can do rather than the 
> try-and-see-if-it-works approach.  We can publish this information via 
> KVM_CAP things, or via another ioctl (see KVM_GET_SUPPORTED_CPUID2 for 
> an example).

Yes. MCE support should be published by KVM_CAP_MCE and other features
can be published via reading the default value of MSR_IA32_MCG_CAP.

Best Regards,
Huang Ying


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-04-14  2:05 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08  1:53 [PATCH] Add MCE support to KVM Huang Ying
2009-04-09 15:50 ` Avi Kivity
2009-04-10  3:00   ` Huang Ying
2009-04-11 12:04     ` Avi Kivity
2009-04-11 12:19       ` Andi Kleen
2009-04-11 12:25         ` Avi Kivity
2009-04-13  8:26           ` Andi Kleen
2009-04-13  2:41       ` Huang Ying
2009-04-13 13:02         ` Avi Kivity
2009-04-14  2:04           ` Huang Ying [this message]
2009-04-14 10:45             ` Avi Kivity
2009-04-15  7:24               ` Huang Ying
2009-04-18 22:17           ` Anthony Liguori
2009-04-19  8:33             ` Avi Kivity
2009-04-20  7:52               ` Gerd Hoffmann
2009-04-20  8:26                 ` Avi Kivity
2009-04-20  8:59                   ` Gerd Hoffmann
2009-04-20  9:05                     ` Avi Kivity
2009-04-20 10:04                       ` Andi Kleen
2009-04-20 11:02                         ` Avi Kivity
2009-04-20 11:23                       ` Gerd Hoffmann
2009-04-20 11:27                         ` Avi Kivity
2009-04-20 12:20                           ` Gerd Hoffmann
2009-04-20 12:43                             ` Avi Kivity
2009-04-20 13:24                               ` Gerd Hoffmann
2009-04-20 13:45                                 ` Avi Kivity
2009-04-21  9:14                                   ` Xenner design and kvm msr handling Gerd Hoffmann
2009-04-21 10:14                                     ` Avi Kivity
2009-04-21 11:41                                       ` Gerd Hoffmann
2009-04-21 12:27                                         ` Avi Kivity
2009-04-21 12:47                                           ` Gerd Hoffmann
2009-04-21 13:33                                             ` Avi Kivity
2009-04-21 16:00                                               ` Gerd Hoffmann
2009-04-21 16:15                                                 ` Avi Kivity
2009-04-22 10:02                                                   ` Gerd Hoffmann
2009-04-21 16:04               ` [PATCH] Add MCE support to KVM Anthony Liguori
2009-04-21 16:17                 ` Avi Kivity

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=1239674697.20762.34.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;
as well as URLs for NNTP newsgroup(s).