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: <20180824104519.11203-11-james.morse@arm.com>
Date:   Fri, 24 Aug 2018 11:45:09 +0100
From:   James Morse <james.morse@....com>
To:     linux-kernel@...r.kernel.org
Cc:     x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Tony Luck <tony.luck@...el.com>,
        Ingo Molnar <mingo@...hat.com>, H Peter Anvin <hpa@...or.com>,
        Reinette Chatre <reinette.chatre@...el.com>,
        Vikas Shivappa <vikas.shivappa@...ux.intel.com>
Subject: [RFC PATCH 10/20] x86/intel_rdt: Let resctrl change the resources's num_closid

Today we switch between different alloc_enabled resources which
have differing preset num_closid to account for CDP.
We want to merge these illusionary caches together, at which
point something needs to change the resctrl's view of num_closid.

The arch code now has its own idea of how many closids there are,
and as the two configurations for one rdtgroup is part of resctrl's
ABI we should get resctrl to change it.

We change the num_closid on the l2/l3 resources, which aren't
yet in use when cdp is enabled, then change them back afterwards.
Once we merge illusionary caches, resctrl will see the value it
changed here.

Signed-off-by: James Morse <james.morse@....com>
---
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 58dceaad6863..e2a9202674f3 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -1149,16 +1149,36 @@ int resctrl_arch_set_cdp_enabled(bool enable)
 
 static int try_to_enable_cdp(int level)
 {
+	int ret;
 	struct rdt_resource *r = &rdt_resources_all[level].resctrl;
+	struct rdt_resource *l3 = &rdt_resources_all[RDT_RESOURCE_L3].resctrl;
+	struct rdt_resource *l2 = &rdt_resources_all[RDT_RESOURCE_L2].resctrl;
 
 	if (!r->cdp_capable)
 		return -EINVAL;
+	if (r->cdp_enabled)
+		return 0;
 
-	return resctrl_arch_set_cdp_enabled(true);
+	ret = resctrl_arch_set_cdp_enabled(true);
+	if (!ret) {
+		if (l2->cdp_enabled)
+			l2->num_closid /= 2;
+		if (l3->cdp_enabled)
+			l3->num_closid /= 2;
+	}
+
+	return ret;
 }
 
 static void cdp_disable_all(void)
 {
+	struct rdt_resource *l2 = &rdt_resources_all[RDT_RESOURCE_L2].resctrl;
+	struct rdt_resource *l3 = &rdt_resources_all[RDT_RESOURCE_L3].resctrl;
+
+	if (l2->cdp_enabled)
+		l2->num_closid *= 2;
+	if (l3->cdp_enabled)
+		l3->num_closid *= 2;
 	resctrl_arch_set_cdp_enabled(false);
 }
 
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ