]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/powerpc-numa-improve-control-of-topology-updates.patch
Linux 4.9.181
[thirdparty/kernel/stable-queue.git] / queue-4.4 / powerpc-numa-improve-control-of-topology-updates.patch
1 From 42b02c1f8b7584c6fcdd7cd458269c72464e64c3 Mon Sep 17 00:00:00 2001
2 From: Nathan Lynch <nathanl@linux.ibm.com>
3 Date: Thu, 18 Apr 2019 13:56:57 -0500
4 Subject: powerpc/numa: improve control of topology updates
5
6 [ Upstream commit 2d4d9b308f8f8dec68f6dbbff18c68ec7c6bd26f ]
7
8 When booted with "topology_updates=no", or when "off" is written to
9 /proc/powerpc/topology_updates, NUMA reassignments are inhibited for
10 PRRN and VPHN events. However, migration and suspend unconditionally
11 re-enable reassignments via start_topology_update(). This is
12 incoherent.
13
14 Check the topology_updates_enabled flag in
15 start/stop_topology_update() so that callers of those APIs need not be
16 aware of whether reassignments are enabled. This allows the
17 administrative decision on reassignments to remain in force across
18 migrations and suspensions.
19
20 Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
21 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
22 Signed-off-by: Sasha Levin <sashal@kernel.org>
23 ---
24 arch/powerpc/mm/numa.c | 18 ++++++++++++------
25 1 file changed, 12 insertions(+), 6 deletions(-)
26
27 diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
28 index bb3df222ae71f..215bff2b84703 100644
29 --- a/arch/powerpc/mm/numa.c
30 +++ b/arch/powerpc/mm/numa.c
31 @@ -1611,6 +1611,9 @@ int start_topology_update(void)
32 {
33 int rc = 0;
34
35 + if (!topology_updates_enabled)
36 + return 0;
37 +
38 if (firmware_has_feature(FW_FEATURE_PRRN)) {
39 if (!prrn_enabled) {
40 prrn_enabled = 1;
41 @@ -1640,6 +1643,9 @@ int stop_topology_update(void)
42 {
43 int rc = 0;
44
45 + if (!topology_updates_enabled)
46 + return 0;
47 +
48 if (prrn_enabled) {
49 prrn_enabled = 0;
50 #ifdef CONFIG_SMP
51 @@ -1685,11 +1691,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf,
52
53 kbuf[read_len] = '\0';
54
55 - if (!strncmp(kbuf, "on", 2))
56 + if (!strncmp(kbuf, "on", 2)) {
57 + topology_updates_enabled = true;
58 start_topology_update();
59 - else if (!strncmp(kbuf, "off", 3))
60 + } else if (!strncmp(kbuf, "off", 3)) {
61 stop_topology_update();
62 - else
63 + topology_updates_enabled = false;
64 + } else
65 return -EINVAL;
66
67 return count;
68 @@ -1704,9 +1712,7 @@ static const struct file_operations topology_ops = {
69
70 static int topology_update_init(void)
71 {
72 - /* Do not poll for changes if disabled at boot */
73 - if (topology_updates_enabled)
74 - start_topology_update();
75 + start_topology_update();
76
77 if (!proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops))
78 return -ENOMEM;
79 --
80 2.20.1
81