All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Sean Christopherson <seanjc@google.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: "Liang, Kan" <kan.liang@linux.intel.com>,
	acme@redhat.com, linux-kernel@vger.kernel.org,
	alexander.shishkin@linux.intel.com,
	Jianfeng Gao <jianfeng.gao@intel.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>
Subject: Re: [RESEND PATCH] perf/x86/intel: Fix unchecked MSR access error for Alder Lake N
Date: Mon, 22 Aug 2022 21:21:32 +0200	[thread overview]
Message-ID: <0362e4e8-ab27-735d-510e-1dc208ccd17f@linux.intel.com> (raw)
In-Reply-To: <YwPJJKxKI4vfQEVn@google.com>


>
> Checking X86_FEATURE_HYPERVISOR in the guest won't handle things like trying to
> run a non-hyrbid vCPU model on a hybrid CPU, because IIUC, the "is_hybrid()" is
> purely based on FMS, i.e. will be false if someone enumerates a big core vCPU on
> a hybrid CPU.
>
> So until KVM gets sane handling, shouldn't this be?
>
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index f969410d0c90..0a8accfc3018 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -2999,12 +2999,8 @@ void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
>          }
>
>          cap->version            = x86_pmu.version;
> -       /*
> -        * KVM doesn't support the hybrid PMU yet.
> -        * Return the common value in global x86_pmu,
> -        * which available for all cores.
> -        */
> -       cap->num_counters_gp    = x86_pmu.num_counters;
> +       /* KVM doesn't support the hybrid PMU yet. */
> +       cap->num_counters_gp    = is_hybrid() ? 0 : x86_pmu.num_counters;

That's just the PMU. Arguably if you don't handle hybrid affinity you 
shouldn't report the hybrid bit ever to the guest. So need more than that.

But I guess Peter is concerned about the case when an old KVM is the 
host.  I think a short term workaround for that is fine, but I don't 
think it's a good idea to completely disable it since that will break 
future setups with correct hybrid hypervisor too. We already probe the 
PMU MSRs, can't we detect this case there too?

-Andi


      reply	other threads:[~2022-08-22 19:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 18:15 [RESEND PATCH] perf/x86/intel: Fix unchecked MSR access error for Alder Lake N kan.liang
2022-08-19  8:05 ` Peter Zijlstra
2022-08-19  8:33   ` Peter Zijlstra
2022-08-22 13:24     ` Liang, Kan
2022-08-22 13:55       ` Peter Zijlstra
2022-08-22 15:20         ` Liang, Kan
2022-08-19 14:38 ` Peter Zijlstra
2022-08-22 13:28   ` Liang, Kan
2022-08-22 13:48     ` Peter Zijlstra
2022-08-22 14:31       ` Andi Kleen
2022-08-22 14:39     ` Peter Zijlstra
2022-08-22 14:51       ` Andrew Cooper
2022-08-22 14:59       ` Liang, Kan
2022-08-22 15:21         ` Peter Zijlstra
2022-08-22 15:08       ` Andi Kleen
2022-08-22 15:47         ` Peter Zijlstra
2022-08-22 18:21           ` Sean Christopherson
2022-08-22 19:21             ` Andi Kleen [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=0362e4e8-ab27-735d-510e-1dc208ccd17f@linux.intel.com \
    --to=ak@linux.intel.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jianfeng.gao@intel.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.