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: <aYTCV8E9ZFn4_FND@arm.com>
Date: Thu, 5 Feb 2026 16:16:23 +0000
From: Catalin Marinas <catalin.marinas@....com>
To: Ben Horgan <ben.horgan@....com>
Cc: amitsinght@...vell.com, baisheng.gao@...soc.com,
	baolin.wang@...ux.alibaba.com, carl@...amperecomputing.com,
	dave.martin@....com, david@...nel.org, dfustini@...libre.com,
	fenghuay@...dia.com, gshan@...hat.com, james.morse@....com,
	jonathan.cameron@...wei.com, kobak@...dia.com, lcherian@...vell.com,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	peternewman@...gle.com, punit.agrawal@....qualcomm.com,
	quic_jiles@...cinc.com, reinette.chatre@...el.com,
	rohit.mathew@....com, scott@...amperecomputing.com,
	sdonthineni@...dia.com, tan.shaopeng@...itsu.com,
	xhao@...ux.alibaba.com, will@...nel.org, corbet@....net,
	maz@...nel.org, oupton@...nel.org, joey.gouly@....com,
	suzuki.poulose@....com, kvmarm@...ts.linux.dev,
	zengheng4@...wei.com, linux-doc@...r.kernel.org,
	Shaopeng Tan <tan.shaopeng@...fujitsu.com>
Subject: Re: [PATCH v4 04/41] arm64: mpam: Context switch the MPAM registers

On Tue, Feb 03, 2026 at 09:43:05PM +0000, Ben Horgan wrote:
> From: James Morse <james.morse@....com>
> 
> MPAM allows traffic in the SoC to be labeled by the OS, these labels are
> used to apply policy in caches and bandwidth regulators, and to monitor
> traffic in the SoC. The label is made up of a PARTID and PMG value. The x86
> equivalent calls these CLOSID and RMID, but they don't map precisely.
> 
> MPAM has two CPU system registers that is used to hold the PARTID and PMG
> values that traffic generated at each exception level will use. These can
> be set per-task by the resctrl file system. (resctrl is the defacto
> interface for controlling this stuff).
> 
> Add a helper to switch this.
> 
> struct task_struct's separate CLOSID and RMID fields are insufficient to
> implement resctrl using MPAM, as resctrl can change the PARTID (CLOSID) and
> PMG (sort of like the RMID) separately. On x86, the rmid is an independent
> number, so a race that writes a mismatched closid and rmid into hardware is
> benign. On arm64, the pmg bits extend the partid.
> (i.e. partid-5 has a pmg-0 that is not the same as partid-6's pmg-0).  In
> this case, mismatching the values will 'dirty' a pmg value that resctrl
> believes is clean, and is not tracking with its 'limbo' code.
> 
> To avoid this, the partid and pmg are always read and written as a
> pair. This requires a new u64 field. In struct task_struct there are two
> u32, rmid and closid for the x86 case, but as we can't use them here do
> something else. Add this new field, mpam_partid_pmg, to struct thread_info
> to avoid adding more architecture specific code to struct task_struct.
> Always use READ_ONCE()/WRITE_ONCE() when accessing this field.
> 
> Resctrl allows a per-cpu 'default' value to be set, this overrides the
> values when scheduling a task in the default control-group, which has
> PARTID 0. The way 'code data prioritisation' gets emulated means the
> register value for the default group needs to be a variable.
> 
> The current system register value is kept in a per-cpu variable to avoid
> writing to the system register if the value isn't going to change.  Writes
> to this register may reset the hardware state for regulating bandwidth.
> 
> Finally, there is no reason to context switch these registers unless there
> is a driver changing the values in struct task_struct. Hide the whole thing
> behind a static key. This also allows the driver to disable MPAM in
> response to errors reported by hardware. Move the existing static key to
> belong to the arch code, as in the future the MPAM driver may become a
> loadable module.
> 
> All this should depend on whether there is an MPAM driver, hide it behind
> CONFIG_ARM64_MPAM.
> 
> Tested-by: Gavin Shan <gshan@...hat.com>
> Tested-by: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
> Tested-by: Peter Newman <peternewman@...gle.com>
> CC: Amit Singh Tomar <amitsinght@...vell.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
> Signed-off-by: James Morse <james.morse@....com>
> Reviewed-by: Gavin Shan <gshan@...hat.com>
> Signed-off-by: Ben Horgan <ben.horgan@....com>

Reviewed-by: Catalin Marinas <catalin.marinas@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ