From: "Jan Beulich" Subject: Re: [PATCH v19 11/14] x86/VPMU: Handle PMU interrupts for PV guests Date: Tue, 24 Mar 2015 16:03:33 +0000 Message-ID: <551198E5020000780006D1A7@mail.emea.novell.com> References: <1426604051-2980-1-git-send-email-boris.ostrovsky@oracle.com> <1426604051-2980-12-git-send-email-boris.ostrovsky@oracle.com> <551182A3020000780006D030@mail.emea.novell.com> <55117F2B.7010900@oracle.com> <5511928F020000780006D13E@mail.emea.novell.com> <55118700.9050204@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55118700.9050204@oracle.com> Content-Disposition: inline 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 Cc: kevin.tian@intel.com, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, tim@xen.org, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, Aravind.Gopalakrishnan@amd.com, jun.nakajima@intel.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org >>> On 24.03.15 at 16:47, wrote: > On 03/24/2015 11:36 AM, Jan Beulich wrote: >>>>> On 24.03.15 at 16:13, wrote: >>> On 03/24/2015 10:28 AM, Jan Beulich wrote: >>>>>>> On 17.03.15 at 15:54, wrote: >>>>> Changes in v19: >>>>> * Adjusted for new ops interfaces (passing vcpu vs. vpmu) >>>>> * Test for domain->max_cpu in choose_hwdom_vcpu() instead of >>>>> 'domain->vcpu!=NULL' >>>> I suppose that's something that then should also be done in patch 7? >>> We only need this routine during interrupt handling (for PV(H)) and this >>> is the patch that introduces this functionality. >>> >>> And if you are asking about the test specifically --- this is also the >>> first patch where we refer to hardware_domain->vcpu[], which is what the >>> test is really for. >>> >>> Or is it something else that you had in mind? >> Yes - following Andrew's cleanup I believe the d->vcpu != NULL >> check is redundant with having (perhaps indirectly) >> checked d->max_vcpus > 0. > > Then I am not sure I understand what you are asking me to do for patch > 7, sorry. There you have +static int pvpmu_init(struct domain *d, xen_pmu_params_t *params) +{ + struct vcpu *v; + struct vpmu_struct *vpmu; + struct page_info *page; + uint64_t gfn = params->val; + + if ( vpmu_mode == XENPMU_MODE_OFF ) + return -EINVAL; + + if ( (params->vcpu >= d->max_vcpus) || (d->vcpu == NULL) || + (d->vcpu[params->vcpu] == NULL) ) + return -EINVAL; This conditional checks both ->max_vcpus and ->vcpu, when the former check passes you already know ->max_vcpus > 0. Jan