From: Sudeep Holla <sudeep.holla@arm.com>
To: "Zengtao (B)" <prime.zeng@hisilicon.com>
Cc: Linuxarm <linuxarm@huawei.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] cpu-topology: Skip the exist but not possible cpu nodes
Date: Mon, 13 Jan 2020 12:21:01 +0000 [thread overview]
Message-ID: <20200113122101.GA49933@bogus> (raw)
In-Reply-To: <678F3D1BB717D949B966B68EAEB446ED340E41D1@DGGEMM506-MBX.china.huawei.com>
On Mon, Jan 13, 2020 at 12:06:11PM +0000, Zengtao (B) wrote:
> > -----Original Message-----
> > From: Sudeep Holla [mailto:sudeep.holla@arm.com]
> > Sent: Monday, January 13, 2020 6:19 PM
> > To: Zengtao (B)
> > Cc: Linuxarm; Greg Kroah-Hartman; Rafael J. Wysocki; Sudeep Holla;
> > linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v2] cpu-topology: Skip the exist but not possible cpu
> > nodes
> >
> > On Sat, Jan 11, 2020 at 02:53:40PM +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.
> > > With CONFIG_NR_CPUS = 128 and cpus nodes num in device tree is
> > 130,
> > > The following warning messages will be print during boot:
> > > CPU node for /cpus/cpu@128 exist but the possible cpu range
> > is :0-127
> > > CPU node for /cpus/cpu@129 exist but the possible cpu range
> > is :0-127
> > > CPU node for /cpus/cpu@130 exist but the possible cpu range
> > is :0-127
> > >
> > > Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
> > > ---
> > > Changelog:
> > > 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 | 37
> > +++++++++++++++++++++++++++++--------
> > > 1 file changed, 29 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/base/arch_topology.c
> > b/drivers/base/arch_topology.c
> > > index 5fe44b3..01f0e21 100644
> > > --- a/drivers/base/arch_topology.c
> > > +++ b/drivers/base/arch_topology.c
> > > @@ -248,22 +248,44 @@ 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 totally 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.
> >
> > s/ENDEV/ENODEV/
> Good catch, thanks.
>
> >
> > Also as I mentioned earlier, I prefer not to add any extra logic here
> > other than the above comment to make it explicit. This triggers
> > unnecessary
> > warnings when someone boots with limited CPUs for valid reasons.
> >
>
> So , what 's your suggestion here? Just keep the comments but remove
> the warning message print?
Yes for all the "found" logic. I am fine to update the existing err
> >
> > > + * (3) -EINVAL when other errors occur.
> > > + */
> > > static int __init get_cpu_for_node(struct device_node *node)
> > > {
> > > - struct device_node *cpu_node;
> > > + struct device_node *cpu_node, *t;
> > > int cpu;
> > > + bool found = false;
> > >
> > > cpu_node = of_parse_phandle(node, "cpu", 0);
> > > if (!cpu_node)
> > > - return -1;
> > > + return -EINVAL;
> > > +
> > > + for_each_of_cpu_node(t)
> > > + if (t == cpu_node) {
> > > + found = true;
> > > + break;
> > > + }
> > > +
> > > + if (!found) {
> > > + pr_crit("Unable to find CPU node for %pOF\n", cpu_node);
> > > + return -EINVAL;
> > > + }
Drop all the above change.
> > >
> > > cpu = of_cpu_node_to_id(cpu_node);
> > > if (cpu >= 0)
> > > topology_parse_cpu_capacity(cpu_node, cpu);
You can add here: else if (cpu == -ENODEV)
pr_info(...whatever you have below..)
Other things as is. Warning may be too harsh if one is running with
reduced number of CPUs.
> > > else
> > > - pr_crit("Unable to find CPU node for %pOF\n", cpu_node);
> > > + pr_warn("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);
> >
> > Why is this dropped ?
>
> It's unnecessary here since no one get the node ref.
>
Please read the description of of_parse_phandle. If you find other
issues with existing code, address it in separate patch and don't mix
with the issue in $subject.
--
Regards,
Sudeep
next prev parent reply other threads:[~2020-01-13 12:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-11 6:53 [PATCH v2] cpu-topology: Skip the exist but not possible cpu nodes Zeng Tao
2020-01-13 10:19 ` Sudeep Holla
2020-01-13 12:06 ` Zengtao (B)
2020-01-13 12:21 ` Sudeep Holla [this message]
2020-01-14 1:42 ` Zengtao (B)
2020-01-14 10:29 ` Sudeep Holla
2020-01-14 12:17 ` Zengtao (B)
2020-01-14 14:48 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200113122101.GA49933@bogus \
--to=sudeep.holla@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=prime.zeng@hisilicon.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox