All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Aaron Lewis <aaronlewis@google.com>
Cc: Like Xu <like.xu.linux@gmail.com>,
	pbonzini@redhat.com, jmattson@google.com, kvm@vger.kernel.org
Subject: Re: [PATCH v3 1/5] KVM: x86/pmu: Prevent the PMU from counting disallowed events
Date: Tue, 7 Mar 2023 08:01:24 -0800	[thread overview]
Message-ID: <ZAdfX+S323JVWNZC@google.com> (raw)
In-Reply-To: <CAAAPnDFuEhhv+3orZ0EGMq4kAm3_p335kRAMOf=ZcLi_pcnPKQ@mail.gmail.com>

On Tue, Mar 07, 2023, Aaron Lewis wrote:
> On Tue, Mar 7, 2023 at 7:19 AM Like Xu <like.xu.linux@gmail.com> wrote:
> > > ---
> > >   arch/x86/kvm/pmu.c | 13 ++++++++-----
> > >   1 file changed, 8 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
> > > index 612e6c70ce2e..9914a9027c60 100644
> > > --- a/arch/x86/kvm/pmu.c
> > > +++ b/arch/x86/kvm/pmu.c
> > > @@ -400,6 +400,12 @@ static bool check_pmu_event_filter(struct kvm_pmc *pmc)
> > >       return is_fixed_event_allowed(filter, pmc->idx);
> > >   }
> > >
> > > +static bool event_is_allowed(struct kvm_pmc *pmc)
> >
> > Nit, an inline event_is_allowed() here might be better.
> 
> I purposely didn't inline this because Sean generally discourages its
> use and has commented in several reviews to not use 'inline' and
> instead leave it up to the compiler to decide, unless using
> __always_inline.

Ya.

> I think the sentiment is either use the strong hint or don't use it at all.
> This seems like an example of where the compiler can decide, and a strong
> hint isn't needed.

Not quite.  __always_inline is not a hint, it's a command.  The kernel *requires*
functions tagged with __always_inline to be (surprise!) always inlined, even when
building with features that cause the compiler to generate non-inlined functions
for even the most trivial helpers, e.g. KASAN can cause a literal nop function to
be non-inlined.  __alway_inlined is used to ensure like no-instrumentation regions
and __init sections are preserved when invoking common helpers.

  reply	other threads:[~2023-03-07 16:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 14:13 [PATCH v3 0/5] Fix "Instructions Retired" from incorrectly counting Aaron Lewis
2023-03-07 14:13 ` [PATCH v3 1/5] KVM: x86/pmu: Prevent the PMU from counting disallowed events Aaron Lewis
2023-03-07 15:19   ` Like Xu
2023-03-07 15:52     ` Aaron Lewis
2023-03-07 16:01       ` Sean Christopherson [this message]
2023-03-08  2:45         ` Like Xu
2023-03-08 19:46           ` Sean Christopherson
2023-03-07 14:13 ` [PATCH v3 2/5] KVM: selftests: Add a common helper to the guest Aaron Lewis
2023-04-07 18:43   ` Sean Christopherson
2023-03-07 14:13 ` [PATCH v3 3/5] KVM: selftests: Add helpers for PMC asserts Aaron Lewis
2023-04-07 18:47   ` Sean Christopherson
2023-03-07 14:13 ` [PATCH v3 4/5] KVM: selftests: Fixup test asserts Aaron Lewis
2023-04-07 18:53   ` Sean Christopherson
2023-03-07 14:14 ` [PATCH v3 5/5] KVM: selftests: Test the PMU event "Instructions retired" Aaron Lewis
2023-04-07 20:17   ` Sean Christopherson
2023-04-07  9:06 ` [PATCH v3 0/5] Fix "Instructions Retired" from incorrectly counting Like Xu
2023-04-07 21:30 ` 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=ZAdfX+S323JVWNZC@google.com \
    --to=seanjc@google.com \
    --cc=aaronlewis@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --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.