From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: Re: [PATCH 6] X86/MCE: update vMCE injection for AMD Date: Thu, 27 Sep 2012 10:54:18 +0200 Message-ID: <5064143A.6070203@amd.com> References: <506173FB.8070603@amd.com> <5061A833020000780009DA1A@nat28.tlf.novell.com> <50619B61.2030609@amd.com> <5062CC25020000780009DE44@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Liu, Jinsong" Cc: "xen-devel@lists.xensource.com" , "keir@xen.org" , "Ian.Campbell@citrix.com" , Jan Beulich List-Id: xen-devel@lists.xenproject.org On 09/27/12 07:22, Liu, Jinsong wrote: > Jan Beulich wrote: >>>>> On 26.09.12 at 05:11, "Liu, Jinsong" wrote: >>> I fold patch 6 to patch 2, will send out later. >> >> As I had indicated, I had done this already in preparation of things >> getting committed, so you will want to check once in staging >> (hopefully later today). >> >> Jan > > Got it, thanks! It's OK to me, but how about add sanity check and some comments like > > ================== > Xen/MCE: add sanity check and comments for vmce injection > > Add sanity check for input vcpu so that malicious value would not return 0. > Add comments since vcpu<0 (broadcast) is some implicit to code reader. Yeah, a like #define VMCE_INJECT_BROADCAST is also helpful. > > Signed-off-by: Liu, Jinsong > > diff -r adc7f057011e xen/arch/x86/cpu/mcheck/vmce.c > --- a/xen/arch/x86/cpu/mcheck/vmce.c Thu Sep 27 19:52:13 2012 +0800 > +++ b/xen/arch/x86/cpu/mcheck/vmce.c Thu Sep 27 20:56:52 2012 +0800 > @@ -341,10 +341,16 @@ > /* > * for Intel MCE, broadcast vMCE to all vcpus > * for AMD MCE, only inject vMCE to vcpu0 > + * > + * @ d, domain to which would inject vmce > + * @ vcpu, > + * < 0, broadcast vMCE to all vcpus > + * >= 0, vcpu who would be injected vMCE Better wording: >= 0, vcpu, the vMCE is injected to Christoph > */ > int inject_vmce(struct domain *d, int vcpu) > { > struct vcpu *v; > + int ret = -EINVAL; > > for_each_vcpu ( d, v ) > { > @@ -358,19 +364,21 @@ > mce_printk(MCE_VERBOSE, "MCE: inject vMCE to d%d:v%d\n", > d->domain_id, v->vcpu_id); > vcpu_kick(v); > + ret = 0; > } > else > { > mce_printk(MCE_QUIET, "Failed to inject vMCE to d%d:v%d\n", > d->domain_id, v->vcpu_id); > - return -EBUSY; > + ret = -EBUSY; > + break; > } > > if ( vcpu >= 0 ) > - return 0; > + break; > } > > - return v ? -ESRCH : 0; > + return ret; > } > > int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct domain *d, -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632