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: <f59201a8-cc8a-47b3-b495-cb2b6d568610@intel.com>
Date: Fri, 18 Apr 2025 14:40:55 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghuay@...dia.com>, "Maciej
 Wieczor-Retman" <maciej.wieczor-retman@...el.com>, Peter Newman
	<peternewman@...gle.com>, James Morse <james.morse@....com>, Babu Moger
	<babu.moger@....com>, Drew Fustini <dfustini@...libre.com>, Dave Martin
	<Dave.Martin@....com>, Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>
CC: <linux-kernel@...r.kernel.org>, <patches@...ts.linux.dev>
Subject: Re: [PATCH v3 06/26] fs-x86/rectrl: Improve domain type checking

Hi Tony,

On 4/7/25 4:40 PM, Tony Luck wrote:
> The rdt_domain_hdr structure is used in both control and monitor
> domain structures to provide common methods for operations such as
> adding a CPU to a domain, removing a CPU from a domain, accessing
> the mask of all CPUs in a domain.
> 
> The "type" field provides a simple check whether a domain is a
> control or monitor domain so that programming errors operating
> on domains will be quickly caught.
> 
> To prepare for additional domain types that depend on the rdt_resource
> to which they are connected add the resource id into the type.
> 
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
>  include/linux/resctrl.h            | 19 ++++++++++---------
>  arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++------
>  fs/resctrl/ctrlmondata.c           |  2 +-
>  3 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index d6a926b6fc0e..177f9879bae1 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -111,11 +111,6 @@ struct resctrl_staged_config {
>  	bool			have_new_ctrl;
>  };
>  
> -enum resctrl_domain_type {
> -	RESCTRL_CTRL_DOMAIN,
> -	RESCTRL_MON_DOMAIN,
> -};
> -
>  /**
>   * struct rdt_domain_hdr - common header for different domain types
>   * @list:		all instances of this resource
> @@ -124,12 +119,18 @@ enum resctrl_domain_type {
>   * @cpu_mask:		which CPUs share this resource
>   */
>  struct rdt_domain_hdr {
> -	struct list_head		list;
> -	int				id;
> -	enum resctrl_domain_type	type;
> -	struct cpumask			cpu_mask;
> +	struct list_head	list;
> +	int			id;
> +	u32			type;
> +	struct cpumask		cpu_mask;
>  };
>  
> +/* Bitfields in rdt_domain_hdr.type */
> +#define	DOMTYPE_RID		GENMASK(8, 0)
> +#define DOMTYPE_CTRL		BIT(9)
> +#define DOMTYPE_MON		BIT(10)
> +#define DOMTYPE(rid, type)	(((rid) & DOMTYPE_RID) | (type))
> +

This seems unnecessarily complicated to me. Why not just add the
resource id to the domain header?

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ