From nobody Tue Jun 30 23:30:08 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7190CC433EF for ; Thu, 6 Jan 2022 08:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237171AbiAFIzx (ORCPT ); Thu, 6 Jan 2022 03:55:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237035AbiAFIzp (ORCPT ); Thu, 6 Jan 2022 03:55:45 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ADEBC061245; Thu, 6 Jan 2022 00:55:44 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id l10-20020a17090a384a00b001b22190e075so7687638pjf.3; Thu, 06 Jan 2022 00:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=l6AC26P5A6p2PYSNfsM3OeICvH034ha9iztPzeXC2KE=; b=junyQPmsGv9qRZxRZ14fSV/UV4SkPFjzw7Fs9NYBI+iy840C6htKqDWzf2O3SbWfqS qI7L4ptVuEqZgWWQ0dvgHVb58GV8PEZRp2CyMNF8CZLnebbiTsJ+UYrrCET8/tHAgBDs aOvCInDbC/0lz7byrD2TviMaQjiN5RVdq8vl3miTncRc78KF+xZQ0pqtdXxpnkP+SX9T vdxnwE1RujxY9215qw14Hw183AZdRJ6acsY3UVI9XNYwa4w3Y1LD6JizFhc/K8iBwnF+ naP8FiLLMHZz+WykYjVkzfLsYPcMtdQ9IvAs/v8Zkx24Cz5jlYdTHLhlnItga/HfPxct uX7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=l6AC26P5A6p2PYSNfsM3OeICvH034ha9iztPzeXC2KE=; b=qdGjTRI8z4ar57W0WZtCJhoDXHtkAk+nQUwBJQ+TjQ/7D0+J5auRQn0HO+1p43jYxp KsP76gtqCg0NiY+jQz2cduMvgxNuvWLuW9gJGTcSJvU/0wSpLQkz8a1rOAszUmY/envH t+1AB84j42RUD16gFKda5NeK7a6IYbttyCEoNmF5nZaddCpGJJOpmt0kvnUPCqt+cuDf FxPXNJnKErBc8lgdWeI97RlTE0TRamKlNZp7pv46MTQv1Wg4+GiH/tidO+btNYBtsZvM SOB0aBCmzNEx3YdMs/rT+qPpiw2dZ87eFfT8qf3aK0Cq5OU9VDQmQEoETbthbl8c6lBk /ibw== X-Gm-Message-State: AOAM533WqcFUF+prg2HiFbT4mEQ7brqdOMFFcK2rdLNuW4dFslgI/dzs wBTJESWeAHl3CBShKBA1Qn4= X-Google-Smtp-Source: ABdhPJwN4aeg1Mq4mkU4DhpPUKCXV/JpNiHzTkbXWDemFa2C0X1MHLfcbqbsYqlZWCjugX8dbXVSZw== X-Received: by 2002:a17:903:32c9:b0:149:7d71:c235 with SMTP id i9-20020a17090332c900b001497d71c235mr47235609plr.58.1641459344086; Thu, 06 Jan 2022 00:55:44 -0800 (PST) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id d14sm1594223pfl.132.2022.01.06.00.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 00:55:43 -0800 (PST) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Jim Mattson , Wanpeng Li , Vitaly Kuznetsov , Joerg Roedel , Thomas Gleixner , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: x86/pt: Do not advertise Intel PT Event Trace capability Date: Thu, 6 Jan 2022 16:55:33 +0800 Message-Id: <20220106085533.84356-1-likexu@tencent.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Like Xu 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 --- Off topic, other new PT features such as "PSB and PMI Preservation Supporte= d" and "TNT disable" are under investigation or awaiting host support to move = on. 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_arra= y *array, u32 function) break; } =20 + /* Not advertise Event Trace capability due to endless emulation */ + entry->ebx &=3D ~BIT(7); for (i =3D 1, max_idx =3D entry->eax; i <=3D max_idx; ++i) { if (!do_host_cpuid(array, function, i)) goto out; --=20 2.33.1