From: Thomas Gleixner <tglx@linutronix.de>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>,
Peter Zijlstra <peterz@infradead.org>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>
Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: Re: [PATCH 1/3] cpu/hotplug: Make HOTPLUG_PARALLEL independent of HOTPLUG_SMT
Date: Wed, 10 Jul 2024 22:51:42 +0200 [thread overview]
Message-ID: <87le29ug0x.ffs@tglx> (raw)
In-Reply-To: <20240705-loongarch-hotplug-v1-1-67d9c4709aa9@flygoat.com>
On Fri, Jul 05 2024 at 11:29, Jiaxun Yang wrote:
>
> +#ifdef CONFIG_HOTPLUG_SMT
> static inline bool cpuhp_smt_aware(void)
> {
> return cpu_smt_max_threads > 1;
> @@ -1817,6 +1818,7 @@ static inline const struct cpumask *cpuhp_get_primary_thread_mask(void)
> {
> return cpu_primary_thread_mask;
> }
> +#endif
Please provide stub functions in an #else clause
#else
static inline bool cpuhp_smt_aware(void) { return false; }
static inline cpumask *cpuhp_get_primary_thread_mask(void) { return NULL; }
#endif
or something to that effect.
> /*
> * On architectures which have enabled parallel bringup this invokes all BP
> @@ -1837,6 +1839,7 @@ static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus)
> if (!__cpuhp_parallel_bringup)
> return false;
>
> +#ifdef CONFIG_HOTPLUG_SMT
That way you spare the ugly #ifdef here in the middle of the code and
the compiler can optimize it out.
> if (cpuhp_smt_aware()) {
> const struct cpumask *pmask = cpuhp_get_primary_thread_mask();
> static struct cpumask tmp_mask __initdata;
> @@ -1857,6 +1860,7 @@ static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus)
> cpumask_andnot(&tmp_mask, mask, pmask);
> mask = &tmp_mask;
> }
> +#endif
Thanks,
tglx
next prev parent reply other threads:[~2024-07-10 20:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 3:29 [PATCH 0/3] LoongArch: CPU parallel bring up Jiaxun Yang
2024-07-05 3:29 ` [PATCH 1/3] cpu/hotplug: Make HOTPLUG_PARALLEL independent of HOTPLUG_SMT Jiaxun Yang
2024-07-10 20:51 ` Thomas Gleixner [this message]
2024-07-05 3:29 ` [PATCH 2/3] cpu/hotplug: Weak fallback for arch_cpuhp_init_parallel_bringup Jiaxun Yang
2024-07-05 3:29 ` [PATCH 3/3] LoongArch: SMP: Implement parallel CPU bring up Jiaxun Yang
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=87le29ug0x.ffs@tglx \
--to=tglx@linutronix.de \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=peterz@infradead.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 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.