From: Aaron Lewis <aaronlewis@google.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, jmattson@google.com, seanjc@google.com,
Aaron Lewis <aaronlewis@google.com>
Subject: [PATCH v4 0/7] Introduce and test masked events
Date: Wed, 31 Aug 2022 16:21:17 +0000 [thread overview]
Message-ID: <20220831162124.947028-1-aaronlewis@google.com> (raw)
This series introduces the concept of masked events to the pmu event
filter. Masked events can help reduce the number of events needed in the
pmu event filter by allowing a more generalized matching method to be
used for the unit mask when filtering guest events in the pmu. With
masked events, if an event select should be restricted from the guest,
instead of having to add an entry to the pmu event filter for each
event select + unit mask pair, a masked event can be added to generalize
the unit mask values.
v3 -> v4
- Patch #1, Fix the mask for the guest event select used in bsearch.
- Patch #2, Remove invalid events from the pmu event filter.
- Patch #3, Create an internal/common representation for filter events.
- Patch #4,
- Use a common filter event to simplify kernel code. [Jim]
- s/invalid/exclude for masked events. More descriptive. [Sean]
- Simplified masked event layout. There was no need to complicate it.
- Add KVM_CAP_PMU_EVENT_MASKED_EVENTS.
- Patch #7, Rewrote the masked events tests using MEM_INST_RETIRED (0xd0)
on Intel and LS Dispatch (0x29) on AMD. They have multiple unit masks
each which were leveraged for improved masked events testing.
v2 -> v3
- Reworked and documented the invert flag usage. It was possible to
get ambiguous results when using it. That should not be possible
now.
- Added testing for inverted masked events to validate the updated
implementation.
- Removed testing for inverted masked events from the masked events test.
They were meaningless with the updated implementation. More meaning
tests were added separately.
v1 -> v2
- Made has_invalid_event() static to fix warning.
- Fixed checkpatch.pl errors and warnings.
- Updated to account for KVM_X86_PMU_OP().
Aaron Lewis (7):
kvm: x86/pmu: Correct the mask used in a pmu event filter lookup
kvm: x86/pmu: Remove invalid raw events from the pmu event filter
kvm: x86/pmu: prepare the pmu event filter for masked events
kvm: x86/pmu: Introduce masked events to the pmu event filter
selftests: kvm/x86: Add flags when creating a pmu event filter
selftests: kvm/x86: Add testing for KVM_SET_PMU_EVENT_FILTER
selftests: kvm/x86: Test masked events
Documentation/virt/kvm/api.rst | 81 +++-
arch/x86/include/asm/kvm-x86-pmu-ops.h | 1 +
arch/x86/include/uapi/asm/kvm.h | 28 ++
arch/x86/kvm/pmu.c | 262 ++++++++++--
arch/x86/kvm/pmu.h | 39 ++
arch/x86/kvm/svm/pmu.c | 6 +
arch/x86/kvm/vmx/pmu_intel.c | 6 +
arch/x86/kvm/x86.c | 1 +
include/uapi/linux/kvm.h | 1 +
.../kvm/x86_64/pmu_event_filter_test.c | 374 +++++++++++++++++-
10 files changed, 756 insertions(+), 43 deletions(-)
--
2.37.2.672.g94769d06f0-goog
next reply other threads:[~2022-08-31 16:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 16:21 Aaron Lewis [this message]
2022-08-31 16:21 ` [PATCH v4 1/7] kvm: x86/pmu: Correct the mask used in a pmu event filter lookup Aaron Lewis
2022-09-14 18:15 ` Jim Mattson
2022-08-31 16:21 ` [PATCH v4 2/7] kvm: x86/pmu: Remove invalid raw events from the pmu event filter Aaron Lewis
2022-09-14 18:17 ` Jim Mattson
2022-08-31 16:21 ` [PATCH v4 3/7] kvm: x86/pmu: prepare the pmu event filter for masked events Aaron Lewis
2022-09-14 18:25 ` Jim Mattson
2022-08-31 16:21 ` [PATCH v4 4/7] kvm: x86/pmu: Introduce masked events to the pmu event filter Aaron Lewis
2022-09-14 18:45 ` Jim Mattson
2022-08-31 16:21 ` [PATCH v4 5/7] selftests: kvm/x86: Add flags when creating a " Aaron Lewis
2022-09-14 18:47 ` Jim Mattson
2022-08-31 16:21 ` [PATCH v4 6/7] selftests: kvm/x86: Add testing for KVM_SET_PMU_EVENT_FILTER Aaron Lewis
2022-09-14 19:00 ` Jim Mattson
2022-08-31 16:21 ` [PATCH v4 7/7] selftests: kvm/x86: Test masked events Aaron Lewis
2022-09-14 20:12 ` Jim Mattson
2022-09-20 15:24 ` Aaron Lewis
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=20220831162124.947028-1-aaronlewis@google.com \
--to=aaronlewis@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).