Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2225797imm; Thu, 18 Oct 2018 11:00:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV63CJyz6ZcVr/Y7OLro2/qQHAMvrWdzg54iCO7P92CeTtcDecfuLUQmgmopMYWoRk756EngQ X-Received: by 2002:a17:902:e111:: with SMTP id cc17-v6mr30841588plb.175.1539885645285; Thu, 18 Oct 2018 11:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885645; cv=none; d=google.com; s=arc-20160816; b=yq5s2YrPgaT4Yex6K2sgar+2cuWyaPvpm+38Kxqxmx7pv9ds8wuI2i3vICxRyY+65i 2o30sLS5dplS6sUy3h8dBuLMK+pE8hPD0DR6o/W8gv5dsCEN2DoOo819Fl1JzCPxkAUp TeI7+Evg48/DXh1+cYrVt45/FG0bUE9wNQOMjy9RYxXE+9yTlg3+dVYx2XoD733cZqhb wISOIbXRFx5r/6Qu6pgzV7LCUi0rVDu6uViquxOPSzJS+SL8i2MxubNyLB/pv7bfUm5R Da2nr+yMJleNzTap4+//dh1XclYBZgyMU+WXOBQ99y3ZoQmKaes305ys62gR2y02Jvfi J4VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q7mohftozWwiS1fxZCGrXElMJD5R/SE57xDbeSSYb0E=; b=AFsgh+i3WvQSYaANLJUaNrVLnOHQGD8/qNBNaoLU1C1qekHkSzYRfhfADSjNib6GlQ fOhyCMyt9q6cPAFpyfcX9hsup5IxjQF7dvNdr161WzfRoGkExOkBuiatbZDAWuFqCgCZ 539HK+Z1Cz46/DQ6UWXIV3Cwi22r9ukkUyY+0fE4morbbBXfWLIit+YEO2+C2jcFM6bs x/ul9KwpgCixGyPQJiVvqHdn2PvDj7kAGGo7K1jM2ehti49HNZwdt0eUllwJkb5xVRDa GJUmmL9IOkVlM5oVIvWMeLw+D7BgoPWcUDfne3rFb4QcLF4CPXqSa/pogDZKL5zoChU5 ImmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="BmvbM/n9"; 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 l14-v6si20433762pfo.118.2018.10.18.11.00.29; Thu, 18 Oct 2018 11:00:45 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b="BmvbM/n9"; 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 S1729197AbeJSCBZ (ORCPT + 99 others); Thu, 18 Oct 2018 22:01:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:49082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728438AbeJSCBY (ORCPT ); Thu, 18 Oct 2018 22:01:24 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4524421473; Thu, 18 Oct 2018 17:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885559; bh=B7UFHkokjjPNiSVD8SAc/uX9onBGmI8cn6jXCmG7yBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmvbM/n9RCAx/AElMLxaFWoALt3DveIRGr0D2cwOfwNWTvTxVnVZg3xr7q1qqgH46 bBPHPGQ8GmGwsvYbgqo1ukjHouGO7DLc/NIS4icOlGYj836/dwxOPuKwEMBHKsm+pC ngg0IpahNa/WVDUUiTblvfqSaUWya9oqve87Y+Yo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srikar Dronamraju , Michael Ellerman , Sasha Levin Subject: [PATCH 4.18 47/53] powerpc/numa: Use associativity if VPHN hcall is successful Date: Thu, 18 Oct 2018 19:54:40 +0200 Message-Id: <20181018175424.614074034@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175416.561567978@linuxfoundation.org> References: <20181018175416.561567978@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srikar Dronamraju [ Upstream commit 2483ef056f6e42f61cd266452e2841165dfe1b5c ] Currently associativity is used to lookup node-id even if the preceding VPHN hcall failed. However this can cause CPU to be made part of the wrong node, (most likely to be node 0). This is because VPHN is not enabled on KVM guests. With 2ea6263 ("powerpc/topology: Get topology for shared processors at boot"), associativity is used to set to the wrong node. Hence KVM guest topology is broken. For example : A 4 node KVM guest before would have reported. [root@localhost ~]# numactl -H available: 4 nodes (0-3) node 0 cpus: 0 1 2 3 node 0 size: 1746 MB node 0 free: 1604 MB node 1 cpus: 4 5 6 7 node 1 size: 2044 MB node 1 free: 1765 MB node 2 cpus: 8 9 10 11 node 2 size: 2044 MB node 2 free: 1837 MB node 3 cpus: 12 13 14 15 node 3 size: 2044 MB node 3 free: 1903 MB node distances: node 0 1 2 3 0: 10 40 40 40 1: 40 10 40 40 2: 40 40 10 40 3: 40 40 40 10 Would now report: [root@localhost ~]# numactl -H available: 4 nodes (0-3) node 0 cpus: 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 node 0 size: 1746 MB node 0 free: 1244 MB node 1 cpus: node 1 size: 2044 MB node 1 free: 2032 MB node 2 cpus: 1 node 2 size: 2044 MB node 2 free: 2028 MB node 3 cpus: node 3 size: 2044 MB node 3 free: 2032 MB node distances: node 0 1 2 3 0: 10 40 40 40 1: 40 10 40 40 2: 40 40 10 40 3: 40 40 40 10 Fix this by skipping associativity lookup if the VPHN hcall failed. Fixes: 2ea626306810 ("powerpc/topology: Get topology for shared processors at boot") Signed-off-by: Srikar Dronamraju Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/mm/numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -1204,7 +1204,9 @@ int find_and_online_cpu_nid(int cpu) int new_nid; /* Use associativity from first thread for all siblings */ - vphn_get_associativity(cpu, associativity); + if (vphn_get_associativity(cpu, associativity)) + return cpu_to_node(cpu); + new_nid = associativity_to_nid(associativity); if (new_nid < 0 || !node_possible(new_nid)) new_nid = first_online_node;