All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lewis <aaronlewis@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, seanjc@google.com
Subject: Re: [PATCH v2 1/4] kvm: x86/pmu: Introduce masked events to the pmu event filter
Date: Wed, 6 Jul 2022 16:11:29 +0000	[thread overview]
Message-ID: <CAAAPnDHFMdxpsP6TJywQWoMtOudYpc4Z3+pNq7OJA6223L0mcg@mail.gmail.com> (raw)
In-Reply-To: <CALMp9eT3U+kLJTJJ_QP66LQPTQywVTuxucx=7JU74Xb7=xeY0g@mail.gmail.com>

> > +In this mode each event in the events field will be encoded with mask, match,
> > +and invert values in addition to an eventsel.  These encoded events will be
> > +matched against the event the guest is attempting to program to determine
> > +whether the guest should have access to it.  When matching an encoded event
> > +with a guest event these steps are followed:
> > + 1. Match the encoded eventsel to the guest eventsel.
> > + 2. If that matches, match the mask and match values from the encoded event to
> > +    the guest's unit mask (ie: unit_mask & mask == match).
> > + 3. If that matches, the guest is allow to program the event if its an allow
> > +    list or the guest is not allow to program the event if its a deny list.
> > + 4. If the invert value is set in the encoded event, reverse the meaning of #3
> > +    (ie: deny if its an allow list, allow if it's a deny list).
>
> The invert flag introduces some ambiguity. What if a particular event
> matches two of the masked filter entries: one with an invert flag and
> one without?
>

That's a good point!  I think I can deal with that by validating the
events when they are being set to ensure that for a particular event
the invert flags are all set the same way and return EINVAL if they're
not.

  reply	other threads:[~2022-07-06 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 17:52 [PATCH v2 0/4] kvm: x86/pmu: Introduce and test masked events Aaron Lewis
2022-06-06 17:52 ` [PATCH v2 1/4] kvm: x86/pmu: Introduce masked events to the pmu event filter Aaron Lewis
2022-07-01 23:43   ` Jim Mattson
2022-07-06 16:11     ` Aaron Lewis [this message]
2022-07-06 17:23       ` Jim Mattson
2022-07-09  1:15         ` Aaron Lewis
2022-07-04  6:36   ` kernel test robot
2022-06-06 17:52 ` [PATCH v2 2/4] selftests: kvm/x86: Add flags when creating a " Aaron Lewis
2022-06-06 17:52 ` [PATCH v2 3/4] selftests: kvm/x86: Add testing for masked events Aaron Lewis
2022-06-06 17:52 ` [PATCH v2 4/4] selftests: kvm/x86: Add testing for KVM_SET_PMU_EVENT_FILTER 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=CAAAPnDHFMdxpsP6TJywQWoMtOudYpc4Z3+pNq7OJA6223L0mcg@mail.gmail.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 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.