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: <acdfa4ee-e293-49f3-8e53-900b9db63ddb@intel.com>
Date: Wed, 19 Feb 2025 15:24:06 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: James Morse <james.morse@....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>
Subject: Re: [PATCH v6 12/42] x86/resctrl: Move rdt_find_domain() to be
 visible to arch and fs code

Hi James,

On 2/7/25 10:17 AM, James Morse wrote:
> rdt_find_domain() finds a domain given a resource and a cache-id.
> This is used by both the architecture code and the filesystem code.
> 
> After the filesystem code moves to live in /fs/, this helper will no
> longer be visible.
> 
> Move it to the global header file. As its now globally visible, and
> has only a handful of callers, swap the 'rdt' for 'resctrl'.
> 
> Signed-off-by: James Morse <james.morse@....com>
> 
> ---
> Changes since v5:
>  * This patch replaced one that split off the 'new entry to insert'
>    behaviour.
> ---

...

> @@ -395,36 +395,6 @@ void rdt_ctrl_update(void *arg)
>  	hw_res->msr_update(m);
>  }
>  
> -/*
> - * rdt_find_domain - Search for a domain id in a resource domain list.
> - *
> - * Search the domain list to find the domain id. If the domain id is
> - * found, return the domain. NULL otherwise.  If the domain id is not
> - * found (and NULL returned) then the first domain with id bigger than
> - * the input id can be returned to the caller via @pos.
> - */
> -struct rdt_domain_hdr *rdt_find_domain(struct list_head *h, int id,
> -				       struct list_head **pos)
> -{
> -	struct rdt_domain_hdr *d;
> -	struct list_head *l;
> -
> -	list_for_each(l, h) {
> -		d = list_entry(l, struct rdt_domain_hdr, list);
> -		/* When id is found, return its domain. */
> -		if (id == d->id)
> -			return d;
> -		/* Stop searching when finding id's position in sorted list. */
> -		if (id < d->id)
> -			break;
> -	}
> -
> -	if (pos)
> -		*pos = l;
> -
> -	return NULL;
> -}
> -
>  static void setup_default_ctrlval(struct rdt_resource *r, u32 *dc)
>  {
>  	struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);

...

> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -372,6 +372,40 @@ static inline void resctrl_arch_rmid_read_context_check(void)
>  		might_sleep();
>  }
>  
> +/**
> + * resctrl_find_domain() - Search for a domain id in a resource domain list.
> + * @h:		The domain list to search.
> + * @id:		The domain id to search for.
> + * @pos:	A pointer to position in the list id should be inserted.
> + *
> + * Search the domain list to find the domain id. If the domain id is
> + * found, return the domain. NULL otherwise.  If the domain id is not
> + * found (and NULL returned) then the first domain with id bigger than
> + * the input id can be returned to the caller via @pos.
> + */
> +static inline struct rdt_domain_hdr *resctrl_find_domain(struct list_head *h,
> +							 int id,
> +							 struct list_head **pos)

Could you please provide a motivation for why this needs to be inline now?

> +{
> +	struct rdt_domain_hdr *d;
> +	struct list_head *l;
> +
> +	list_for_each(l, h) {
> +		d = list_entry(l, struct rdt_domain_hdr, list);
> +		/* When id is found, return its domain. */
> +		if (id == d->id)
> +			return d;
> +		/* Stop searching when finding id's position in sorted list. */
> +		if (id < d->id)
> +			break;
> +	}
> +
> +	if (pos)
> +		*pos = l;
> +
> +	return NULL;
> +}
> +
>  /**
>   * resctrl_arch_reset_rmid() - Reset any private state associated with rmid
>   *			       and eventid.


Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ