All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"likexu@tencent.com" <likexu@tencent.com>,
	"Ma, XiangfeiX" <xiangfeix.ma@intel.com>
Subject: Re: [PATCH] i386: Disable BTS and PEBS
Date: Wed, 20 Jul 2022 15:48:29 +0000	[thread overview]
Message-ID: <Ytgjzfl4kq4G/4B7@google.com> (raw)
In-Reply-To: <MWHPR1101MB21109B9363739A573F6391DD928E9@MWHPR1101MB2110.namprd11.prod.outlook.com>

On Wed, Jul 20, 2022, Duan, Zhenzhong wrote:
> >On Tue, Jul 19, 2022, Paolo Bonzini wrote:
> >> On 7/18/22 22:12, Sean Christopherson wrote:
> >> > On Mon, Jul 18, 2022, Paolo Bonzini wrote:
> >> > > This needs to be fixed in the kernel because old QEMU/new KVM is supported.
> >> >
> >> > I can't object to adding a quirk for this since KVM is breaking userspace,
> >> > but on the KVM side we really need to stop "sanitizing" userspace inputs
> >> > unless it puts the host at risk, because inevitably it leads to needing
> >> > a quirk.
> >>
> >> The problem is not the sanitizing, it's that userspace literally
> >> cannot know that this needs to be done because the feature bits are
> >> "backwards" (1 = unavailable).
> >
> >Yes, the bits being inverted contributed to KVM not providing a way for
> >userspace to enumerate PEBS and BTS support, but lack of enumeration is a
> >seperate issue.
> >
> >If KVM had simply ignored invalid guest state from the get go, then
> >userspace would never have gained a dependency on KVM sanitizing guest
> >state.  The fact that KVM didn't enumerate support in any way is an
> >orthogonal problem.  To play nice with older userspace, KVM will need to
> >add a quirk to restore the sanizting code, but that doesn't solve the
> >enumeration issue.  And vice versa, solving the enuemaration problem
> >doesn't magically fix old userspace.
> Hi,
> 
> I didn't clearly understand the boundary of when to use quirk and when to fix
> it directly, appreciate your guide.  My previous understanding for quirk is
> about backward compatibility, old behavior vs. new behavior.  But this issue
> is more like a regression or bug, and the sanitizing code is only in kvm/next
> branch, not in kernel upstream yet, why bother to use a quirk?

Oh!  Yay!  You're absolutely right.  And now I understand why Paolo is saying the
problem has nothing to do with sanitizing...

I was thinking that KVM had been doing the sanitizing before the PEBS enabling,
but that bad behavior was introduced by bef6ecca46ac ("KVM: x86/pmu: Set
MSR_IA32_MISC_ENABLE_EMON bit when vPMU is enabled").

Sorry for the noise.


  reply	other threads:[~2022-07-20 15:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18  3:22 [PATCH] i386: Disable BTS and PEBS Zhenzhong Duan
2022-07-18  3:57 ` Like Xu
2022-07-18  7:44   ` Duan, Zhenzhong
2022-07-18 16:08 ` Paolo Bonzini
2022-07-18 20:12   ` Sean Christopherson
2022-07-19 18:18     ` Paolo Bonzini
2022-07-19 18:53       ` Sean Christopherson
2022-07-20  2:35         ` Duan, Zhenzhong
2022-07-20 15:48           ` Sean Christopherson [this message]
2022-07-21  2:42         ` Like Xu
2022-08-19  1:38       ` Duan, Zhenzhong

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=Ytgjzfl4kq4G/4B7@google.com \
    --to=seanjc@google.com \
    --cc=likexu@tencent.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiangfeix.ma@intel.com \
    --cc=zhenzhong.duan@intel.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.