public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] Fix thinko in cpu_thread_mask_to_cores()
@ 2008-02-22  3:26 Benjamin Herrenschmidt
  2008-02-22  3:42 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2008-02-22  3:26 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

The function cpu_thread_mask_to_cores() which returns a cpumask
of one and only one thread enabled for a given core has a bug
as it's shifting things in the wrong direction.

Note: The implementation is still sub-optimal in the sense that
for a given core, the thread set in the result may not be any of
the threads set in the input, which can lead to more IPIs then
strictly necessary, but it isn't incorrect per-se. I'll improve
that later.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 include/asm-powerpc/cputhreads.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-work.orig/include/asm-powerpc/cputhreads.h	2008-02-22 14:22:34.000000000 +1100
+++ linux-work/include/asm-powerpc/cputhreads.h	2008-02-22 14:22:39.000000000 +1100
@@ -35,7 +35,7 @@ static inline cpumask_t cpu_thread_mask_
 
 	res = CPU_MASK_NONE;
 	for (i = 0; i < NR_CPUS; i += threads_per_core) {
-		cpus_shift_right(tmp, threads_core_mask, i);
+		cpus_shift_left(tmp, threads_core_mask, i);
 		if (cpus_intersects(threads, tmp))
 			cpu_set(i, res);
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-22  3:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-22  3:26 [PATCH] [POWERPC] Fix thinko in cpu_thread_mask_to_cores() Benjamin Herrenschmidt
2008-02-22  3:42 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox