public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com,
	kuo-lang.tseng@intel.com, mingo@redhat.com, babu.moger@amd.com,
	hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] x86/resctrl: Support CPUID enumeration of MBM counter width
Date: Mon, 4 May 2020 21:19:21 -0700	[thread overview]
Message-ID: <b357e1f6-bf92-ec50-73f2-bd5987b159fc@intel.com> (raw)
In-Reply-To: <20200504075632.GB15046@zn.tnic>

Hi Borislav,

On 5/4/2020 12:56 AM, Borislav Petkov wrote:
> Hi,
> 
> On Sun, May 03, 2020 at 11:51:00AM -0700, Reinette Chatre wrote:
>> I am struggling with what should follow ...
> 
> Since a diff is better than a thousand words :-) see below.
> 

Thank you so much for providing the details. Your explanation is clear
to me but I do have one clarification question ...


> @@ -597,6 +598,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
>  			x86_amd_ls_cfg_ssbd_mask = 1ULL << bit;
>  		}
>  	}
> +
> +	resctrl_cpu_detect(c);
>  }
>  

...

> @@ -322,6 +323,11 @@ static void early_init_intel(struct cpuinfo_x86 *c)
>  		detect_ht_early(c);
>  }
>  
> +static void bsp_init_intel(struct cpuinfo_x86 *c)
> +{
> +	resctrl_cpu_detect(c);
> +}
> +
>  #ifdef CONFIG_X86_32
>  /*
>   *	Early probe support logic for ppro memory erratum #50
> @@ -961,6 +967,7 @@ static const struct cpu_dev intel_cpu_dev = {
>  #endif
>  	.c_detect_tlb	= intel_detect_tlb,
>  	.c_early_init   = early_init_intel,
> +	.c_bsp_init	= bsp_init_intel,
>  	.c_init		= init_intel,
>  	.c_x86_vendor	= X86_VENDOR_INTEL,
>  };
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index d8cc5223b7ce..5e5955aa6593 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -22,7 +22,7 @@
>  #include <linux/cpuhotplug.h>
>  
>  #include <asm/intel-family.h>
> -#include <asm/resctrl_sched.h>
> +#include <asm/resctrl.h>
>  #include "internal.h"
>  
>  /* Mutex to protect rdtgroup access. */
> @@ -958,6 +958,35 @@ static __init void rdt_init_res_defs(void)
>  
>  static enum cpuhp_state rdt_online;
>  
> +/* Runs once on the BSP during boot. */
> +void resctrl_cpu_detect(struct cpuinfo_x86 *c)
> +{
> +	if (!cpu_has(c, X86_FEATURE_CQM_LLC)) {
> +		c->x86_cache_max_rmid  = -1;
> +		c->x86_cache_occ_scale = -1;
> +		c->x86_cache_mbm_width_offset = -1;
> +		return;
> +	}
> +
> +	/* will be overridden if occupancy monitoring exists */
> +	c->x86_cache_max_rmid = cpuid_ebx(0xf);
> +
> +	if (cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC) ||
> +	    cpu_has(c, X86_FEATURE_CQM_MBM_TOTAL) ||
> +	    cpu_has(c, X86_FEATURE_CQM_MBM_LOCAL)) {
> +		u32 eax, ebx, ecx, edx;
> +
> +		/* QoS sub-leaf, EAX=0Fh, ECX=1 */
> +		cpuid_count(0xf, 1, &eax, &ebx, &ecx, &edx);
> +
> +		c->x86_cache_max_rmid  = ecx;
> +		c->x86_cache_occ_scale = ebx;
> +
> +		if (c->x86_vendor == X86_VENDOR_INTEL)
> +			c->x86_cache_mbm_width_offset = eax & 0xff;
> +	}
> +}
> +

resctrl_cpu_detect() is now identical among vendors. Do we still need
the c_bsp_init helpers? Could we not perhaps call resctrl_cpu_detect()
directly from early_identify_cpu()?

Thank you

Reinette

  reply	other threads:[~2020-05-05  4:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 17:51 [PATCH 0/2] x86/resctrl: Support wider MBM counters Reinette Chatre
2020-04-01 17:51 ` [PATCH 1/2] x86/resctrl: Maintain MBM counter width per resource Reinette Chatre
2020-04-01 17:51 ` [PATCH 2/2] x86/resctrl: Support CPUID enumeration of MBM counter width Reinette Chatre
2020-04-03  0:05   ` Fenghua Yu
2020-04-03 15:31     ` Reinette Chatre
2020-04-29 18:11   ` Borislav Petkov
2020-04-29 18:42     ` Reinette Chatre
2020-04-30  9:59       ` Borislav Petkov
2020-05-03 18:51         ` Reinette Chatre
2020-05-04  7:56           ` Borislav Petkov
2020-05-05  4:19             ` Reinette Chatre [this message]
2020-05-05 22:15               ` Reinette Chatre
2020-04-23 16:40 ` [PATCH 0/2] x86/resctrl: Support wider MBM counters Reinette Chatre

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=b357e1f6-bf92-ec50-73f2-bd5987b159fc@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=kuo-lang.tseng@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.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