[for,2.6.28] powerpc: Use physical cpu id when setting the processor affinity

Submitted by Kumar Gala on Dec. 2, 2008, 7:37 p.m.

Details

Message ID 1228246621-25622-1-git-send-email-galak@kernel.crashing.org
State Accepted, archived
Commit 7a0d7940e7c7c143520e38900ddd4e217d3c6640
Headers show

Commit Message

Kumar Gala Dec. 2, 2008, 7:37 p.m.
In the CONFIG_SMP case the irq_choose_cpu() code was returning back
a logical cpu id not the physical id.  We were writing that directly
into the HW register.

We need to be calling get_hard_smp_processor_id() so irq_choose_cpu()
always returns a physical cpu id.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/sysdev/mpic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Benjamin Herrenschmidt Dec. 2, 2008, 9:30 p.m.
On Tue, 2008-12-02 at 13:37 -0600, Kumar Gala wrote:
> In the CONFIG_SMP case the irq_choose_cpu() code was returning back
> a logical cpu id not the physical id.  We were writing that directly
> into the HW register.
> 
> We need to be calling get_hard_smp_processor_id() so irq_choose_cpu()
> always returns a physical cpu id.

That will probably do for now but if we ever move that routine to
generic code, I'd rather have the caller do the conversion.

Cheers,
Ben.
Kumar Gala Dec. 2, 2008, 11:05 p.m.
On Dec 2, 2008, at 3:30 PM, Benjamin Herrenschmidt wrote:

> On Tue, 2008-12-02 at 13:37 -0600, Kumar Gala wrote:
>> In the CONFIG_SMP case the irq_choose_cpu() code was returning back
>> a logical cpu id not the physical id.  We were writing that directly
>> into the HW register.
>>
>> We need to be calling get_hard_smp_processor_id() so irq_choose_cpu()
>> always returns a physical cpu id.
>
> That will probably do for now but if we ever move that routine to
> generic code, I'd rather have the caller do the conversion.

Fair.. I felt at this point matching what the !CONFIG_SMP case of  
irq_choose_cpu() is doing was the best choice.

- k

Patch hide | download patch | download mbox

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index b24e1d0..1890fb0 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -600,7 +600,7 @@  static int irq_choose_cpu(unsigned int virt_irq)
 		cpuid = first_cpu(tmp);
 	}
 
-	return cpuid;
+	return get_hard_smp_processor_id(cpuid);
 }
 #else
 static int irq_choose_cpu(unsigned int virt_irq)