From: Michael Ellerman <mpe@ellerman.id.au>
To: Jiri Bohac <jbohac@suse.cz>,
"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Cc: Hari Bathini <hbathini@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, Pingfan Liu <piliu@redhat.com>,
Pingfan Liu <kernelfans@gmail.com>
Subject: Re: [RFC PATCH 5/5] powerpc/smp: Remap boot CPU onto core 0 if >= nr_cpu_ids
Date: Thu, 15 Feb 2024 00:12:13 +1100 [thread overview]
Message-ID: <87frxv6vgy.fsf@mail.lhotse> (raw)
In-Reply-To: <ZcZLEe1mQHXvh44Y@dwarf.suse.cz>
Jiri Bohac <jbohac@suse.cz> writes:
> On Tue, Jan 02, 2024 at 10:16:04AM +0530, Aneesh Kumar K.V wrote:
>> Michael Ellerman <mpe@ellerman.id.au> writes:
>>
>> ....
>>
>> > #ifdef CONFIG_PPC64
>> > int boot_cpu_hwid = -1;
>> > @@ -492,12 +493,26 @@ void __init smp_setup_cpu_maps(void)
>> > avail = !of_property_match_string(dn,
>> > "enable-method", "spin-table");
>> >
>> > - cpu = assign_threads(cpu, nthreads, avail, intserv);
>> > + if (boot_core_hwid >= 0) {
>> > + if (cpu == 0) {
>> > + pr_info("Skipping CPU node %pOF to allow for boot core.\n", dn);
>> > + cpu = nthreads;
>> > + continue;
>> > + }
>> >
>> > - if (cpu >= nr_cpu_ids) {
>> > + if (be32_to_cpu(intserv[0]) == boot_core_hwid) {
>> > + pr_info("Renumbered boot core %pOF to logical 0\n", dn);
>> > + assign_threads(0, nthreads, avail, intserv);
>> > + of_node_put(dn);
>> > + break;
>> >
>>
>> I was expecting a 'continue' here. Why 'break' the loop? The condition that
>> should break the loop should be cpu >= nr_cpu_ids
>
> No, the patch seems correct:
>
> We're in the "if (boot_core_hwid >= 0)" branch, meaning that it
> was determined by early_init_dt_scan_cpus() that boot_cpuid >=
> nr_cpu_ids. So we loop until we get to the boot CPU, so it can be
> renumbered to 0. Once we do that we break, because we
> know we are already past nr_cpu_ids - otherwise boot_core_hwid
> would not be >= 0.
Yes that's exactly right.
Thanks for answering for me (was on leave and still catching up).
cheers
next prev parent reply other threads:[~2024-02-14 13:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-29 12:01 [RFC PATCH 1/5] powerpc/smp: Adjust nr_cpu_ids to cover all threads of a core Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 2/5] powerpc/smp: Increase nr_cpu_ids to include the boot CPU Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 3/5] powerpc/smp: Lookup avail once per device tree node Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 4/5] powerpc/smp: Factor out assign_threads() Michael Ellerman
2024-01-02 4:34 ` Aneesh Kumar K.V
2024-02-14 13:10 ` Michael Ellerman
2023-12-29 12:01 ` [RFC PATCH 5/5] powerpc/smp: Remap boot CPU onto core 0 if >= nr_cpu_ids Michael Ellerman
2023-12-29 12:07 ` Michael Ellerman
2024-01-02 0:51 ` Pingfan Liu
2024-02-13 20:16 ` Wen Xiong
2024-01-02 4:46 ` Aneesh Kumar K.V
2024-02-09 15:56 ` Jiri Bohac
2024-02-14 13:12 ` Michael Ellerman [this message]
2024-02-15 13:00 ` [RFC PATCH 1/5] powerpc/smp: Adjust nr_cpu_ids to cover all threads of a core Michael Ellerman
2024-02-16 2:42 ` Pingfan Liu
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=87frxv6vgy.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=aneesh.kumar@kernel.org \
--cc=hbathini@linux.ibm.com \
--cc=jbohac@suse.cz \
--cc=kernelfans@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=piliu@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.