From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v18 11/16] x86/VPMU: Handle PMU interrupts for PV guests Date: Tue, 17 Feb 2015 15:44:27 +0000 Message-ID: <54E361DB.80408@citrix.com> References: <1424125619-10851-1-git-send-email-boris.ostrovsky@oracle.com> <1424125619-10851-12-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1424125619-10851-12-git-send-email-boris.ostrovsky@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky , JBeulich@suse.com, kevin.tian@intel.com, suravee.suthikulpanit@amd.com, Aravind.Gopalakrishnan@amd.com, dietmar.hahn@ts.fujitsu.com, dgdegra@tycho.nsa.gov Cc: tim@xen.org, jun.nakajima@intel.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 16/02/15 22:26, Boris Ostrovsky wrote: > diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c > index 1d5ae8d..cf4c70b 100644 > --- a/xen/arch/x86/hvm/vpmu.c > +++ b/xen/arch/x86/hvm/vpmu.c > > +static struct vcpu *choose_hwdom_vcpu(void) > +{ > + unsigned idx = smp_processor_id() % hardware_domain->max_vcpus; > + > + if ( hardware_domain->vcpu == NULL ) > + return NULL; If d->vcpu is NULL, d->max_vcpus was 0 and you have already died with a #DE You can guarentee that if max_vcpus > 0, d->vcpu is not NULL. ~Andrew > + > + return hardware_domain->vcpu[idx]; > +} > +