From patchwork Mon Dec 23 08:16:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zeng Tao X-Patchwork-Id: 182373 Delivered-To: patch@linaro.org Received: by 2002:a92:a146:0:0:0:0:0 with SMTP id v67csp135160ili; Mon, 23 Dec 2019 00:21:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzQoOgmjhF0eKLRxZrXqQ/yfM5wJ4jonWTyHjyO91xeOftNWJODMWiQi23ArrX4tgUzDMyd X-Received: by 2002:a9d:7cd0:: with SMTP id r16mr32468011otn.50.1577089276932; Mon, 23 Dec 2019 00:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577089276; cv=none; d=google.com; s=arc-20160816; b=G2/zyIQ3WgHNe2/xyV/v84KpEao4tzAn2xNIY6OCPYJJZBL4elgDyJSIofQk3lpkIe +mkufZ77W1lp1i8fn/If2cGiCIaud372kQ4aeinBFfm7ZOtLmQ8jNcQGQPvWWXBp5D9D st0r2XM3tmjJdhNvg3b2Fu0ap1qSnbKLY6taU5GOK0Dqls52CbiNesuE3XcBHOaYa0O2 xsRcnHAHnzZpoE6Zg9LW8LHXKCKo+XAERi0YoInTzKY81q4Zr3XsPbSLkKzMUFQfBoUk 7xOP9x6Z9FIa1qhC0c93fMo0nO01n7oN8zqxG7I3GNArc2fwSUB1aFaT8qZ+GCEBH0kN iBIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=qSrAaCKJejQWFV2mVg6xtulL+CcAortkpKAjBxBmk/8=; b=HUbZVefPZWxr3Eq0eg5rU0RvxpPiXpnO9nABKqtk2O2IuPe97TTsEnRUKyIdwtKLcZ NnGLgbGK7rv8cIp1B5aRx1orHtimefijbiYo98CXEInhKBQ+IX8ga263jU9uHVOg+Pfc 84n4FFC+W+QoG5IVZvwkoWitZ3mxE5wBQVqpTmH/ScmAbloHwCebBx/Vi40djI46FjIb +cpKetDfMnITMtEN4tHkGZxqKVr3plPYyPU/01z3h8Uwap/R8vX/W/BjF3PB3QQDfVbW xEAMkg2z2YOJ5ZomnLJ+7qldkVYkjWavzeT7/WlEGOAMUYZVhJ3GCCbXtvgJO7bK/7oh aNTw== 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 f25si9899945oti.84.2019.12.23.00.21.16; Mon, 23 Dec 2019 00:21:16 -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 S1726833AbfLWIVP (ORCPT + 27 others); Mon, 23 Dec 2019 03:21:15 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:35798 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726691AbfLWIVM (ORCPT ); Mon, 23 Dec 2019 03:21:12 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 76E6D5F1FED0821E5F97; Mon, 23 Dec 2019 16:21:06 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Mon, 23 Dec 2019 16:20:59 +0800 From: z00214469 To: CC: , z00214469 , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , Subject: [PATCH] cpu-topology: warn if NUMA configurations conflicts with lower layer Date: Mon, 23 Dec 2019 16:16:19 +0800 Message-ID: <1577088979-8545-1-git-send-email-prime.zeng@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we know, from sched domain's perspective, the DIE layer should be larger than or at least equal to the MC layer, and in some cases, MC is defined by the arch specified hardware, MPIDR for example, but NUMA can be defined by users, with the following system configrations: ************************************* NUMA: 0-2, 3-7 core_siblings: 0-3, 4-7 ************************************* Per the current code, for core 3, its MC cpu map fallbacks to 3~7(its core_sibings is 0~3 while its numa node map is 3~7). For the sched MC, when we are build sched groups: step1. core3 's sched groups chain is built like this: 3->4->5->6->7->3 step2. core4's sched groups chain is built like this: 4->5->6->7->4 so after step2, core3's sched groups for MC level is overlapped, more importantly, it will fall to dead loop if while(sg != sg->groups) Obviously, the NUMA node with cpu 3-7 conflict with the MC level cpu map, but unfortunately, there is no way even detect such cases. In this patch, prompt a warning message to help with the above cases. Signed-off-by: Zeng Tao --- drivers/base/arch_topology.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.8.1 diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 1eb81f11..5fe44b3 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -439,10 +439,18 @@ const struct cpumask *cpu_coregroup_mask(int cpu) if (cpumask_subset(&cpu_topology[cpu].core_sibling, core_mask)) { /* not numa in package, lets use the package siblings */ core_mask = &cpu_topology[cpu].core_sibling; - } + } else + pr_warn_once("Warning: suspicous broken topology: cpu:[%d]'s core_sibling:[%*pbl] not a subset of numa node:[%*pbl]\n", + cpu, cpumask_pr_args(&cpu_topology[cpu].core_sibling), + cpumask_pr_args(core_mask)); + if (cpu_topology[cpu].llc_id != -1) { if (cpumask_subset(&cpu_topology[cpu].llc_sibling, core_mask)) core_mask = &cpu_topology[cpu].llc_sibling; + else + pr_warn_once("Warning: suspicous broken topology: cpu:[%d]'s llc_sibling:[%*pbl] not a subset of numa node:[%*pbl]\n", + cpu, cpumask_pr_args(&cpu_topology[cpu].llc_sibling), + cpumask_pr_args(core_mask)); } return core_mask;