From: Sean Christopherson <seanjc@google.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Aaron Lewis <aaronlewis@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 4/4] KVM: x86/pmu: Move .hw_event_available() check out of PMC filter helper
Date: Wed, 12 Jul 2023 09:11:40 -0700 [thread overview]
Message-ID: <ZK7QvMrGJ9HzJLPG@google.com> (raw)
In-Reply-To: <81c32ae2-ff21-131f-e498-f87b1e7fe3b5@gmail.com>
On Wed, Jul 12, 2023, Like Xu wrote:
> On 2023/6/7 09:02, Sean Christopherson wrote:
> > Move the call to kvm_x86_pmu.hw_event_available(), which has nothing to
> > with the userspace PMU filter, out of check_pmu_event_filter() and into
> > its sole caller pmc_event_is_allowed(). pmc_event_is_allowed() didn't
> > exist when commit 7aadaa988c5e ("KVM: x86/pmu: Drop amd_event_mapping[]
> > in the KVM context"), so presumably the motivation for invoking
> > .hw_event_available() from check_pmu_event_filter() was to avoid having
> > to add multiple call sites.
>
> The event unavailability check based on intel cpuid is, in my opinion,
> part of our pmu_event_filter mechanism. Unavailable events can be
> defined either by KVM userspace or by architectural cpuid (if any).
>
> The bigger issue here is what happens when the two rules conflict, and
> the answer can be found more easily by putting the two parts in one
> function (the architectural cpuid rule takes precedence).
I want to clearly differentiate between what KVM allows and what userspace allows,
and specifically I want to use "filter" only to describe userspace intervention as
much as possible.
Outside of kvm_get_filtered_xcr0(), which I would classify as userspace-defined
behavior (albeit rather indirectly), and a few architecturally defined "filter"
terms from Intel and AMD, we don't use "filter" in KVM to describe KVM behavior.
IMO, there's a lot of value in being able to associate "filter" with userspace
desires, e.g. just mentioning "filtering" immediately frames a conversation as
dealing with userspace's wants, not internal KVM behavior.
next prev parent reply other threads:[~2023-07-12 16:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 1:02 [PATCH 0/4] KVM: x86/pmu: Clean up arch/hw event handling Sean Christopherson
2023-06-07 1:02 ` [PATCH 1/4] KVM: x86/pmu: Use enums instead of hardcoded magic for arch event indices Sean Christopherson
2023-07-10 10:50 ` Like Xu
2023-06-07 1:02 ` [PATCH 2/4] KVM: x86/pmu: Simplify intel_hw_event_available() Sean Christopherson
2023-06-07 1:02 ` [PATCH 3/4] KVM: x86/pmu: Require nr fixed_pmc_events to match nr max fixed counters Sean Christopherson
2023-06-07 1:02 ` [PATCH 4/4] KVM: x86/pmu: Move .hw_event_available() check out of PMC filter helper Sean Christopherson
2023-07-11 16:32 ` Like Xu
2023-07-12 16:11 ` Sean Christopherson [this message]
2023-08-03 0:05 ` [PATCH 0/4] KVM: x86/pmu: Clean up arch/hw event handling Sean Christopherson
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=ZK7QvMrGJ9HzJLPG@google.com \
--to=seanjc@google.com \
--cc=aaronlewis@google.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.