Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5144902ybl; Tue, 14 Jan 2020 04:19:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzpSL8Q3QmgZwut4Il9+c+DJqKc1ZZgUGpL4aqVmZvjXQ+dKgDGYq34IA5ho9FrrvUXnzfU X-Received: by 2002:aca:ec4f:: with SMTP id k76mr15771068oih.156.1579004364767; Tue, 14 Jan 2020 04:19:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579004364; cv=none; d=google.com; s=arc-20160816; b=xeIEoFiuCy0YpZIRXllpNiChlwlepTQMvZTY/U4q4JVnC79IDD10rUAhoa3CWp7erd i8/v8MzxobDeSbfIDMhd9a7mJiuoGgWkAfPqqZ3yzeNpaEVZIWA3TJuCvNxQttL7jdYN YDd8w/WxYKMrSV7qUs7YS3M0zV2jTXmU3RaYwEVQVLODqYyGbQHvt+LWh00qWrWfped9 g8HH5OTFOOZ1biB8qqEvimQbisssncxVTB/CXI9GJXVN279acHHwLWanuf29AMbDzFOi SshOpxhCDakUBzRJCnneL5TTHskHGZanhQD3JbET47qq4l3GiU+YSPq2k3R5oZuuD/ms rblQ== 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=o8VIz6lkEuBRcpcXCErVAC8pF9/BBwwQwMtdIEA1jZE=; b=jskDLw5UAc4c+jPSNKvECyjYZJyF9Es21rEGiVmhZTeqCEhqN5fyunjJTZ5zUxhj9H 2L9QCa0SnEGRrwTW3grAaFNdrhdAH1DxmE/O4pB74tqm4UAbVvUNPQhL90eEPDD/tNfm Nhk9952d7/sPde0isgsXQR98TEYYAO0T8KB2s9P0A85CqlUfaW/BNCMTKNrrQdbFy/4X p1uSoTjGmaG6RujFaPyLs9TvHysWBTICqYtOm4JN46AfY2dZpWbH9rbvE58J2DkP2ule lwlucA3ldgoh8k8itRpzPdQr09gem7dXgxWHLHFaUWYq9+qElxDQihAbFFMlizhXr5Dg 5nsQ== 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 a9si7325667oid.132.2020.01.14.04.19.11; Tue, 14 Jan 2020 04:19:24 -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 S1729397AbgANMR5 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 14 Jan 2020 07:17:57 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:2924 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726053AbgANMR5 (ORCPT ); Tue, 14 Jan 2020 07:17:57 -0500 Received: from DGGEMM403-HUB.china.huawei.com (unknown [172.30.72.53]) by Forcepoint Email with ESMTP id E191FB3B85A07F6F6CD0; Tue, 14 Jan 2020 20:17:50 +0800 (CST) Received: from DGGEMM423-HUB.china.huawei.com (10.1.198.40) by DGGEMM403-HUB.china.huawei.com (10.3.20.211) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jan 2020 20:17:50 +0800 Received: from DGGEMM506-MBX.china.huawei.com ([169.254.3.174]) by dggemm423-hub.china.huawei.com ([10.1.198.40]) with mapi id 14.03.0439.000; Tue, 14 Jan 2020 20:17:41 +0800 From: "Zengtao (B)" To: Sudeep Holla CC: Linuxarm , Greg Kroah-Hartman , "Rafael J. Wysocki" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2] cpu-topology: Skip the exist but not possible cpu nodes Thread-Topic: [PATCH v2] cpu-topology: Skip the exist but not possible cpu nodes Thread-Index: AQHVyExqmWOdrHr7k0CDA2xXZLn68Kfn3yMAgAChbkD//4CPgIABXxGAgAAUOwCAAKNokA== Date: Tue, 14 Jan 2020 12:17:41 +0000 Message-ID: <678F3D1BB717D949B966B68EAEB446ED340E6EE9@DGGEMM506-MBX.china.huawei.com> References: <1578725620-39677-1-git-send-email-prime.zeng@hisilicon.com> <20200113101922.GE52694@bogus> <678F3D1BB717D949B966B68EAEB446ED340E41D1@DGGEMM506-MBX.china.huawei.com> <20200113122101.GA49933@bogus> <678F3D1BB717D949B966B68EAEB446ED340E59BA@DGGEMM506-MBX.china.huawei.com> <20200114102956.GB10403@bogus> In-Reply-To: <20200114102956.GB10403@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: Tuesday, January 14, 2020 6:30 PM > To: Zengtao (B) > Cc: Linuxarm; Greg Kroah-Hartman; Rafael J. Wysocki; > linux-kernel@vger.kernel.org; Sudeep Holla > Subject: Re: [PATCH v2] cpu-topology: Skip the exist but not possible cpu > nodes > > On Tue, Jan 14, 2020 at 01:42:25AM +0000, Zengtao (B) wrote: > > Could you help to explain here? > > I understand there are two abnormal cases: > > 1. The cpu node exist in the device tree, but not a possible cpu. > > This case can be caught by of_cpu_node_to_id's return value. > > Yes if of_cpu_node_to_id returns -ENODEV, it means there's no logical > CPU associated with this DT node. > > > 2. The cpu node does not exist. This case can be caught by above logic. > Or > > do you think of_parse_phandle's return value is enough? > > Again yes, there's nothing extra needed. > > The only change you need is to consider -ENODEV while handling the > case(1) > Thanks very much for your explanation. So finally it turns into a very simple patch like this, more cleaner: +/* + * 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) -ENDEV 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. + * (3) -1 if the node does not exist in the device tree + */ static int __init get_cpu_for_node(struct device_node *node) { struct device_node *cpu_node; @@ -261,7 +271,8 @@ static int __init get_cpu_for_node(struct device_node *node) if (cpu >= 0) topology_parse_cpu_capacity(cpu_node, cpu); else - pr_crit("Unable to find CPU node for %pOF\n", cpu_node); + pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n", + cpu_node, cpumask_pr_args(cpu_possible_mask)); of_node_put(cpu_node); return cpu; @@ -286,9 +297,8 @@ static int __init parse_core(struct device_node *core, int package_id, cpu_topology[cpu].package_id = package_id; cpu_topology[cpu].core_id = core_id; cpu_topology[cpu].thread_id = i; - } else { - pr_err("%pOF: Can't get CPU for thread\n", - t); + } else if (cpu != -ENODEV) { + pr_err("%pOF: Can't get CPU for thread\n", t); of_node_put(t); return -EINVAL; } @@ -307,7 +317,7 @@ static int __init parse_core(struct device_node *core, int package_id, cpu_topology[cpu].package_id = package_id; cpu_topology[cpu].core_id = core_id; - } else if (leaf) { + } else if (leaf && cpu != -ENODEV) { pr_err("%pOF: Can't get CPU for leaf core\n", core); return -EINVAL; } Any more suggestions? Regards Zengtao