mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Dave Hansen <dave.hansen@linux.intel.com>,
	Robert Richter <rric@kernel.org>
Cc: linux-kernel@vger.kernel.org, jgross@suse.com,
	tglx@linutronix.de, x86@kernel.org
Subject: Re: [PATCH 2/4] perf/x86/ibs: Use CPUID region helper
Date: Tue, 16 Apr 2024 17:12:42 +0200	[thread overview]
Message-ID: <20240416151242.GGZh6VaiO2gC4ej2BT@fat_crate.local> (raw)
In-Reply-To: <20240403153511.75CB9DA0@davehans-spike.ostc.intel.com>

On Wed, Apr 03, 2024 at 08:35:11AM -0700, Dave Hansen wrote:
> 
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> IBS details are enumerated in an extended CPUID leaf.  But
> the support has an open-coded CPUID region check.  Use the
> new helper to trim down the code.
> 
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> --
> 
> Note: this cleanup could take another form:
> 
>         if (boot_cpu_data->extended_cpuid_level >= IBS_CPUID_FEATURES)
>                 caps = cpuid_eax(IBS_CPUID_FEATURES);
> 
> that would be one fewer CPUID invocations, but one more
> line of code.
> ---
> 
>  b/arch/x86/events/amd/ibs.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff -puN arch/x86/events/amd/ibs.c~ibs-region-helpers arch/x86/events/amd/ibs.c
> --- a/arch/x86/events/amd/ibs.c~ibs-region-helpers	2024-04-02 15:22:59.262912595 -0700
> +++ b/arch/x86/events/amd/ibs.c	2024-04-02 15:22:59.262912595 -0700
> @@ -1278,18 +1278,13 @@ static __init int perf_event_ibs_init(vo
>  
>  static __init u32 __get_ibs_caps(void)
>  {
> -	u32 caps;
> -	unsigned int max_level;
> +	u32 caps = 0;
>  
>  	if (!boot_cpu_has(X86_FEATURE_IBS))
>  		return 0;
>  
> -	/* check IBS cpuid feature flags */
> -	max_level = cpuid_eax(0x80000000);
> -	if (max_level < IBS_CPUID_FEATURES)
> -		return IBS_CAPS_DEFAULT;
> +	get_cpuid_region_leaf(IBS_CPUID_FEATURES, CPUID_EAX, &caps);

I wanna say all this checking of max level is worthless because if you
have X86_FEATURE_IBS, then it is a given that you also have that
0x8000001b CPUID leaf.

Right, Bob?

Unless there was some weird thing back then with the CPUID leafs...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2024-04-16 15:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 15:35 [PATCH 0/4] [v2] x86: Add CPUID region helper and clarify Xen startup Dave Hansen
2024-04-03 15:35 ` [PATCH 1/4] x86/cpu: Add and use new CPUID region helper Dave Hansen
2024-04-04  9:04   ` Jürgen Groß
2024-04-08 16:25     ` Borislav Petkov
2024-04-03 15:35 ` [PATCH 2/4] perf/x86/ibs: Use " Dave Hansen
2024-04-16 15:12   ` Borislav Petkov [this message]
2024-04-16 15:23     ` Dave Hansen
2024-04-16 17:48       ` Borislav Petkov
2024-04-18 12:05         ` Robert Richter
2024-04-22 17:20           ` Borislav Petkov
2024-04-22 20:09             ` Robert Richter
2024-04-22 20:41               ` Borislav Petkov
2024-04-22 21:30                 ` Robert Richter
2024-04-22 21:45                   ` Borislav Petkov
2024-04-23  7:45                     ` Robert Richter
2024-04-23  8:33                       ` Borislav Petkov
2024-04-03 15:35 ` [PATCH 3/4] x86/boot: Explicitly pass NX enabling status Dave Hansen
2024-04-04 10:33   ` Jürgen Groß
2024-04-03 15:35 ` [PATCH 4/4] x86/xen: Enumerate NX from CPUID directly Dave Hansen
2024-04-04 10:44   ` Jürgen Groß
2024-04-04 14:24     ` Dave Hansen
2024-04-04 15:05   ` Sean Christopherson
2024-04-22 17:44     ` Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2024-03-22 17:56 [PATCH 0/4] x86: Add CPUID region helper and clarify Xen startup Dave Hansen
2024-03-22 17:56 ` [PATCH 2/4] perf/x86/ibs: Use CPUID region helper Dave Hansen

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=20240416151242.GGZh6VaiO2gC4ej2BT@fat_crate.local \
    --to=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rric@kernel.org \
    --cc=tglx@linutronix.de \
    --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

Powered by JetHome