From: Paolo Bonzini <pbonzini@redhat.com>
To: "Kang, Luwei" <luwei.kang@intel.com>,
"Christopherson, Sean J" <sean.j.christopherson@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"vkuznets@redhat.com" <vkuznets@redhat.com>,
"wanpengli@tencent.com" <wanpengli@tencent.com>,
"jmattson@google.com" <jmattson@google.com>,
"joro@8bytes.org" <joro@8bytes.org>
Subject: Re: [PATCH] KVM: VMX: Disable Intel PT before VM-entry
Date: Thu, 16 Apr 2020 16:14:04 +0200 [thread overview]
Message-ID: <21fa3505-8198-5f32-9dfd-3c9d9cc5ef7e@redhat.com> (raw)
In-Reply-To: <82D7661F83C1A047AF7DC287873BF1E1738B1A1C@SHSMSX104.ccr.corp.intel.com>
On 31/03/20 05:29, Kang, Luwei wrote:
>> Ah, right. What about enhancing intel_pt_handle_vmx() and 'struct
>> pt' to replace vmx_on with a field that incorporates the KVM mode?
>
> Some history is the host perf didn't fully agree with introducing
> HOST_GUEST mode for PT in KVM.
I don't think this is accurate. IIRC the maintainers wanted packets in
the host-side trace to signal where the trace was interrupted. In the
end we solved the issue by 1) dropping host-only mode since it can be
achieved in userspace 2) making host-guest an opt in feature.
I think it would make sense to rename vmx_on into vmx_state and make it an
enum pt_vmx_state {
PT_VMX_OFF,
PT_VMX_ON_DISABLED,
PT_VMX_ON_SYSTEM,
PT_VMX_ON_HOST_GUEST
};
KVM would pass the enum to intel_pt_handle_vmx (one of PT_VMX_OFF,
PT_VMX_ON_SYSTEM, PT_VMX_ON_HOST_GUEST). Inside intel_pt_handle_vmx you
can do
if (pt_pmu.vmx) {
WRITE_ONCE(pt->vmx_state, state);
return;
}
local_irq_save(flags);
WRITE_ONCE(pt->vmx_state,
state == PT_VMX_OFF ? PT_VMX_OFF : PT_VMX_ON_DISABLED);
...
and in pt_config_start:
...
vmx = READ_ONCE(pt->vmx_start);
if (vmx == PT_VMX_ON_DISABLED)
perf_aux_output_flag(&pt->handle, PERF_AUX_FLAG_PARTIAL);
else if (vmx == PT_VMX_ON_SYSTEM ||
!(current->flags & PF_VCPU))
wrmsrl(MSR_IA32_RTIT_CTL, ctl);
...
Thanks,
Paolo
next prev parent reply other threads:[~2020-04-16 14:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 3:48 [PATCH] KVM: VMX: Disable Intel PT before VM-entry Luwei Kang
2020-03-18 15:48 ` Sean Christopherson
2020-03-19 6:13 ` Kang, Luwei
2020-03-23 9:20 ` Kang, Luwei
2020-03-30 17:21 ` Sean Christopherson
2020-03-31 3:29 ` Kang, Luwei
2020-04-09 18:34 ` Sean Christopherson
2020-04-16 14:14 ` Paolo Bonzini [this message]
2020-04-17 1:49 ` Kang, Luwei
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=21fa3505-8198-5f32-9dfd-3c9d9cc5ef7e@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luwei.kang@intel.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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