Re: [PATCH 4/9] cpu/SMT: Create topology_smt_threads_supported()

From
Thomas Gleixner <hidden>
Date
2023-06-10 22:15:59
Also in
linux-arch, lkml
Reply to
Michael Ellerman, 2023-05-24
On Thu, May 25 2023 at 01:56, Michael Ellerman wrote:
quoted hunk ↗ jump to hunk
+/**
+ * topology_smt_threads_supported - Check if the given number of SMT threads
+ *				    is supported.
+ *
+ * @threads:	The number of SMT threads.
+ */
+bool topology_smt_threads_supported(unsigned int threads)
+{
+	// Only support a single thread or all threads.
+	return threads == 1 || threads == smp_num_siblings;
+}
You can make that a simple core function when cpu_smt_*_threads is
consistent along the lines of my previous reply.

static bool cpu_smt_num_threads_valid(unsigned int threads)
{
        if (IS_ENABLED(CONFIG_SMT_NUM_THREADS_DYNAMIC))
		return threads >= 1 && threads <= cpu_smt_max_threads;
        return threads == 1 || threads == cpu_smt_max_threads;
}

Or something like that.

Thanks,

        tglx
Thread (23 messages) 23 messages, 3 authors, last reply 2023-06-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help