stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.4 05/16] cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs
Date: Tue,  5 Sep 2017 09:09:55 +0200	[thread overview]
Message-ID: <20170905070904.691970407@linuxfoundation.org> (raw)
In-Reply-To: <20170905070904.465037171@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tejun Heo <tj@kernel.org>

commit b339752d054fb32863418452dff350a1086885b1 upstream.

When !NUMA, cpumask_of_node(@node) equals cpu_online_mask regardless of
@node.  The assumption seems that if !NUMA, there shouldn't be more than
one node and thus reporting cpu_online_mask regardless of @node is
correct.  However, that assumption was broken years ago to support
DISCONTIGMEM and whether a system has multiple nodes or not is
separately controlled by NEED_MULTIPLE_NODES.

This means that, on a system with !NUMA && NEED_MULTIPLE_NODES,
cpumask_of_node() will report cpu_online_mask for all possible nodes,
indicating that the CPUs are associated with multiple nodes which is an
impossible configuration.

This bug has been around forever but doesn't look like it has caused any
noticeable symptoms.  However, it triggers a WARN recently added to
workqueue to verify NUMA affinity configuration.

Fix it by reporting empty cpumask on non-zero nodes if !NUMA.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/asm-generic/topology.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -48,7 +48,11 @@
 #define parent_node(node)	((void)(node),0)
 #endif
 #ifndef cpumask_of_node
-#define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #ifdef CONFIG_NEED_MULTIPLE_NODES
+    #define cpumask_of_node(node)	((node) == 0 ? cpu_online_mask : cpu_none_mask)
+  #else
+    #define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #endif
 #endif
 #ifndef pcibus_to_node
 #define pcibus_to_node(bus)	((void)(bus), -1)

  parent reply	other threads:[~2017-09-05  7:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05  7:09 [PATCH 4.4 00/16] 4.4.87-stable review Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 01/16] irqchip: mips-gic: SYNC after enabling GIC region Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 02/16] i2c: ismt: Dont duplicate the receive length for block reads Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 03/16] i2c: ismt: Return EMSGSIZE for block reads with bogus length Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 04/16] ceph: fix readpage from fscache Greg Kroah-Hartman
2017-09-05  7:09 ` Greg Kroah-Hartman [this message]
2017-09-05  7:09 ` [PATCH 4.4 06/16] cpuset: Fix incorrect memory_pressure control file mapping Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 07/16] alpha: uapi: Add support for __SANE_USERSPACE_TYPES__ Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 08/16] CIFS: Fix maximum SMB2 header size Greg Kroah-Hartman
2017-09-05  7:09 ` [PATCH 4.4 09/16] CIFS: remove endian related sparse warning Greg Kroah-Hartman
2017-09-05  7:10 ` [PATCH 4.4 10/16] wl1251: add a missing spin_lock_init() Greg Kroah-Hartman
2017-09-05  7:10 ` [PATCH 4.4 11/16] xfrm: policy: check policy direction value Greg Kroah-Hartman
2017-09-05  7:10 ` [PATCH 4.4 14/16] kvm: arm/arm64: Force reading uncached stage2 PGD Greg Kroah-Hartman
2017-09-05  7:10 ` [PATCH 4.4 16/16] crypto: algif_skcipher - only call put_page on referenced and used pages Greg Kroah-Hartman
2017-09-05 16:47 ` [PATCH 4.4 00/16] 4.4.87-stable review Guenter Roeck
2017-09-05 17:12 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170905070904.691970407@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).