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]
Date:   Fri, 23 Sep 2022 18:01:54 -0000
From:   "tip-bot2 for James Morse" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     James Morse <james.morse@....com>, Borislav Petkov <bp@...e.de>,
        Jamie Iles <quic_jiles@...cinc.com>,
        Shaopeng Tan <tan.shaopeng@...itsu.com>,
        Reinette Chatre <reinette.chatre@...el.com>,
        Xin Hao <xhao@...ux.alibaba.com>,
        Cristian Marussi <cristian.marussi@....com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: x86/cache] x86/resctrl: Abstract and use supports_mba_mbps()

The following commit has been merged into the x86/cache branch of tip:

Commit-ID:     b045c215866393419fb960432ed6be69a0113ee1
Gitweb:        https://git.kernel.org/tip/b045c215866393419fb960432ed6be69a0113ee1
Author:        James Morse <james.morse@....com>
AuthorDate:    Fri, 02 Sep 2022 15:48:15 
Committer:     Borislav Petkov <bp@...e.de>
CommitterDate: Thu, 22 Sep 2022 16:10:11 +02:00

x86/resctrl: Abstract and use supports_mba_mbps()

To determine whether the mba_MBps option to resctrl should be supported,
resctrl tests the boot CPUs' x86_vendor.

This isn't portable, and needs abstracting behind a helper so this check
can be part of the filesystem code that moves to /fs/.

Re-use the tests set_mba_sc() does to determine if the mba_sc is supported
on this system. An 'alloc_capable' test is added so that support for the
controls isn't implied by the 'delay_linear' property, which is always
true for MPAM. Because mbm_update() only update mba_sc if the mbm_local
counters are enabled, supports_mba_mbps() checks is_mbm_local_enabled().
(instead of using is_mbm_enabled(), which checks both).

Signed-off-by: James Morse <james.morse@....com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Reviewed-by: Jamie Iles <quic_jiles@...cinc.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@...itsu.com>
Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>
Tested-by: Xin Hao <xhao@...ux.alibaba.com>
Tested-by: Shaopeng Tan <tan.shaopeng@...itsu.com>
Tested-by: Cristian Marussi <cristian.marussi@....com>
Link: https://lore.kernel.org/r/20220902154829.30399-8-james.morse@arm.com
---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index b32ceff..4ee2626 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -1890,17 +1890,26 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r)
 }
 
 /*
- * Enable or disable the MBA software controller
- * which helps user specify bandwidth in MBps.
  * MBA software controller is supported only if
  * MBM is supported and MBA is in linear scale.
  */
+static bool supports_mba_mbps(void)
+{
+	struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl;
+
+	return (is_mbm_local_enabled() &&
+		r->alloc_capable && is_mba_linear());
+}
+
+/*
+ * Enable or disable the MBA software controller
+ * which helps user specify bandwidth in MBps.
+ */
 static int set_mba_sc(bool mba_sc)
 {
 	struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl;
 
-	if (!is_mbm_enabled() || !is_mba_linear() ||
-	    mba_sc == is_mba_sc(r))
+	if (!supports_mba_mbps() || mba_sc == is_mba_sc(r))
 		return -EINVAL;
 
 	r->membw.mba_sc = mba_sc;
@@ -2255,7 +2264,7 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		ctx->enable_cdpl2 = true;
 		return 0;
 	case Opt_mba_mbps:
-		if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
+		if (!supports_mba_mbps())
 			return -EINVAL;
 		ctx->enable_mba_mbps = true;
 		return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ