lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 Oct 2018 15:25:48 +0000
From:   "Moger, Babu" <Babu.Moger@....com>
To:     Reinette Chatre <reinette.chatre@...el.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "hpa@...or.com" <hpa@...or.com>,
        "fenghua.yu@...el.com" <fenghua.yu@...el.com>,
        "vikas.shivappa@...ux.intel.com" <vikas.shivappa@...ux.intel.com>,
        "tony.luck@...el.com" <tony.luck@...el.com>
CC:     "x86@...nel.org" <x86@...nel.org>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "pombredanne@...b.com" <pombredanne@...b.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "kstewart@...uxfoundation.org" <kstewart@...uxfoundation.org>,
        "bp@...e.de" <bp@...e.de>,
        "rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "xiaochen.shen@...el.com" <xiaochen.shen@...el.com>,
        "colin.king@...onical.com" <colin.king@...onical.com>,
        "Hurwitz, Sherry" <sherry.hurwitz@....com>,
        "Lendacky, Thomas" <Thomas.Lendacky@....com>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "dwmw@...zon.co.uk" <dwmw@...zon.co.uk>,
        "luto@...nel.org" <luto@...nel.org>,
        "jroedel@...e.de" <jroedel@...e.de>,
        "jannh@...gle.com" <jannh@...gle.com>,
        "dima@...sta.com" <dima@...sta.com>,
        "jpoimboe@...hat.com" <jpoimboe@...hat.com>,
        "vkuznets@...hat.com" <vkuznets@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 06/10] arch/x86: Initialize the resource functions
 that are different



On 10/02/2018 05:06 PM, Reinette Chatre wrote:
> Hi Babu,
> 
> On 9/24/2018 12:19 PM, Moger, Babu wrote:
>> Initialize the resource functions that are different between the
>> vendors. Some features are initialized differently between the vendors.
>>
>> For example, MBA feature varies significantly between Intel and AMD.
>> Separate the initialization of these resource functions. That way we
>> can easily add AMD's functions later.
>>
>> Signed-off-by: Babu Moger <babu.moger@....com>
>> ---
>>  arch/x86/kernel/cpu/rdt.c | 28 +++++++++++++++++++++++++---
>>  arch/x86/kernel/cpu/rdt.h |  4 ++++
>>  2 files changed, 29 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/rdt.c b/arch/x86/kernel/cpu/rdt.c
>> index 736715b81fd8..6dec45bf81d6 100644
>> --- a/arch/x86/kernel/cpu/rdt.c
>> +++ b/arch/x86/kernel/cpu/rdt.c
>> @@ -174,10 +174,7 @@ struct rdt_resource rdt_resources_all[] = {
>>  		.rid			= RDT_RESOURCE_MBA,
>>  		.name			= "MB",
>>  		.domains		= domain_init(RDT_RESOURCE_MBA),
>> -		.msr_base		= IA32_MBA_THRTL_BASE,
>> -		.msr_update		= mba_wrmsr,
>>  		.cache_level		= 3,
>> -		.parse_ctrlval		= parse_bw,
>>  		.format_str		= "%d=%*u",
>>  		.fflags			= RFTYPE_RES_MB,
>>  	},
>> @@ -865,6 +862,25 @@ static __init void rdt_check_mba(void)
>>  		rdt_get_mem_config(&rdt_resources_all[RDT_RESOURCE_MBA]);
>>  }
>>  
>> +static __init void rdt_init_res_defs_intel(void)
>> +{
>> +	struct rdt_resource *r;
>> +
>> +	for_each_rdt_resource(r) {
>> +		if (r->rid == RDT_RESOURCE_MBA) {
>> +			r->msr_base = IA32_MBA_THRTL_BASE;
>> +			r->msr_update = mba_wrmsr;
>> +			r->parse_ctrlval = parse_bw;
>> +		}
>> +	}
>> +}
> 
> Patch 10 introduces parse_bw_amd and mba_wrmsr_amd as you prepare us for
> in the commit message. I think it would reduce confusion if these
> functions, mba_wrmsr and parse_bw, also follow this pattern to contain
> the vendor name. So, mba_wrmsr -> mba_wrmsr_intel, parse_bw ->
> parse_bw_intel.

Yes. Sure. Will make this change.

> 
>> +
>> +static __init void rdt_init_res_defs(void)
>> +{
>> +	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
>> +		rdt_init_res_defs_intel();
>> +}
>> +
>>  static enum cpuhp_state rdt_online;
>>  
>>  static int __init rdt_late_init(void)
>> @@ -875,6 +891,12 @@ static int __init rdt_late_init(void)
>>  	/* Run quirks first */
>>  	rdt_quirks();
>>  
>> +	/*
>> +	 * Initialize functions(or definitions) that are different
>> +	 * between vendors here.
>> +	 */
>> +	rdt_init_res_defs();
>> +
> 
> While it does seem as though currently rdt_quirks() is not using any of
> the settings made in rdt_init_res_defs() it (rdt_quirks()) does use the
> partially initialized resources structure and this may in the future
> include using parameters that have not been initialized yet.
> 
> I thus think it would be safer to do this initialization before
> rdt_quirks().

Yes.  Makes sense.

> 
> Reinette
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ