From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v3 05/16] x86/VPMU: Handle APIC_LVTPC accesses Date: Mon, 13 Jan 2014 10:04:40 -0500 Message-ID: <52D40088.6080401@oracle.com> References: <1389036295-3877-1-git-send-email-boris.ostrovsky@oracle.com> <1389036295-3877-6-git-send-email-boris.ostrovsky@oracle.com> <52D3F82A020000780011313A@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1W2j3o-0006hn-Cg for xen-devel@lists.xenproject.org; Mon, 13 Jan 2014 15:04:16 +0000 In-Reply-To: <52D3F82A020000780011313A@nat28.tlf.novell.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: Jan Beulich Cc: keir@xen.org, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, dietmar.hahn@ts.fujitsu.com, jun.nakajima@intel.com, xen-devel List-Id: xen-devel@lists.xenproject.org On 01/13/2014 08:28 AM, Jan Beulich wrote: >>>> On 06.01.14 at 20:24, Boris Ostrovsky wrote: >> Update APIC_LVTPC vector when HVM guest writes to it. >> >> Signed-off-by: Boris Ostrovsky ... >> +void vpmu_lvtpc_update(uint32_t val) >> +{ >> + struct vpmu_struct *vpmu = vcpu_vpmu(current); >> + >> + vpmu->hw_lapic_lvtpc = PMU_APIC_VECTOR | (val & APIC_LVT_MASKED); >> + apic_write(APIC_LVTPC, vpmu->hw_lapic_lvtpc); >> +} >> + >> int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content) >> { >> struct vpmu_struct *vpmu = vcpu_vpmu(current); >> @@ -227,19 +235,21 @@ void vpmu_initialise(struct vcpu *v) >> case X86_VENDOR_AMD: >> if ( svm_vpmu_initialise(v, opt_vpmu_enabled) != 0 ) >> opt_vpmu_enabled = 0; >> - break; >> + return; >> >> case X86_VENDOR_INTEL: >> if ( vmx_vpmu_initialise(v, opt_vpmu_enabled) != 0 ) >> opt_vpmu_enabled = 0; >> - break; >> + return; >> >> default: >> printk("VPMU: Initialization failed. " >> "Unknown CPU vendor %d\n", vendor); >> opt_vpmu_enabled = 0; >> - break; >> + return; >> } >> + >> + vpmu->hw_lapic_lvtpc = PMU_APIC_VECTOR | APIC_LVT_MASKED; >> } > So what is this good for? All code paths above use "return" now, > hence how would execution get here? Yes, it shouldn't be here. I could move it up but since we are now updating LVTPC explicitly when a guest is writing APIC I think I can just drop it altogether. -boris