From: Laurent Dufour <ldufour@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu, tglx@linutronix.de,
dave.hansen@linux.intel.com, mingo@redhat.com, bp@alien8.de
Subject: [PATCH v2 4/9] cpu/SMT: Remove topology_smt_supported()
Date: Wed, 28 Jun 2023 12:05:53 +0200 [thread overview]
Message-ID: <20230628100558.43482-5-ldufour@linux.ibm.com> (raw)
In-Reply-To: <20230628100558.43482-1-ldufour@linux.ibm.com>
Since the maximum number of threads is now passed to
cpu_smt_set_num_threads(), checking that value is enough to know if SMT is
supported.
Cc: Michael Ellerman <mpe@ellerman.id.au>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
arch/x86/include/asm/topology.h | 2 --
arch/x86/kernel/smpboot.c | 8 --------
kernel/cpu.c | 2 +-
3 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 66927a59e822..87358a8fe843 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -143,7 +143,6 @@ int topology_update_die_map(unsigned int dieid, unsigned int cpu);
int topology_phys_to_logical_pkg(unsigned int pkg);
int topology_phys_to_logical_die(unsigned int die, unsigned int cpu);
bool topology_is_primary_thread(unsigned int cpu);
-bool topology_smt_supported(void);
#else
#define topology_max_packages() (1)
static inline int
@@ -156,7 +155,6 @@ static inline int topology_phys_to_logical_die(unsigned int die,
static inline int topology_max_die_per_package(void) { return 1; }
static inline int topology_max_smt_threads(void) { return 1; }
static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
-static inline bool topology_smt_supported(void) { return false; }
#endif
static inline void arch_fix_phys_package_id(int num, u32 slot)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 352f0ce1ece4..3052c171668d 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -278,14 +278,6 @@ bool topology_is_primary_thread(unsigned int cpu)
return apic_id_is_primary_thread(per_cpu(x86_cpu_to_apicid, cpu));
}
-/**
- * topology_smt_supported - Check whether SMT is supported by the CPUs
- */
-bool topology_smt_supported(void)
-{
- return smp_num_siblings > 1;
-}
-
/**
* topology_phys_to_logical_pkg - Map a physical package id to a logical
*
diff --git a/kernel/cpu.c b/kernel/cpu.c
index edca8b7bd400..e354af92b2b8 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -442,7 +442,7 @@ void __init cpu_smt_set_num_threads(unsigned int num_threads,
{
WARN_ON(!num_threads || (num_threads > max_threads));
- if (!topology_smt_supported())
+ if (max_threads == 1)
cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
cpu_smt_max_threads = max_threads;
--
2.41.0
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Dufour <ldufour@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: linux-arch@vger.kernel.org, dave.hansen@linux.intel.com,
linux-kernel@vger.kernel.org, mingo@redhat.com, bp@alien8.de,
npiggin@gmail.com, tglx@linutronix.de
Subject: [PATCH v2 4/9] cpu/SMT: Remove topology_smt_supported()
Date: Wed, 28 Jun 2023 12:05:53 +0200 [thread overview]
Message-ID: <20230628100558.43482-5-ldufour@linux.ibm.com> (raw)
In-Reply-To: <20230628100558.43482-1-ldufour@linux.ibm.com>
Since the maximum number of threads is now passed to
cpu_smt_set_num_threads(), checking that value is enough to know if SMT is
supported.
Cc: Michael Ellerman <mpe@ellerman.id.au>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
arch/x86/include/asm/topology.h | 2 --
arch/x86/kernel/smpboot.c | 8 --------
kernel/cpu.c | 2 +-
3 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 66927a59e822..87358a8fe843 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -143,7 +143,6 @@ int topology_update_die_map(unsigned int dieid, unsigned int cpu);
int topology_phys_to_logical_pkg(unsigned int pkg);
int topology_phys_to_logical_die(unsigned int die, unsigned int cpu);
bool topology_is_primary_thread(unsigned int cpu);
-bool topology_smt_supported(void);
#else
#define topology_max_packages() (1)
static inline int
@@ -156,7 +155,6 @@ static inline int topology_phys_to_logical_die(unsigned int die,
static inline int topology_max_die_per_package(void) { return 1; }
static inline int topology_max_smt_threads(void) { return 1; }
static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
-static inline bool topology_smt_supported(void) { return false; }
#endif
static inline void arch_fix_phys_package_id(int num, u32 slot)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 352f0ce1ece4..3052c171668d 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -278,14 +278,6 @@ bool topology_is_primary_thread(unsigned int cpu)
return apic_id_is_primary_thread(per_cpu(x86_cpu_to_apicid, cpu));
}
-/**
- * topology_smt_supported - Check whether SMT is supported by the CPUs
- */
-bool topology_smt_supported(void)
-{
- return smp_num_siblings > 1;
-}
-
/**
* topology_phys_to_logical_pkg - Map a physical package id to a logical
*
diff --git a/kernel/cpu.c b/kernel/cpu.c
index edca8b7bd400..e354af92b2b8 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -442,7 +442,7 @@ void __init cpu_smt_set_num_threads(unsigned int num_threads,
{
WARN_ON(!num_threads || (num_threads > max_threads));
- if (!topology_smt_supported())
+ if (max_threads == 1)
cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
cpu_smt_max_threads = max_threads;
--
2.41.0
next prev parent reply other threads:[~2023-06-28 10:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 10:05 [PATCH v2 0/9] Introduce SMT level and add PowerPC support Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 1/9] cpu/SMT: Move SMT prototypes into cpu_smt.h Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 2/9] cpu/SMT: Move smt/control simple exit cases earlier Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 3/9] cpu/SMT: Store the current/max number of threads Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour [this message]
2023-06-28 10:05 ` [PATCH v2 4/9] cpu/SMT: Remove topology_smt_supported() Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 5/9] cpu/SMT: Create topology_smt_thread_allowed() Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 6/9] cpu/SMT: Allow enabling partial SMT states via sysfs Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 16:09 ` kernel test robot
2023-06-28 10:05 ` [PATCH v2 7/9] powerpc/pseries: Initialise CPU hotplug callbacks earlier Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 8/9] powerpc: Add HOTPLUG_SMT support Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 10:05 ` [PATCH v2 9/9] powerpc/pseries: Honour current SMT state when DLPAR onlining CPUs Laurent Dufour
2023-06-28 10:05 ` Laurent Dufour
2023-06-28 15:33 ` [PATCH v2 0/9] Introduce SMT level and add PowerPC support Sachin Sant
2023-06-28 15:33 ` Sachin Sant
2023-06-29 11:10 ` Michael Ellerman
2023-06-29 11:10 ` Michael Ellerman
2023-06-29 12:04 ` Laurent Dufour
2023-06-29 12:04 ` Laurent Dufour
2023-06-29 13:31 ` Sachin Sant
2023-06-29 13:31 ` Sachin Sant
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=20230628100558.43482-5-ldufour@linux.ibm.com \
--to=ldufour@linux.ibm.com \
--cc=bp@alien8.de \
--cc=christophe.leroy@csgroup.eu \
--cc=dave.hansen@linux.intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=tglx@linutronix.de \
/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.