From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: "Nysal Jan K.A." <nysal@linux.ibm.com>
Cc: Tyrel Datwyler <tyreld@linux.ibm.com>,
Michal Suchanek <msuchanek@suse.de>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Laurent Dufour <ldufour@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Michael Ellerman <mpe@ellerman.id.au>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/2] powerpc/topology: Check if a core is online
Date: Tue, 25 Jun 2024 00:36:33 +0530 [thread overview]
Message-ID: <985e10dd-230b-4325-856f-1229361205d2@linux.ibm.com> (raw)
In-Reply-To: <20240612185046.1826891-3-nysal@linux.ibm.com>
On 6/13/24 12:20 AM, Nysal Jan K.A. wrote:
> From: "Nysal Jan K.A" <nysal@linux.ibm.com>
>
> topology_is_core_online() checks if the core a CPU belongs to
> is online. The core is online if at least one of the sibling
> CPUs is online. The first CPU of an online core is also online
> in the common case, so this should be fairly quick.
>
> Signed-off-by: Nysal Jan K.A <nysal@linux.ibm.com>
> ---
> arch/powerpc/include/asm/topology.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
> index f4e6f2dd04b7..16bacfe8c7a2 100644
> --- a/arch/powerpc/include/asm/topology.h
> +++ b/arch/powerpc/include/asm/topology.h
> @@ -145,6 +145,7 @@ static inline int cpu_to_coregroup_id(int cpu)
>
> #ifdef CONFIG_HOTPLUG_SMT
> #include <linux/cpu_smt.h>
> +#include <linux/cpumask.h>
Is this header file needed?
I don't see any reference to cpumask related code.
> #include <asm/cputhreads.h>
>
> static inline bool topology_is_primary_thread(unsigned int cpu)
> @@ -156,6 +157,18 @@ static inline bool topology_smt_thread_allowed(unsigned int cpu)
> {
> return cpu_thread_in_core(cpu) < cpu_smt_num_threads;
> }
> +
This is defined only if CONFIG_HOTPLUG_SMT is true. But this could be
generic function which might be used to check if a core is offline in other cases.
Would that make sense to keep it out of CONFIG_HOTPLUG_SMT ?
> +#define topology_is_core_online topology_is_core_online
> +static inline bool topology_is_core_online(unsigned int cpu)
> +{
> + int i, first_cpu = cpu_first_thread_sibling(cpu);
> +
> + for (i = first_cpu; i < first_cpu + threads_per_core; ++i) {
> + if (cpu_online(i))
> + return true;
> + }
> + return false;
> +}
> #endif
>
> #endif /* __KERNEL__ */
next prev parent reply other threads:[~2024-06-24 19:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 18:50 [PATCH 0/2] Skip offline cores when enabling SMT on PowerPC Nysal Jan K.A.
2024-06-12 18:50 ` [PATCH 1/2] cpu/SMT: Enable SMT only if a core is online Nysal Jan K.A.
2024-06-12 18:50 ` [PATCH 2/2] powerpc/topology: Check " Nysal Jan K.A.
2024-06-24 19:06 ` Shrikanth Hegde [this message]
2024-06-25 6:13 ` Nysal Jan K.A.
2024-06-13 11:34 ` [PATCH 0/2] Skip offline cores when enabling SMT on PowerPC Michael Ellerman
2024-06-13 12:07 ` Michal Suchánek
2024-06-14 3:52 ` Nysal Jan K.A.
2024-06-23 20:14 ` Thomas Gleixner
2024-06-24 19:11 ` Shrikanth Hegde
2024-06-24 21:24 ` Thomas Gleixner
2024-07-01 4:54 ` Shrikanth Hegde
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=985e10dd-230b-4325-856f-1229361205d2@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=ldufour@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.de \
--cc=naveen.n.rao@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=nysal@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tyreld@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox