[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87zgt8hyr0.fsf@ashishki-desk.ger.corp.intel.com>
Date: Mon, 23 Aug 2021 20:11:47 +0300
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Jiri Olsa <jolsa@...nel.org>, kvm@...r.kernel.org,
Artem Kashkanov <artem.kashkanov@...el.com>,
alexander.shishkin@...ux.intel.com
Subject: Re: [PATCH] kvm/x86: Fix PT "host mode"
Sean Christopherson <seanjc@...gle.com> writes:
> On Mon, Aug 23, 2021, Alexander Shishkin wrote:
>
>> Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
>> Fixes: ff9d07a0e7ce7 ("KVM: Implement perf callbacks for guest sampling")
>
> This should be another clue that the fix isn't correct.
> That patch is from 2010,
Right, this should have been 8479e04e7d6b1 ("KVM: x86: Inject PMI for
KVM guest") instead.
> Intel PT was announced in 2013 and merged in 2019.
Technically, 2019 is when kvm started breaking host PT.
> This is not remotely correct. vmx.c's "pt_mode", which is queried via this path,
> is modified by hardware_setup(), a.k.a. kvm_x86_ops.hardware_setup(), which runs
> _after_ this code. And as alluded to above, these are generic perf callbacks,
> installing them if and only if Intel PT is enabled in a specific mode completely
> breaks "regular" perf.
I see your point, the callchain code will catch fire.
> I'll post a small series, there's a bit of code massage needed to fix this
> properly. The PMI handler can also be optimized to avoid a retpoline when PT is
> not exposed to the guest.
The actual PMU handler also needs to know that kvm won't be needing it
so it can call the regular PT handler.
One could unset cbs->handle_intel_pt_intr() or one could have it return
different things depending on whether it was actually taken in kvm. But
both are rather disgusting.
Regards,
--
Alex
Powered by blists - more mailing lists