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:55 -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: Remove set_mba_sc()s control array
 re-initialisation

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

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

x86/resctrl: Remove set_mba_sc()s control array re-initialisation

set_mba_sc() enables the 'software controller' to regulate the bandwidth
based on the byte counters. This can be managed entirely in the parts
of resctrl that move to /fs/, without any extra support from the
architecture specific code. set_mba_sc() is called by rdt_enable_ctx()
during mount and unmount. It currently resets the arch code's ctrl_val[]
and mbps_val[] arrays.

The ctrl_val[] was already reset when the domain was created, and by
reset_all_ctrls() when the filesystem was last unmounted. Doing the work
in set_mba_sc() is not necessary as the values are already at their
defaults due to the creation of the domain, or were previously reset
during umount(), or are about to reset during umount().

Add a reset of the mbps_val[] in reset_all_ctrls(), allowing the code in
set_mba_sc() that reaches in to the architecture specific structures to
be removed.

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-7-james.morse@arm.com
---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 5830905..b32ceff 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -1898,18 +1898,12 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r)
 static int set_mba_sc(bool mba_sc)
 {
 	struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl;
-	struct rdt_hw_domain *hw_dom;
-	struct rdt_domain *d;
 
 	if (!is_mbm_enabled() || !is_mba_linear() ||
 	    mba_sc == is_mba_sc(r))
 		return -EINVAL;
 
 	r->membw.mba_sc = mba_sc;
-	list_for_each_entry(d, &r->domains, list) {
-		hw_dom = resctrl_to_arch_dom(d);
-		setup_default_ctrlval(r, hw_dom->ctrl_val, hw_dom->mbps_val);
-	}
 
 	return 0;
 }
@@ -2327,8 +2321,10 @@ static int reset_all_ctrls(struct rdt_resource *r)
 		hw_dom = resctrl_to_arch_dom(d);
 		cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
 
-		for (i = 0; i < hw_res->num_closid; i++)
+		for (i = 0; i < hw_res->num_closid; i++) {
 			hw_dom->ctrl_val[i] = r->default_ctrl;
+			hw_dom->mbps_val[i] = MBA_MAX_MBPS;
+		}
 	}
 	cpu = get_cpu();
 	/* Update CBM on this cpu if it's in cpu_mask. */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ