Message ID | 20221109082802.27543-2-likexu@tencent.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp216643wru; Wed, 9 Nov 2022 00:31:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM5Fh4waLMLCKh7FH/l2yIcoUQA5m1sNI0L/MXbn4z7FLtiQ2vzjJjlZCUoJ8SA8k5pA1Gli X-Received: by 2002:a17:907:a808:b0:7ad:caf4:9e92 with SMTP id vo8-20020a170907a80800b007adcaf49e92mr1066855ejc.510.1667982671490; Wed, 09 Nov 2022 00:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667982671; cv=none; d=google.com; s=arc-20160816; b=v2LljsMhmy4sNYSykbMU+1x5DMp5PR+q1BfBan4MxM9lFy/GKu40WPUfIST9xlp8Vg p5ZAIb9tF48Fvq87jYM81prEfDsmFBZnBHsjG9U6BS5X3Att60prAHL2f4u0NzkbRYZc kk+nw38T5pH3TRurPYQKeLr5q2FsZDj7udmpUf2Ny5lhk8LXpTGKZanrJS+qWdUHNsm9 5wAb3fBwzz2npsMFIz8pVZuQaBXWsaY4R8kSD3lJ7AbXxg+Wg6/Q0QM5QiHmDbWwWcdk RWtJvI/HA4tbL56D6KGsF/AGArMWVCk5Tci1+JGPZf46hCvTW3amL0AmvGfL47I8wApL 4GRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a04oUGY9n3fJGrXo8icImVtwc+ewjypnXhaaNSDY1GQ=; b=zijuLj8fjwR2MzCzOf9KwDs3W2LwXZO6HCEIVJYUobTdfGLiY8NPBp08gvm3fUZohL LNu13sFMU9EL668a5FBFse47kSkn6NOg6Kkh0VAsuUhDKNKLlXkzbBg5OTwjfxCbqppt J/IzH5p6eGraBYXqPOHWl9FUf0BVa68zxVheL802nXPPIhlv4yWc8C7NCdlHaKZCfLh9 CR9g506/Fl8wyeBhai8n648/SjoZVwmNtU4XHMhOJ4RMpuZlMKuvDs5cYSiAQ7OSi+vv UhFtGwPNf7Bt9I6SXNhAoDhyBM8PGh1poJc2dgwtQZNtCpHDIs6qp6qyer3tSChAJziD apUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K+P7tZlf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd31-20020a170907969f00b0078266dc4b8csi18663769ejc.719.2022.11.09.00.30.47; Wed, 09 Nov 2022 00:31:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K+P7tZlf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbiKII3F (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 9 Nov 2022 03:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbiKII2j (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 9 Nov 2022 03:28:39 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A6AFFED; Wed, 9 Nov 2022 00:28:23 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id m6so16087377pfb.0; Wed, 09 Nov 2022 00:28:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a04oUGY9n3fJGrXo8icImVtwc+ewjypnXhaaNSDY1GQ=; b=K+P7tZlfLXA88kzJjIIjZZPjUJaBHbJmrzVN6PYRfi1Oa6oMruscZ3MQ8qCz2hQg0E ML3j/csqsCnwbY8AJpY0g/t9XkiTZbL7pvFRmXrzHM0k2miDCOk/m++Jm9usTJAgOVqC BvyHk5STlaPWgpWPglqWGrIrH4C8GzHonSRQT8yeMs7tx4XYislMnOSSd8+sZETkI4io cGtTmNt+9NNhvaITYBOPXYAKq4efcw1YFlAOTWJRjS43Wu7fWhbazjR2j6+J4+RG71EY BBeVo6He1aShlfX9OjrTNRVkCTBhjfO/ueCvE+OHNUpXX4YOELeZvIXlYJ998QHCWH80 X+WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a04oUGY9n3fJGrXo8icImVtwc+ewjypnXhaaNSDY1GQ=; b=pDFIzOlghFrMxUt516ISdIpMHqkLd2soNhXrmXjY26CO/z3huq5zZvLME87LrYQCkx lEh1Uy5WONSFMbaqG0Rr3S3FAKKSCBUgnSQn5UY8AYvTv76hhlC7dKPj42vCvgjjRTCU Nc0IzrPVKAO7XHhoGIJHXJkEtj2FO5Fcp+s/IjiwN/MPfBNC6lFl2MxgP/UuBJsMlvto yUwtmiGGaYP0X0r67Ad1OzKOrB1W84mrPROH1KeMd4aa75WQowlU9JUsr4ARASKgasIE Nm9g984eGdB7tnUFZVOechGSXxxhu2yWn5kd63UGTXZ/IDJCf11fr1IIvZQTTdo78nG5 dvyQ== X-Gm-Message-State: ACrzQf3zZfhFJgB1W+Va0L/iaUHsgy57AakfiQ8m/MiwYnxdvcQuISWj X1WaQ0dlgI8feqQikS5PCjY= X-Received: by 2002:a63:1f13:0:b0:455:80ce:6d36 with SMTP id f19-20020a631f13000000b0045580ce6d36mr52181566pgf.111.1667982502775; Wed, 09 Nov 2022 00:28:22 -0800 (PST) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id b14-20020a63d30e000000b00470537b9b0asm6587700pgg.51.2022.11.09.00.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 00:28:22 -0800 (PST) From: Like Xu <like.xu.linux@gmail.com> X-Google-Original-From: Like Xu <likexu@tencent.com> To: Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH v3 1/3] KVM: x86/pmu: Disable guest PEBS on hybird cpu due to heterogeneity Date: Wed, 9 Nov 2022 16:28:00 +0800 Message-Id: <20221109082802.27543-2-likexu@tencent.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221109082802.27543-1-likexu@tencent.com> References: <20221109082802.27543-1-likexu@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749006597828425948?= X-GMAIL-MSGID: =?utf-8?q?1749006597828425948?= |
Series |
KVM: x86/pmu: Enable guest PEBS for SPR and later models
|
|
Commit Message
Like Xu
Nov. 9, 2022, 8:28 a.m. UTC
From: Like Xu <likexu@tencent.com> From vPMU enabling perspective, KVM does not have proper support for hybird x86 core. The reported perf_capabilities value (e.g. the format of pebs record) depends on the type of cpu the kvm-intel module is init. When a vcpu of one pebs format migrates to a vcpu of another pebs format, the incorrect parsing of pebs records by guest can make profiling data analysis extremely problematic. The safe way to fix this is to disable this part of the support until the guest recognizes that it is running on the hybird cpu, which is appropriate at the moment given that x86 hybrid architectures are not heavily touted in the data center market. Signed-off-by: Like Xu <likexu@tencent.com> --- arch/x86/kvm/vmx/capabilities.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On 25/11/2022 6:18 pm, Kunkun Jiang wrote: > Hi Like, > > There is a question I would like to ask. As far as I know, Alder Lake uses > a hybrid architecture and the kernel presents two types of PMUs.Can the > events created on the VCPU still count normally if the VCPU thread gets > migrate across different CPUs? The best answer is the test results as no one sponsored me a hybrid x86 box. According to my understanding, when a performance event (e.g. instructions) is supported on both types of pmu (even with different event codes), perf_event will remain enabled after the cpu migration (just changing the per-cpu context based on migrated pmu, and allocating another available hardware counter). Otherwise, the kernel will or should create and enable the perf_event based on current pmu type and disable the event of the previous cpu type. For the guest, KVM will or should recognize the migrated pmu type and enable the currently available perf_event for guest vPMC. But on hybrid x86, pmu capabilities are heterogeneous (even though the ISA is the same), and incompatible migrations can result in previous pmu capabilities (such as PEBS in this case) not being implemented on the new pmu, which breaks the expectation of the guest pmu driver. Making the guest aware of the differences in pmu types requires more fundamental KVM changes (for example, presenting multiple types of cpu model for the guest), and perhaps the simple and safe approach is to provide the guest with only the capabilities that are available to both pmu types. If things don't happen the way you expect them to, work it out w/ or w/o my help. > > As far as I know, ARM64 big.LITTLE is not working properly, according to > this set of patches. > [PATCH v4 0/6] KVM: arm64: Improve PMU support on heterogeneous systems > https://lore.kernel.org/all/20220127161759.53553-1-alexandru.elisei@arm.com/ The arm64 will have more cpu types (especially in terms of power management), but the difference in pmu capabilities will also depend on the design of IP vendors. > > Thanks, > Kunkun Jiang > > On 2022/11/9 16:28, Like Xu wrote: >> From: Like Xu <likexu@tencent.com> >> >> >From vPMU enabling perspective, KVM does not have proper support for >> hybird x86 core. The reported perf_capabilities value (e.g. the format >> of pebs record) depends on the type of cpu the kvm-intel module is init. >> When a vcpu of one pebs format migrates to a vcpu of another pebs format, >> the incorrect parsing of pebs records by guest can make profiling data >> analysis extremely problematic. >> >> The safe way to fix this is to disable this part of the support until the >> guest recognizes that it is running on the hybird cpu, which is appropriate >> at the moment given that x86 hybrid architectures are not heavily touted >> in the data center market. >> >> Signed-off-by: Like Xu <likexu@tencent.com> >> --- >> arch/x86/kvm/vmx/capabilities.h | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h >> index cd2ac9536c99..ea0498684048 100644 >> --- a/arch/x86/kvm/vmx/capabilities.h >> +++ b/arch/x86/kvm/vmx/capabilities.h >> @@ -392,7 +392,9 @@ static inline bool vmx_pt_mode_is_host_guest(void) >> static inline bool vmx_pebs_supported(void) >> { >> - return boot_cpu_has(X86_FEATURE_PEBS) && kvm_pmu_cap.pebs_ept; >> + return boot_cpu_has(X86_FEATURE_PEBS) && >> + !boot_cpu_has(X86_FEATURE_HYBRID_CPU) && >> + kvm_pmu_cap.pebs_ept; >> } >> static inline bool cpu_has_notify_vmexit(void)
On Wed, Nov 09, 2022, Like Xu wrote: > From: Like Xu <likexu@tencent.com> > > From vPMU enabling perspective, KVM does not have proper support for > hybird x86 core. The reported perf_capabilities value (e.g. the format > of pebs record) depends on the type of cpu the kvm-intel module is init. > When a vcpu of one pebs format migrates to a vcpu of another pebs format, > the incorrect parsing of pebs records by guest can make profiling data > analysis extremely problematic. > > The safe way to fix this is to disable this part of the support until the > guest recognizes that it is running on the hybird cpu, which is appropriate > at the moment given that x86 hybrid architectures are not heavily touted > in the data center market. > > Signed-off-by: Like Xu <likexu@tencent.com> > --- > arch/x86/kvm/vmx/capabilities.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h > index cd2ac9536c99..ea0498684048 100644 > --- a/arch/x86/kvm/vmx/capabilities.h > +++ b/arch/x86/kvm/vmx/capabilities.h > @@ -392,7 +392,9 @@ static inline bool vmx_pt_mode_is_host_guest(void) > > static inline bool vmx_pebs_supported(void) > { > - return boot_cpu_has(X86_FEATURE_PEBS) && kvm_pmu_cap.pebs_ept; > + return boot_cpu_has(X86_FEATURE_PEBS) && > + !boot_cpu_has(X86_FEATURE_HYBRID_CPU) && > + kvm_pmu_cap.pebs_ept; I assume the patch I just posted[*] to disable the vPMU entirely is sufficient, or do we need this as well in order to hide X86_FEATURE_DS and X86_FEATURE_DTES64? [*] https://lore.kernel.org/all/20230120004051.2043777-1-seanjc@google.com
On 20/1/2023 8:47 am, Sean Christopherson wrote: > On Wed, Nov 09, 2022, Like Xu wrote: >> From: Like Xu <likexu@tencent.com> >> >> From vPMU enabling perspective, KVM does not have proper support for >> hybird x86 core. The reported perf_capabilities value (e.g. the format >> of pebs record) depends on the type of cpu the kvm-intel module is init. >> When a vcpu of one pebs format migrates to a vcpu of another pebs format, >> the incorrect parsing of pebs records by guest can make profiling data >> analysis extremely problematic. >> >> The safe way to fix this is to disable this part of the support until the >> guest recognizes that it is running on the hybird cpu, which is appropriate >> at the moment given that x86 hybrid architectures are not heavily touted >> in the data center market. >> >> Signed-off-by: Like Xu <likexu@tencent.com> >> --- >> arch/x86/kvm/vmx/capabilities.h | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h >> index cd2ac9536c99..ea0498684048 100644 >> --- a/arch/x86/kvm/vmx/capabilities.h >> +++ b/arch/x86/kvm/vmx/capabilities.h >> @@ -392,7 +392,9 @@ static inline bool vmx_pt_mode_is_host_guest(void) >> >> static inline bool vmx_pebs_supported(void) >> { >> - return boot_cpu_has(X86_FEATURE_PEBS) && kvm_pmu_cap.pebs_ept; >> + return boot_cpu_has(X86_FEATURE_PEBS) && >> + !boot_cpu_has(X86_FEATURE_HYBRID_CPU) && >> + kvm_pmu_cap.pebs_ept; > > I assume the patch I just posted[*] to disable the vPMU entirely is sufficient, or AFAI, some developers doing client-side virtualization on a hybrid cpu will specifically want vPMU, in which case it makes perfect sense for KVM to expose common pmu capabilities (not PEBS at the current) of big and little cores, such as the most basic performance counter. > do we need this as well in order to hide X86_FEATURE_DS and X86_FEATURE_DTES64? I think we still need this diff. Better to prioritize this minor feature a little bit for hungry users. > > [*] https://lore.kernel.org/all/20230120004051.2043777-1-seanjc@google.com
On Mon, Jan 30, 2023, Like Xu wrote: > On 20/1/2023 8:47 am, Sean Christopherson wrote: > > On Wed, Nov 09, 2022, Like Xu wrote: > > > From: Like Xu <likexu@tencent.com> > > > > > > From vPMU enabling perspective, KVM does not have proper support for > > > hybird x86 core. The reported perf_capabilities value (e.g. the format > > > of pebs record) depends on the type of cpu the kvm-intel module is init. > > > When a vcpu of one pebs format migrates to a vcpu of another pebs format, > > > the incorrect parsing of pebs records by guest can make profiling data > > > analysis extremely problematic. > > > > > > The safe way to fix this is to disable this part of the support until the > > > guest recognizes that it is running on the hybird cpu, which is appropriate > > > at the moment given that x86 hybrid architectures are not heavily touted > > > in the data center market. > > > > > > Signed-off-by: Like Xu <likexu@tencent.com> > > > --- > > > arch/x86/kvm/vmx/capabilities.h | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h > > > index cd2ac9536c99..ea0498684048 100644 > > > --- a/arch/x86/kvm/vmx/capabilities.h > > > +++ b/arch/x86/kvm/vmx/capabilities.h > > > @@ -392,7 +392,9 @@ static inline bool vmx_pt_mode_is_host_guest(void) > > > static inline bool vmx_pebs_supported(void) > > > { > > > - return boot_cpu_has(X86_FEATURE_PEBS) && kvm_pmu_cap.pebs_ept; > > > + return boot_cpu_has(X86_FEATURE_PEBS) && > > > + !boot_cpu_has(X86_FEATURE_HYBRID_CPU) && > > > + kvm_pmu_cap.pebs_ept; > > > > I assume the patch I just posted[*] to disable the vPMU entirely is sufficient, or > > AFAI, some developers doing client-side virtualization on a hybrid cpu will > specifically want vPMU, > in which case it makes perfect sense for KVM to expose common pmu > capabilities (not PEBS at the current) of big and little cores, such as the > most basic performance counter. > > > do we need this as well in order to hide X86_FEATURE_DS and X86_FEATURE_DTES64? > > I think we still need this diff. Better to prioritize this minor feature a > little bit for hungry users. That wasn't my question. My question was whether or not wholesale disabling vPMU is sufficient to prevent issues with PEBS. Unless we need this patch on top of disabling the vPMU, my strong preference is to disable vPMU, or at the very least make it off-by-default and require a explicit override. I agree that there are users that want to enable vPMU for hybrid CPUs, but as stated in the link below, that needs to be a dedicated enabling effort. I don't see any reason to exempt PEBS from that. E.g. isn't PEBS usable if userspace pins vCPUs to pCPUs and enumerates an accurate topology to the guest? > > [*] https://lore.kernel.org/all/20230120004051.2043777-1-seanjc@google.com
On 31/1/2023 1:40 am, Sean Christopherson wrote: > On Mon, Jan 30, 2023, Like Xu wrote: >> On 20/1/2023 8:47 am, Sean Christopherson wrote: >>> On Wed, Nov 09, 2022, Like Xu wrote: >>>> From: Like Xu <likexu@tencent.com> >>>> >>>> From vPMU enabling perspective, KVM does not have proper support for >>>> hybird x86 core. The reported perf_capabilities value (e.g. the format >>>> of pebs record) depends on the type of cpu the kvm-intel module is init. >>>> When a vcpu of one pebs format migrates to a vcpu of another pebs format, >>>> the incorrect parsing of pebs records by guest can make profiling data >>>> analysis extremely problematic. >>>> >>>> The safe way to fix this is to disable this part of the support until the >>>> guest recognizes that it is running on the hybird cpu, which is appropriate >>>> at the moment given that x86 hybrid architectures are not heavily touted >>>> in the data center market. >>>> >>>> Signed-off-by: Like Xu <likexu@tencent.com> >>>> --- >>>> arch/x86/kvm/vmx/capabilities.h | 4 +++- >>>> 1 file changed, 3 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h >>>> index cd2ac9536c99..ea0498684048 100644 >>>> --- a/arch/x86/kvm/vmx/capabilities.h >>>> +++ b/arch/x86/kvm/vmx/capabilities.h >>>> @@ -392,7 +392,9 @@ static inline bool vmx_pt_mode_is_host_guest(void) >>>> static inline bool vmx_pebs_supported(void) >>>> { >>>> - return boot_cpu_has(X86_FEATURE_PEBS) && kvm_pmu_cap.pebs_ept; >>>> + return boot_cpu_has(X86_FEATURE_PEBS) && >>>> + !boot_cpu_has(X86_FEATURE_HYBRID_CPU) && >>>> + kvm_pmu_cap.pebs_ept; >>> >>> I assume the patch I just posted[*] to disable the vPMU entirely is sufficient, or >> >> AFAI, some developers doing client-side virtualization on a hybrid cpu will >> specifically want vPMU, >> in which case it makes perfect sense for KVM to expose common pmu >> capabilities (not PEBS at the current) of big and little cores, such as the >> most basic performance counter. >> >>> do we need this as well in order to hide X86_FEATURE_DS and X86_FEATURE_DTES64? >> >> I think we still need this diff. Better to prioritize this minor feature a >> little bit for hungry users. > > That wasn't my question. My question was whether or not wholesale disabling vPMU > is sufficient to prevent issues with PEBS. Unless we need this patch on top of > disabling the vPMU, my strong preference is to disable vPMU, or at the very least > make it off-by-default and require a explicit override. OK and if so, just set global module parameter "enable_pmu=false" for HYBRID_CPU. With "disable vPMU" diff, this patch should be dropped since kvm_pmu_cap.pebs_ept = 0. > > I agree that there are users that want to enable vPMU for hybrid CPUs, but as > stated in the link below, that needs to be a dedicated enabling effort. I don't > see any reason to exempt PEBS from that. E.g. isn't PEBS usable if userspace pins > vCPUs to pCPUs and enumerates an accurate topology to the guest? So for HYBRID_CPU, {pebs, lbr, basic PMU} would be disabled globally by KVM until a dedicated effort enables them one by one in the near future. Follow up with a rewritten diff, 20230131085031.88939-1-likexu@tencent.com > >>> [*] https://lore.kernel.org/all/20230120004051.2043777-1-seanjc@google.com
diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h index cd2ac9536c99..ea0498684048 100644 --- a/arch/x86/kvm/vmx/capabilities.h +++ b/arch/x86/kvm/vmx/capabilities.h @@ -392,7 +392,9 @@ static inline bool vmx_pt_mode_is_host_guest(void) static inline bool vmx_pebs_supported(void) { - return boot_cpu_has(X86_FEATURE_PEBS) && kvm_pmu_cap.pebs_ept; + return boot_cpu_has(X86_FEATURE_PEBS) && + !boot_cpu_has(X86_FEATURE_HYBRID_CPU) && + kvm_pmu_cap.pebs_ept; } static inline bool cpu_has_notify_vmexit(void)