Commit 1fe5872d authored by Nathan Lynch's avatar Nathan Lynch Committed by Greg Kroah-Hartman

powerpc/numa: improve control of topology updates

[ Upstream commit 2d4d9b30 ]

When booted with "topology_updates=no", or when "off" is written to
/proc/powerpc/topology_updates, NUMA reassignments are inhibited for
PRRN and VPHN events. However, migration and suspend unconditionally
re-enable reassignments via start_topology_update(). This is
incoherent.

Check the topology_updates_enabled flag in
start/stop_topology_update() so that callers of those APIs need not be
aware of whether reassignments are enabled. This allows the
administrative decision on reassignments to remain in force across
migrations and suspensions.
Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5f67ca2a
...@@ -1574,6 +1574,9 @@ int start_topology_update(void) ...@@ -1574,6 +1574,9 @@ int start_topology_update(void)
{ {
int rc = 0; int rc = 0;
if (!topology_updates_enabled)
return 0;
if (firmware_has_feature(FW_FEATURE_PRRN)) { if (firmware_has_feature(FW_FEATURE_PRRN)) {
if (!prrn_enabled) { if (!prrn_enabled) {
prrn_enabled = 1; prrn_enabled = 1;
...@@ -1603,6 +1606,9 @@ int stop_topology_update(void) ...@@ -1603,6 +1606,9 @@ int stop_topology_update(void)
{ {
int rc = 0; int rc = 0;
if (!topology_updates_enabled)
return 0;
if (prrn_enabled) { if (prrn_enabled) {
prrn_enabled = 0; prrn_enabled = 0;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -1648,11 +1654,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf, ...@@ -1648,11 +1654,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf,
kbuf[read_len] = '\0'; kbuf[read_len] = '\0';
if (!strncmp(kbuf, "on", 2)) if (!strncmp(kbuf, "on", 2)) {
topology_updates_enabled = true;
start_topology_update(); start_topology_update();
else if (!strncmp(kbuf, "off", 3)) } else if (!strncmp(kbuf, "off", 3)) {
stop_topology_update(); stop_topology_update();
else topology_updates_enabled = false;
} else
return -EINVAL; return -EINVAL;
return count; return count;
...@@ -1667,9 +1675,7 @@ static const struct file_operations topology_ops = { ...@@ -1667,9 +1675,7 @@ static const struct file_operations topology_ops = {
static int topology_update_init(void) static int topology_update_init(void)
{ {
/* Do not poll for changes if disabled at boot */ start_topology_update();
if (topology_updates_enabled)
start_topology_update();
if (!proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops)) if (!proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops))
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment