Received: by 10.223.185.116 with SMTP id b49csp717142wrg; Wed, 21 Feb 2018 05:53:59 -0800 (PST) X-Google-Smtp-Source: AH8x227SHag5tij3Cykd1M3qHXuofDQUvxUK3/x3uBUQARTwSDlpr59/YVJ6WkQbBRgazi9EKtDN X-Received: by 10.98.93.87 with SMTP id r84mr3395914pfb.131.1519221239809; Wed, 21 Feb 2018 05:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221239; cv=none; d=google.com; s=arc-20160816; b=s1hHRjkb1A09hEryIfNhKomT14cb/kXLpjEYkkOXGI1bbBDlD/zjHc+sbbqbQxpfKM YBqMWud9fHbCvYlXl36j9MOxtOQfvCxm1diOM+QtIYirPDGOJcKipmKrxBKZaoWA/695 o635a6ZIr/xUw1H2h2pW+x2PTiT2gs3I41nn/amRu7TQWmhqxKL1eQLC4ducPJXiH6N9 KkwX/y4pdz/f39U4C2LSKfoWdb0L3Z469m4+Qo7hjk7gXezoc5KvlVK+jLYXzRC+uER1 haTqcHs8dnhfYAzC7RZtfhr1d4tFMZH+O+WbuTQtm2S31vRVGUkEFTGPnSNnwytGt2TV pU0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=C3jaJ0paLHn56W9dtPsfzFi7VEvF880VI2Y3grUG1gc=; b=VNL6ZyZkDf7W16Euj1MnSlD/E49tAQQLzWyQPj1vWkCe1j73+BplhKQAUsF2YPyb/f Rx+SEs5S5g4BO+QseaChJd6PP0HSRJyi2efIjFKRtVNCt3SGm1jswDQ1j5V6YStKxqsf DC2UXz9hb9QlTtO/C9lgSycTN3N5E3TPBqN7HKjCFNI/OQksffJPddTTfrRtr+IgKQHX r5Hq2t2pGNCFcJlCyl/78b00sfu7XEzQ4W5+gC5jCl8whk8SgQaDG6qrjypdyQMLSpnu +/yw2ZBvCVD0a2LG3UHdVlPzD6wRSWq7GkBejQYdh8WV8wVFWk5siMTQjitne8qMXzq7 1DhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si1719687plo.650.2018.02.21.05.53.44; Wed, 21 Feb 2018 05:53:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965297AbeBUNII (ORCPT + 99 others); Wed, 21 Feb 2018 08:08:08 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42060 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965286AbeBUNIF (ORCPT ); Wed, 21 Feb 2018 08:08:05 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9FB8F119B; Wed, 21 Feb 2018 13:08:04 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Fontenot , Tyrel Datwyler , Michael Ellerman Subject: [PATCH 4.15 022/163] powerpc/numa: Invalidate numa_cpu_lookup_table on cpu remove Date: Wed, 21 Feb 2018 13:47:31 +0100 Message-Id: <20180221124531.401530753@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nathan Fontenot commit 1d9a090783bef19fe8cdec878620d22f05191316 upstream. When DLPAR removing a CPU, the unmapping of the cpu from a node in unmap_cpu_from_node() should also invalidate the CPUs entry in the numa_cpu_lookup_table. There is not a guarantee that on a subsequent DLPAR add of the CPU the associativity will be the same and thus could be in a different node. Invalidating the entry in the numa_cpu_lookup_table causes the associativity to be read from the device tree at the time of the add. The current behavior of not invalidating the CPUs entry in the numa_cpu_lookup_table can result in scenarios where the the topology layout of CPUs in the partition does not match the device tree or the topology reported by the HMC. This bug looks like it was introduced in 2004 in the commit titled "ppc64: cpu hotplug notifier for numa", which is 6b15e4e87e32 in the linux-fullhist tree. Hence tag it for all stable releases. Cc: stable@vger.kernel.org Signed-off-by: Nathan Fontenot Reviewed-by: Tyrel Datwyler Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/topology.h | 5 +++++ arch/powerpc/mm/numa.c | 5 ----- arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) --- a/arch/powerpc/include/asm/topology.h +++ b/arch/powerpc/include/asm/topology.h @@ -44,6 +44,11 @@ extern int sysfs_add_device_to_node(stru extern void sysfs_remove_device_from_node(struct device *dev, int nid); extern int numa_update_cpu_topology(bool cpus_locked); +static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node) +{ + numa_cpu_lookup_table[cpu] = node; +} + static inline int early_cpu_to_node(int cpu) { int nid; --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -142,11 +142,6 @@ static void reset_numa_cpu_lookup_table( numa_cpu_lookup_table[cpu] = -1; } -static void update_numa_cpu_lookup_table(unsigned int cpu, int node) -{ - numa_cpu_lookup_table[cpu] = node; -} - static void map_cpu_to_node(int cpu, int node) { update_numa_cpu_lookup_table(cpu, node); --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "pseries.h" #include "offline_states.h" @@ -331,6 +332,7 @@ static void pseries_remove_processor(str BUG_ON(cpu_online(cpu)); set_cpu_present(cpu, false); set_hard_smp_processor_id(cpu, -1); + update_numa_cpu_lookup_table(cpu, -1); break; } if (cpu >= nr_cpu_ids)