From nobody Fri Dec 19 02:52:54 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9771257430; Wed, 12 Mar 2025 17:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741800027; cv=none; b=VVcF7yjFRhsbaG84WnP3QSx7uUGi0sC7EnfsXMDFf49Jk00W1lwvci/2btruLGZ2URluUpVkPLf6vFFwtjBQyq8cUJEZ76Nz+R2SXYgksT/wLnlDRE/taJM+96MDycIfGlDkm/p9T9GebStyfkPNT+TyAZZZY1TU8u03l9l5rHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741800027; c=relaxed/simple; bh=p55iGm4XCFTOEvXFobgBCEH75eZr3uQA7bt7VDRK9fc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=cw9Ze2qO5GfR0jPyxz4vyohwG8LM0ePO+V8B8M1pNhiXYZzbKlMU68a2voaruGUlru+ZyEercxXO7IoOcmqF6oEGD37+DKyzmHisFjYj60M6bh9QDRy9Q0p3tWOfYg9tfUFu3ghOQt9MIsx0wtcx8Zg2WRqIEanOrs4BXv8gGlI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OTPCg433; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3vNQfoAD; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OTPCg433"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3vNQfoAD" Date: Wed, 12 Mar 2025 17:20:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1741800023; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+5p1ju52xPrmqoqUYQQpg2OSc7+hNPMA1xvWyXHnR9Y=; b=OTPCg433xNcNXsxo8/YolOi9CC8D83IRiD5qX4+dcBUuWAM+aJgQ+iEVmiAppIjI64A+ZF AFaxHP7Fdr3/N4/a81Rtflso1HiFCE6hnfmZ5g654C8q/37FC0vpRRBgxOcis/4zfiunRd VWvjVFjRXrp5RsTrtXpnIKQkVCnbYK9TlXMV0szbYulT4yML2grC+gIvzIzG9/g+stXH7n ZLzdURFDfkUl9eyuLqr8L/kMHK4BxQAYRu70VAoNAoD6dA/++Oxq+T6n4c3qZcf9J8886O HydNTt6YsM9iz3bxnfKhjujFqiuU/GVUUFes+LGYZZ2ctCBBho6pDR3i/cweSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1741800023; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+5p1ju52xPrmqoqUYQQpg2OSc7+hNPMA1xvWyXHnR9Y=; b=3vNQfoADK73+izH+o7xqgjw6btwsMam0d+M/ByiAeZYGmq+6yLDLRECrNuUCVuytQ0dDmr 5WWDd/OsXCk1v/Dw== From: "tip-bot2 for James Morse" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Add resctrl_arch_ prefix to pseudo lock functions Cc: James Morse , "Borislav Petkov (AMD)" , Shaopeng Tan , Tony Luck , Reinette Chatre , Fenghua Yu , Babu Moger , Carl Worth , Peter Newman , Amit Singh Tomar , Shanker Donthineni , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250311183715.16445-24-james.morse@arm.com> References: <20250311183715.16445-24-james.morse@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174180002275.14745.8948655128601361005.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/cache branch of tip: Commit-ID: 7d0ec14c64a107a548616deace93a1913e5d68ed Gitweb: https://git.kernel.org/tip/7d0ec14c64a107a548616deace93a1913= e5d68ed Author: James Morse AuthorDate: Tue, 11 Mar 2025 18:37:08=20 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 12 Mar 2025 12:24:22 +01:00 x86/resctrl: Add resctrl_arch_ prefix to pseudo lock functions resctrl's pseudo lock has some copy-to-cache and measurement functions that are micro-architecture specific. For example, pseudo_lock_fn() is not at all portable. Label these 'resctrl_arch_' so they stay under /arch/x86. To expose these functions to the filesystem code they need an entry in a header file, and can't be marked static. Signed-off-by: James Morse Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Shaopeng Tan Reviewed-by: Tony Luck Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Reviewed-by: Babu Moger Tested-by: Carl Worth # arm64 Tested-by: Shaopeng Tan Tested-by: Peter Newman Tested-by: Amit Singh Tomar # arm64 Tested-by: Shanker Donthineni # arm64 Tested-by: Babu Moger Link: https://lore.kernel.org/r/20250311183715.16445-24-james.morse@arm.com --- arch/x86/include/asm/resctrl.h | 5 +++- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 36 +++++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index 6d4c7ea..86407db 100644 --- a/arch/x86/include/asm/resctrl.h +++ b/arch/x86/include/asm/resctrl.h @@ -203,6 +203,11 @@ static inline void *resctrl_arch_mon_ctx_alloc(struct = rdt_resource *r, int evtid static inline void resctrl_arch_mon_ctx_free(struct rdt_resource *r, int e= vtid, void *ctx) { }; =20 +u64 resctrl_arch_get_prefetch_disable_bits(void); +int resctrl_arch_pseudo_lock_fn(void *_rdtgrp); +int resctrl_arch_measure_cycles_lat_fn(void *_plr); +int resctrl_arch_measure_l2_residency(void *_plr); +int resctrl_arch_measure_l3_residency(void *_plr); void resctrl_cpu_detect(struct cpuinfo_x86 *c); =20 #else diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cp= u/resctrl/pseudo_lock.c index 42cc162..1f42c11 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -61,7 +61,8 @@ static const struct class pseudo_lock_class =3D { }; =20 /** - * get_prefetch_disable_bits - prefetch disable bits of supported platforms + * resctrl_arch_get_prefetch_disable_bits - prefetch disable bits of suppo= rted + * platforms * @void: It takes no parameters. * * Capture the list of platforms that have been validated to support @@ -75,13 +76,13 @@ static const struct class pseudo_lock_class =3D { * in the SDM. * * When adding a platform here also add support for its cache events to - * measure_cycles_perf_fn() + * resctrl_arch_measure_l*_residency() * * Return: * If platform is supported, the bits to disable hardware prefetchers, 0 * if platform is not supported. */ -static u64 get_prefetch_disable_bits(void) +u64 resctrl_arch_get_prefetch_disable_bits(void) { if (boot_cpu_data.x86_vendor !=3D X86_VENDOR_INTEL || boot_cpu_data.x86 !=3D 6) @@ -408,7 +409,7 @@ static void pseudo_lock_free(struct rdtgroup *rdtgrp) } =20 /** - * pseudo_lock_fn - Load kernel memory into cache + * resctrl_arch_pseudo_lock_fn - Load kernel memory into cache * @_rdtgrp: resource group to which pseudo-lock region belongs * * This is the core pseudo-locking flow. @@ -426,7 +427,7 @@ static void pseudo_lock_free(struct rdtgroup *rdtgrp) * * Return: 0. Waiter on waitqueue will be woken on completion. */ -static int pseudo_lock_fn(void *_rdtgrp) +int resctrl_arch_pseudo_lock_fn(void *_rdtgrp) { struct rdtgroup *rdtgrp =3D _rdtgrp; struct pseudo_lock_region *plr =3D rdtgrp->plr; @@ -712,7 +713,7 @@ int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp) * Not knowing the bits to disable prefetching implies that this * platform does not support Cache Pseudo-Locking. */ - prefetch_disable_bits =3D get_prefetch_disable_bits(); + prefetch_disable_bits =3D resctrl_arch_get_prefetch_disable_bits(); if (prefetch_disable_bits =3D=3D 0) { rdt_last_cmd_puts("Pseudo-locking not supported\n"); return -EINVAL; @@ -872,7 +873,8 @@ bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_ctr= l_domain *d) } =20 /** - * measure_cycles_lat_fn - Measure cycle latency to read pseudo-locked mem= ory + * resctrl_arch_measure_cycles_lat_fn - Measure cycle latency to read + * pseudo-locked memory * @_plr: pseudo-lock region to measure * * There is no deterministic way to test if a memory region is cached. One @@ -885,7 +887,7 @@ bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_ctr= l_domain *d) * * Return: 0. Waiter on waitqueue will be woken on completion. */ -static int measure_cycles_lat_fn(void *_plr) +int resctrl_arch_measure_cycles_lat_fn(void *_plr) { struct pseudo_lock_region *plr =3D _plr; u32 saved_low, saved_high; @@ -1069,7 +1071,7 @@ out: return 0; } =20 -static int measure_l2_residency(void *_plr) +int resctrl_arch_measure_l2_residency(void *_plr) { struct pseudo_lock_region *plr =3D _plr; struct residency_counts counts =3D {0}; @@ -1107,7 +1109,7 @@ out: return 0; } =20 -static int measure_l3_residency(void *_plr) +int resctrl_arch_measure_l3_residency(void *_plr) { struct pseudo_lock_region *plr =3D _plr; struct residency_counts counts =3D {0}; @@ -1205,14 +1207,14 @@ static int pseudo_lock_measure_cycles(struct rdtgro= up *rdtgrp, int sel) plr->cpu =3D cpu; =20 if (sel =3D=3D 1) - thread =3D kthread_run_on_cpu(measure_cycles_lat_fn, plr, - cpu, "pseudo_lock_measure/%u"); + thread =3D kthread_run_on_cpu(resctrl_arch_measure_cycles_lat_fn, + plr, cpu, "pseudo_lock_measure/%u"); else if (sel =3D=3D 2) - thread =3D kthread_run_on_cpu(measure_l2_residency, plr, - cpu, "pseudo_lock_measure/%u"); + thread =3D kthread_run_on_cpu(resctrl_arch_measure_l2_residency, + plr, cpu, "pseudo_lock_measure/%u"); else if (sel =3D=3D 3) - thread =3D kthread_run_on_cpu(measure_l3_residency, plr, - cpu, "pseudo_lock_measure/%u"); + thread =3D kthread_run_on_cpu(resctrl_arch_measure_l3_residency, + plr, cpu, "pseudo_lock_measure/%u"); else goto out; =20 @@ -1307,7 +1309,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtg= rp) =20 plr->thread_done =3D 0; =20 - thread =3D kthread_run_on_cpu(pseudo_lock_fn, rdtgrp, + thread =3D kthread_run_on_cpu(resctrl_arch_pseudo_lock_fn, rdtgrp, plr->cpu, "pseudo_lock/%u"); if (IS_ERR(thread)) { ret =3D PTR_ERR(thread);