From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Huang Subject: Re: [PATCH V2 3/5] KVM: x86/vPMU: Create vPMU interface for VMX and SVM Date: Thu, 09 Apr 2015 16:08:38 -0500 Message-ID: <5526EA56.7010403@redhat.com> References: <1428509905-32352-1-git-send-email-wei@redhat.com> <1428509905-32352-4-git-send-email-wei@redhat.com> <20150409194344.GC9729@potion.brq.redhat.com> <5526DB24.8020707@redhat.com> <20150409205453.GA17888@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, pbonzini@redhat.com, gleb@kernel.org To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54698 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754151AbbDIVIl (ORCPT ); Thu, 9 Apr 2015 17:08:41 -0400 In-Reply-To: <20150409205453.GA17888@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: >>>> @@ -4918,13 +4919,13 @@ static int emulator_set_msr(struct x86_emulate_ctxt *ctxt, >>>> static int emulator_check_pmc(struct x86_emulate_ctxt *ctxt, >>>> u32 pmc) >>>> { >>>> - return kvm_pmu_check_pmc(emul_to_vcpu(ctxt), pmc); >>>> + return kvm_pmu_check_msr_idx(emul_to_vcpu(ctxt), pmc); >>> >>> (Why not pmc?) >> See "Design Note" in pmu.c for a better explanation. I tried to use msr as >> real x86 MSR; and msr_idx refers to MSR offset. > > I skipped the comment as I thought it was there before, sorry ... > > I wouldn't call it MSR index, MSR is just a related interface for PMC, > and MSR indices don't even have simple mapping to RDPMC ones. > We are indexing PMC without MSR, so index/pmc_idx/pmc seems better. > I can fix the name of this function (maybe back to kvm_pmu_check_pmc(), let me think about it). In the meanwhile, do you have any comments on the following names? They will impact the rest code: * msr: MSR for x86 * msr_idx: offset of MSR registers (used by rdpmc) * glb_idx: a unified index for both GP and fixed counters (should we rename it to idx instead?) Are they confusing to you? Maybe I should move "Design Note" to commit message instead of real code? Thanks, -Wei