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]
Message-ID: <54a797ba-792f-4eba-ba19-91bf80caf412@arm.com>
Date: Fri, 28 Feb 2025 19:53:29 +0000
From: James Morse <james.morse@....com>
To: Reinette Chatre <reinette.chatre@...el.com>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
 Borislav Petkov <bp@...en8.de>, H Peter Anvin <hpa@...or.com>,
 Babu Moger <Babu.Moger@....com>, shameerali.kolothum.thodi@...wei.com,
 D Scott Phillips OS <scott@...amperecomputing.com>,
 carl@...amperecomputing.com, lcherian@...vell.com,
 bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
 baolin.wang@...ux.alibaba.com, Jamie Iles <quic_jiles@...cinc.com>,
 Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com,
 dfustini@...libre.com, amitsinght@...vell.com,
 David Hildenbrand <david@...hat.com>, Rex Nie <rex.nie@...uarmicro.com>,
 Dave Martin <dave.martin@....com>, Koba Ko <kobak@...dia.com>,
 Shanker Donthineni <sdonthineni@...dia.com>,
 Shaopeng Tan <tan.shaopeng@...fujitsu.com>, Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH v6 30/42] x86/resctrl: Claim
 get_{mon,ctrl}_domain_from_cpu() helpers for resctrl

Hi Reinette,

On 20/02/2025 04:08, Reinette Chatre wrote:
> On 2/7/25 10:18 AM, James Morse wrote:
>> get_{mon,ctrl}_domain_from_cpu() are handy helpers that both the arch
>> code and resctrl need to use. Rename them to have a resctrl_ prefix
>> and move them to a header file.

>> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
>> index 29415d023aab..511dab4ffcdc 100644
>> --- a/include/linux/resctrl.h
>> +++ b/include/linux/resctrl.h
>> @@ -3,6 +3,7 @@
>>  #define _RESCTRL_H
>>  
>>  #include <linux/cacheinfo.h>
>> +#include <linux/cpu.h>
>>  #include <linux/kernel.h>
>>  #include <linux/list.h>
>>  #include <linux/pid.h>
>> @@ -399,6 +400,42 @@ static inline u32 resctrl_get_config_index(u32 closid,
>>  	}
>>  }
>>  
>> +/*
>> + * Caller must hold the cpuhp read lock to prevent the struct rdt_domain from

> struct rdt_domain has since been split into struct rdt_ctrl_domain and struct rdt_mon_domain.
> I assume this comment covers both helpers so perhaps this can be "to prevent the domain
> from ..."?

Makes sense - thanks!


>> + * being freed.
>> + */
>> +static inline struct rdt_ctrl_domain *
>> +resctrl_get_ctrl_domain_from_cpu(int cpu, struct rdt_resource *r)
>> +{
>> +	struct rdt_ctrl_domain *d;
>> +
>> +	lockdep_assert_cpus_held();
>> +
>> +	list_for_each_entry(d, &r->ctrl_domains, hdr.list) {
>> +		/* Find the domain that contains this CPU */
>> +		if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
>> +			return d;
>> +	}
>> +
>> +	return NULL;
>> +}
>> +
>> +static inline struct rdt_mon_domain *
>> +resctrl_get_mon_domain_from_cpu(int cpu, struct rdt_resource *r)
>> +{
>> +	struct rdt_mon_domain *d;
>> +
>> +	lockdep_assert_cpus_held();
>> +
>> +	list_for_each_entry(d, &r->mon_domains, hdr.list) {
>> +		/* Find the domain that contains this CPU */
>> +		if (cpumask_test_cpu(cpu, &d->hdr.cpu_mask))
>> +			return d;
>> +	}
>> +
>> +	return NULL;
>> +}
>> +
> 
> Similar to previous requests, could you please provide a motivation for
> the switch to inline?

Hmmm, this has diverged over time. x86 is now using its get_domain_id_from_scope() and
resctrl_find_domain() to cover this. I can probably do away with MPAMs use of these...

~

This gets replaced by a patch that moves them to live next to their callers which lets
them be static, and makes the automated move feasible.


Thanks,

James

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ