Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8608953ybl; Thu, 16 Jan 2020 20:50:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzqZG6GtmXcjmlynGiFGLeMXHnLF3HZuCd3Ie/eO3eMgutA1mv4DImkj8YhOK5NLvq7pqa2 X-Received: by 2002:aca:33d5:: with SMTP id z204mr2054404oiz.120.1579236606139; Thu, 16 Jan 2020 20:50:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579236606; cv=none; d=google.com; s=arc-20160816; b=GuLknswusCvb/zG4ePioqGv7xmKEqo9Tz+0c/lUv7n9LEU4DrqjVnH8PRIAZnD28CK yZ+x0fJIh9xunA9XRblE/+k8LmDerTvGMA7AThVFu7Z2syGAbJm+klEbQJ9D6eEtr4S6 SDcyqe4BQClt58ip/jL4+Gb8JgqQ2QL4vjkLV4Q7tfbxq2aikNujkVOV5XWEA/SutBTF /q4WpZZOT3nxGqzWbhpjuNRwyVX6vSU2ZA4GzNQa2YjYTiWZkItb8O3aQG3RkxPVPur6 e2aAhPps0PQfR0GhmB7vABwZMuTURhxF3gn9mlFylysNZJX2R/p/789Dk9LjUOrcy7KB pG0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=KYOk3uYP/AhckWSWvxrqgd30KKN0ZRzUuop57Aw4Ju8=; b=IkE4o063xXlDMoyJi9miRbeOuqpusNR0h5s1MIvrjxfBlJaTZ0uomifsqUG3ZoC7Sy DkEtPmqM1KRF5sdrEpoGYbKj1qVDiJc1TBEsKsSmC8B5CYSZPzEmV82FA/qc2umfkuZV TpNLAg8m+zD56/pGM6jYGalvsievgHEzZv1RmuDXvjFk1DwejXS3ILFYcgVMLKdrAGx/ 69n6Kq2ghGGGQ2BFvIUsgu9kZdi8nBFnBxzYm+19OKyQQ38g8n/UFii62NYuMc/8S6tE khhUHEt9U7+T/VyJmQhTKeE5wI9VnLIzjDDyFVCvHZrfAMde6OFwL4B7hwNiIEOrEW4U sDgw== 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 i8si13823826otp.254.2020.01.16.20.49.54; Thu, 16 Jan 2020 20:50:06 -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 S2388293AbgAQBcn convert rfc822-to-8bit (ORCPT + 99 others); Thu, 16 Jan 2020 20:32:43 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:2991 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730070AbgAQBcn (ORCPT ); Thu, 16 Jan 2020 20:32:43 -0500 Received: from DGGEMM401-HUB.china.huawei.com (unknown [172.30.72.55]) by Forcepoint Email with ESMTP id 6C97B6AC903F5DAB9BDA; Fri, 17 Jan 2020 09:32:41 +0800 (CST) Received: from DGGEMM506-MBX.china.huawei.com ([169.254.3.174]) by DGGEMM401-HUB.china.huawei.com ([10.3.20.209]) with mapi id 14.03.0439.000; Fri, 17 Jan 2020 09:32:34 +0800 From: "Zengtao (B)" To: Sudeep Holla CC: Linuxarm , Greg Kroah-Hartman , "Rafael J. Wysocki" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v3] cpu-topology: Skip the exist but not possible cpu nodes Thread-Topic: [PATCH v3] cpu-topology: Skip the exist but not possible cpu nodes Thread-Index: AQHVzA+GWMm+RLGKHUGB0ShIe4jJg6fssZOAgAFbuYA= Date: Fri, 17 Jan 2020 01:32:33 +0000 Message-ID: <678F3D1BB717D949B966B68EAEB446ED340EFACC@DGGEMM506-MBX.china.huawei.com> References: <1579139255-29262-1-git-send-email-prime.zeng@hisilicon.com> <20200116122420.GA40666@bogus> In-Reply-To: <20200116122420.GA40666@bogus> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.74.221.187] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Sudeep Holla [mailto:sudeep.holla@arm.com] > Sent: Thursday, January 16, 2020 8:25 PM > To: Zengtao (B) > Cc: Linuxarm; Greg Kroah-Hartman; Rafael J. Wysocki; Sudeep Holla; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH v3] cpu-topology: Skip the exist but not possible cpu > nodes > > Sorry for being pedantic and not mentioning this earlier. Can you > improve > the $subject. I prefer: > > cpu-topology: Don't error on more than CONFIG_NR_CPUS CPUs in > device tree > > On Thu, Jan 16, 2020 at 09:47:35AM +0800, Zeng Tao wrote: > > When CONFIG_NR_CPUS is smaller than the cpu nodes defined in the > device > > tree, all the cpu nodes parsing will fail. > > And this is not reasonable for a legal device tree configs. > > In this patch, skip such cpu nodes rather than return an error. > > > > Also the commit log to be: > " > When the kernel is configured with CONFIG_NR_CPUS smaller than the > number of CPU nodes in the device tree(DT), all the CPU nodes parsing > done to fetch topology information will fail. This is not reasonable > as it is legal to have all the physical CPUs in the system in the DT. > > Let us just skip such CPU DT nodes that are not used in the kernel > rather than returning an error. > " > > Signed-off-by: Zeng Tao > > --- > > Changelog: > > v2->v3: > > -Fix the Review comments by sudeep, including fix typo, remove > redundant check > > logic, change the warning print level etc. > > v1->v2: > > -Remove redundant -ENODEV assignment in get_cpu_for_node > > -Add comment to describe the get_cpu_for_node return values > > -Add skip process for cpu threads > > -Update the commit log with more detail > > --- > > drivers/base/arch_topology.c | 20 +++++++++++++++----- > > 1 file changed, 15 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/base/arch_topology.c > b/drivers/base/arch_topology.c > > index 5fe44b3..d4302a1 100644 > > --- a/drivers/base/arch_topology.c > > +++ b/drivers/base/arch_topology.c > > @@ -248,6 +248,16 @@ core_initcall(free_raw_capacity); > > #endif > > > > #if defined(CONFIG_ARM64) || defined(CONFIG_RISCV) > > +/* > > + * This function returns the logic cpu number of the node. > > + * There are basically three kinds of return values: > > + * (1) logic cpu number which is > 0. > > + * (2) -ENODEV when the node is valid one which can be found in the > device tree > > + * but there is no possible cpu nodes to match, when the > CONFIG_NR_CPUS is > > + * smaller than cpus node numbers in device tree, this will happen. > It's > > + * suggested to just ignore this case. > > I prefer (2) to be reword as below: > " > -ENODEV when the device tree(DT) node is valid and found in the DT but > there is no possible logical CPU in the kernel to match. This happens > when CONFIG_NR_CPUS is configure to be smaller than the number of > CPU > nodes in DT. We need to just ignore this case. > " > > With all these changes you can stick: > Reviewed-by: Sudeep Holla > OK, I will take the above suggestions, thanks for the patience, ^_^ Regards Zengtao > -- > Regards, > Sudeep