linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: Sean Christopherson <seanjc@google.com>,
	Jim Mattson <jmattson@google.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Joerg Roedel <joro@8bytes.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86/pt: Do not advertise Intel PT Event Trace capability
Date: Fri, 7 Jan 2022 19:18:07 +0100	[thread overview]
Message-ID: <88aad2b3-8f60-fda4-15fb-81ea712c1dae@redhat.com> (raw)
In-Reply-To: <20220106085533.84356-1-likexu@tencent.com>

On 1/6/22 09:55, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> The Inte PT Event Trace capability (Intel SDM Vol3, 32.2.4 Event Tracing)
> is a new CPU feature that "exposes details about the asynchronous events,
> when they are generated, and when their corresponding software event
> handler completes execution".
> 
> It is not possible for KVM to emulate all events including interrupts,
> VM exits, VM entries, INIT, SIPI events and etc. for guests and to
> emulate the simultaneous writing of Control Flow Events and Event Data
> packets generated by the KVM to the guest PT buffer.
> 
> For KVM, it is best not to advertise the Event Trace feature and just
> let it be a system-wide-only tracing capability.
> 
> Signed-off-by: Like Xu <likexu@tencent.com>
> ---
> Off topic, other new PT features such as "PSB and PMI Preservation Supported"
> and "TNT disable" are under investigation or awaiting host support to move on.

Yeah, I think it's better to be safe and ignore _all_ unknown capabilities.

Paolo

>   arch/x86/kvm/cpuid.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 0b920e12bb6d..1028c57377e9 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -901,6 +901,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
>   			break;
>   		}
>   
> +		/* Not advertise Event Trace capability due to endless emulation */
> +		entry->ebx &= ~BIT(7);
>   		for (i = 1, max_idx = entry->eax; i <= max_idx; ++i) {
>   			if (!do_host_cpuid(array, function, i))
>   				goto out;


      reply	other threads:[~2022-01-07 18:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  8:55 [PATCH] KVM: x86/pt: Do not advertise Intel PT Event Trace capability Like Xu
2022-01-07 18:18 ` Paolo Bonzini [this message]

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=88aad2b3-8f60-fda4-15fb-81ea712c1dae@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).