Michal Suchanek 48ad88
From c30f931e891eb0a32885ecd79984e1e7366fceda Mon Sep 17 00:00:00 2001
Michal Suchanek 48ad88
From: Nathan Lynch <nathanl@linux.ibm.com>
Michal Suchanek 48ad88
Date: Fri, 12 Jun 2020 00:12:23 -0500
Michal Suchanek 48ad88
Subject: [PATCH] powerpc/numa: remove ability to enable topology updates
Michal Suchanek 48ad88
Michal Suchanek 48ad88
References: bsc#1181674 ltc#189159
Michal Suchanek 48ad88
Patch-mainline: v5.9-rc1
Michal Suchanek 48ad88
Git-commit: c30f931e891eb0a32885ecd79984e1e7366fceda
Michal Suchanek 48ad88
Michal Suchanek 48ad88
Remove the /proc/powerpc/topology_updates interface and the
Michal Suchanek 48ad88
topology_updates=on/off command line argument. The internal
Michal Suchanek 48ad88
topology_updates_enabled flag remains for now, but always false.
Michal Suchanek 48ad88
Michal Suchanek 48ad88
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Michal Suchanek 48ad88
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Michal Suchanek 48ad88
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Michal Suchanek 48ad88
Link: https://lore.kernel.org/r/20200612051238.1007764-4-nathanl@linux.ibm.com
Michal Suchanek 48ad88
Acked-by: Michal Suchanek <msuchanek@suse.de>
Michal Suchanek 48ad88
---
Michal Suchanek 48ad88
 arch/powerpc/mm/numa.c | 71 +-----------------------------------------
Michal Suchanek 48ad88
 1 file changed, 1 insertion(+), 70 deletions(-)
Michal Suchanek 48ad88
Michal Suchanek 48ad88
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
Michal Suchanek 48ad88
--- a/arch/powerpc/mm/numa.c
Michal Suchanek 48ad88
+++ b/arch/powerpc/mm/numa.c
Michal Suchanek 48ad88
@@ -984,27 +984,7 @@ static int __init early_numa(char *p)
Michal Suchanek 48ad88
 }
Michal Suchanek 48ad88
 early_param("numa", early_numa);
Michal Suchanek 48ad88
 
Michal Suchanek 48ad88
-/*
Michal Suchanek 48ad88
- * The platform can inform us through one of several mechanisms
Michal Suchanek 48ad88
- * (post-migration device tree updates, PRRN or VPHN) that the NUMA
Michal Suchanek 48ad88
- * assignment of a resource has changed. This controls whether we act
Michal Suchanek 48ad88
- * on that. Disabled by default.
Michal Suchanek 48ad88
- */
Michal Suchanek 48ad88
-static bool topology_updates_enabled;
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-static int __init early_topology_updates(char *p)
Michal Suchanek 48ad88
-{
Michal Suchanek 48ad88
-	if (!p)
Michal Suchanek 48ad88
-		return 0;
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	if (!strcmp(p, "on")) {
Michal Suchanek 48ad88
-		pr_warn("Caution: enabling topology updates\n");
Michal Suchanek 48ad88
-		topology_updates_enabled = true;
Michal Suchanek 48ad88
-	}
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	return 0;
Michal Suchanek 48ad88
-}
Michal Suchanek 48ad88
-early_param("topology_updates", early_topology_updates);
Michal Suchanek 48ad88
+static const bool topology_updates_enabled;
Michal Suchanek 48ad88
 
Michal Suchanek 48ad88
 #ifdef CONFIG_MEMORY_HOTPLUG
Michal Suchanek 48ad88
 /*
Michal Suchanek 48ad88
@@ -1632,52 +1612,6 @@ int prrn_is_enabled(void)
Michal Suchanek 48ad88
 	return prrn_enabled;
Michal Suchanek 48ad88
 }
Michal Suchanek 48ad88
 
Michal Suchanek 48ad88
-static int topology_read(struct seq_file *file, void *v)
Michal Suchanek 48ad88
-{
Michal Suchanek 48ad88
-	if (vphn_enabled || prrn_enabled)
Michal Suchanek 48ad88
-		seq_puts(file, "on\n");
Michal Suchanek 48ad88
-	else
Michal Suchanek 48ad88
-		seq_puts(file, "off\n");
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	return 0;
Michal Suchanek 48ad88
-}
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-static int topology_open(struct inode *inode, struct file *file)
Michal Suchanek 48ad88
-{
Michal Suchanek 48ad88
-	return single_open(file, topology_read, NULL);
Michal Suchanek 48ad88
-}
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-static ssize_t topology_write(struct file *file, const char __user *buf,
Michal Suchanek 48ad88
-			      size_t count, loff_t *off)
Michal Suchanek 48ad88
-{
Michal Suchanek 48ad88
-	char kbuf[4]; /* "on" or "off" plus null. */
Michal Suchanek 48ad88
-	int read_len;
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	read_len = count < 3 ? count : 3;
Michal Suchanek 48ad88
-	if (copy_from_user(kbuf, buf, read_len))
Michal Suchanek 48ad88
-		return -EINVAL;
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	kbuf[read_len] = '\0';
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	if (!strncmp(kbuf, "on", 2)) {
Michal Suchanek 48ad88
-		topology_updates_enabled = true;
Michal Suchanek 48ad88
-		start_topology_update();
Michal Suchanek 48ad88
-	} else if (!strncmp(kbuf, "off", 3)) {
Michal Suchanek 48ad88
-		stop_topology_update();
Michal Suchanek 48ad88
-		topology_updates_enabled = false;
Michal Suchanek 48ad88
-	} else
Michal Suchanek 48ad88
-		return -EINVAL;
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-	return count;
Michal Suchanek 48ad88
-}
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
-static const struct file_operations topology_ops = {
Michal Suchanek 48ad88
-	.read = seq_read,
Michal Suchanek 48ad88
-	.write = topology_write,
Michal Suchanek 48ad88
-	.open = topology_open,
Michal Suchanek 48ad88
-	.release = single_release
Michal Suchanek 48ad88
-};
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
 static int topology_update_init(void)
Michal Suchanek 48ad88
 {
Michal Suchanek 48ad88
 	start_topology_update();
Michal Suchanek 48ad88
@@ -1685,9 +1619,6 @@ static int topology_update_init(void)
Michal Suchanek 48ad88
 	if (vphn_enabled)
Michal Suchanek 48ad88
 		topology_schedule_update();
Michal Suchanek 48ad88
 
Michal Suchanek 48ad88
-	if (!proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops))
Michal Suchanek 48ad88
-		return -ENOMEM;
Michal Suchanek 48ad88
-
Michal Suchanek 48ad88
 	topology_inited = 1;
Michal Suchanek 48ad88
 	return 0;
Michal Suchanek 48ad88
 }
Michal Suchanek 48ad88
-- 
Michal Suchanek 48ad88
2.26.2
Michal Suchanek 48ad88