public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Jim Mattson <jmattson@google.com>
Cc: Like Xu <like.xu.linux@gmail.com>,
	seanjc@google.com, dave.hansen@linux.intel.com,
	peterz@infradead.org, alexander.shishkin@linux.intel.com,
	eranian@google.com, daviddunn@google.com, ak@linux.intel.com,
	kan.liang@linux.intel.com, x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, kim.phillips@amd.com,
	santosh.shukla@amd.com,
	"Paolo Bonzini - Distinguished Engineer (kernel-recipes.org)
	(KVM HoF)"  <pbonzini@redhat.com>,
	Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH 3/3] KVM: x86/pmu: Segregate Intel and AMD specific logic
Date: Thu, 3 Mar 2022 21:55:16 +0530	[thread overview]
Message-ID: <54d94539-a14f-49d7-e4f3-092f76045b33@amd.com> (raw)
In-Reply-To: <CALMp9eQtW6SWG83rJa0jKt7ciHPiRbvEyCi2CDNkQ-FJC+ZLjA@mail.gmail.com>



On 03-Mar-22 10:08 AM, Jim Mattson wrote:
> On Mon, Feb 21, 2022 at 2:02 AM Ravi Bangoria <ravi.bangoria@amd.com> wrote:
>>
>>
>>
>> On 21-Feb-22 1:27 PM, Like Xu wrote:
>>> On 21/2/2022 3:31 pm, Ravi Bangoria wrote:
>>>>   void reprogram_counter(struct kvm_pmu *pmu, int pmc_idx)
>>>>   {
>>>>       struct kvm_pmc *pmc = kvm_x86_ops.pmu_ops->pmc_idx_to_pmc(pmu, pmc_idx);
>>>> +    bool is_intel = !strncmp(kvm_x86_ops.name, "kvm_intel", 9);
>>>
>>> How about using guest_cpuid_is_intel(vcpu)
>>
>> Yeah, that's better then strncmp().
>>
>>> directly in the reprogram_gp_counter() ?
>>
>> We need this flag in reprogram_fixed_counter() as well.
> 
> Explicit "is_intel" checks in any form seem clumsy,

Indeed. However introducing arch specific callback for such tiny
logic seemed overkill to me. So thought to just do it this way.

> since we have
> already put some effort into abstracting away the implementation
> differences in struct kvm_pmu. It seems like these differences could
> be handled by adding three masks to that structure: the "raw event
> mask" (i.e. event selector and unit mask), the hsw_in_tx mask, and the
> hsw_in_tx_checkpointed mask.

struct kvm_pmu is arch independent. You mean struct kvm_pmu_ops?

> 
> These changes should also be coordinated with Like's series that
> eliminates all of the PERF_TYPE_HARDWARE nonsense.

I'll rebase this on Like's patch series.

Thanks,
Ravi

  reply	other threads:[~2022-03-03 16:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  7:31 [PATCH 0/3] KVM: x86/pmu: Segregate Intel and AMD specific logic Ravi Bangoria
2022-02-21  7:31 ` [PATCH 1/3] x86/pmu: Add INTEL_ prefix in some Intel specific macros Ravi Bangoria
2022-02-21  7:31 ` [PATCH 2/3] x86/pmu: Replace X86_ALL_EVENT_FLAGS with INTEL_ALL_EVENT_FLAGS Ravi Bangoria
2022-02-21  7:31 ` [PATCH 3/3] KVM: x86/pmu: Segregate Intel and AMD specific logic Ravi Bangoria
2022-02-21  7:57   ` Like Xu
2022-02-21 10:01     ` Ravi Bangoria
2022-03-03  4:38       ` Jim Mattson
2022-03-03 16:25         ` Ravi Bangoria [this message]
2022-03-03 18:05           ` Jim Mattson
2022-03-04  9:33             ` Like Xu
2022-03-05  3:29               ` Ravi Bangoria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54d94539-a14f-49d7-e4f3-092f76045b33@amd.com \
    --to=ravi.bangoria@amd.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=daviddunn@google.com \
    --cc=eranian@google.com \
    --cc=jmattson@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kim.phillips@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=santosh.shukla@amd.com \
    --cc=seanjc@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox