public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] Setting /proc/irq/[n]/smp_affinity failure on 8 cpu systems
@ 2009-12-02 16:19 John Blackwood
  2009-12-03  1:13 ` Suresh Siddha
  0 siblings, 1 reply; 3+ messages in thread
From: John Blackwood @ 2009-12-02 16:19 UTC (permalink / raw)
  To: Ingo Molnar, Rusty Russell, linux-kernel@vger.kernel.org

Hi,

I would like to mention an irq set affinity issue occurs on an
older Dell PowerEdge 6650 system:
    - 8 cpus (4 are hyper-threaded),
    - uses the struct apic 'apic_default' support
    - 32 bit (x86) kernel

This issue is that once you change the irq smp_affinity of an irq
to be less than all cpus in the system, you can never change really the
irq smp_affinity back to be all cpus in the system (0xff) again,
even though no error status is returned on the "/bin/echo ff >
/proc/irq/[n]/smp_affinity" operation.

This is due to that fact that BAD_APICID has the same value as
all cpus (0xff) on 32bit kernels, and thus the value returned from
set_desc_affinity() via the cpu_mask_to_apicid_and() function is treated
as a failure in set_ioapic_affinity_irq_desc(), and no affinity changes
are made.

It seems like changing the BAD_APICID value from 0xFF to 0xFFFF for
CONFIG_X86_32 might be one possible solution, and it seems to function
properly for this Dell PowerEdge 6650 system.

Thank you for your time.

Signed-off-by: John Blackwood <john.blackwood@ccur.com>


diff -rup linux-2.6.32-rc8/arch/x86/include/asm/apicdef.h new/arch/x86/include/asm/apicdef.h
--- linux-2.6.32-rc8/arch/x86/include/asm/apicdef.h     2009-11-19 16:32:38.000000000 -0600
+++ new/arch/x86/include/asm/apicdef.h  2009-12-01 15:15:34.000000000 -0600
@@ -413,9 +413,6 @@ struct local_apic {

    #undef u32

-#ifdef CONFIG_X86_32
- #define BAD_APICID 0xFFu
-#else
- #define BAD_APICID 0xFFFFu
-#endif
+#define BAD_APICID 0xFFFFu
+
    #endif /* _ASM_X86_APICDEF_H */
diff -rup linux-2.6.32-rc8/arch/x86/include/asm/apic.h new/arch/x86/include/asm/apic.h
--- linux-2.6.32-rc8/arch/x86/include/asm/apic.h        2009-11-19 16:32:38.000000000 -0600
+++ new/arch/x86/include/asm/apic.h     2009-12-01 15:15:34.000000000 -0600
@@ -591,7 +591,7 @@ static inline physid_mask_t default_apic
    #endif /* CONFIG_X86_LOCAL_APIC */

    #ifdef CONFIG_X86_32
-extern u8 cpu_2_logical_apicid[NR_CPUS];
+extern u16 cpu_2_logical_apicid[NR_CPUS];
    #endif

    #endif /* _ASM_X86_APIC_H */
diff -rup linux-2.6.32-rc8/arch/x86/kernel/smpboot.c new/arch/x86/kernel/smpboot.c
--- linux-2.6.32-rc8/arch/x86/kernel/smpboot.c  2009-11-19 16:32:38.000000000 -0600
+++ new/arch/x86/kernel/smpboot.c       2009-12-01 15:15:34.000000000 -0600
@@ -146,7 +146,7 @@ static void unmap_cpu_to_node(int cpu)
    #ifdef CONFIG_X86_32
    static int boot_cpu_logical_apicid;

-u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
+u16 cpu_2_logical_apicid[NR_CPUS] __read_mostly =
                                          { [0 ... NR_CPUS-1] = BAD_APICID };

    static void map_cpu_to_logical_apicid(void)




^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [RFC][PATCH] Setting /proc/irq/[n]/smp_affinity failure on 8 cpu systems
@ 2009-12-03 13:30 John Blackwood
  0 siblings, 0 replies; 3+ messages in thread
From: John Blackwood @ 2009-12-03 13:30 UTC (permalink / raw)
  To: Suresh Siddha; +Cc: Ingo Molnar, Rusty Russell, linux-kernel@vger.kernel.org

 > On Wed, 2009-12-02 at 08:19 -0800, John Blackwood wrote:
 > > > I would like to mention an irq set affinity issue occurs on an
 > > > older Dell PowerEdge 6650 system:
 > > >     - 8 cpus (4 are hyper-threaded),
 > > >     - uses the struct apic 'apic_default' support
 > > >     - 32 bit (x86) kernel
 > > >
 > > > This issue is that once you change the irq smp_affinity of an irq
 > > > to be less than all cpus in the system, you can never change really
 > > > the
 > > > irq smp_affinity back to be all cpus in the system (0xff) again,
 > > > even though no error status is returned on the "/bin/echo ff >
 > > > /proc/irq/[n]/smp_affinity" operation.
 > > >
 > > > This is due to that fact that BAD_APICID has the same value as
 > > > all cpus (0xff) on 32bit kernels, and thus the value returned from
 > > > set_desc_affinity() via the cpu_mask_to_apicid_and() function is
 > > > treated
 > > > as a failure in set_ioapic_affinity_irq_desc(), and no affinity
 > > > changes
 > > > are made.
 > > >
 > > > It seems like changing the BAD_APICID value from 0xFF to 0xFFFF for
 > > > CONFIG_X86_32 might be one possible solution, and it seems to function
 > > > properly for this Dell PowerEdge 6650 system.
 >
 > John, Thanks for the root cause and analysis. As you noticed, 0xff is a
 > valid logical apicid. Similarly 0xffff is a valid logical x2apic cluster
 > id. So while your patch fixes your issue, it doesn't completely fix the
 > issue. Can you please check if the appended patch works and ack if it
 > passes your test?
 >

Hi Suresh,

Yes, your patch works on the Dell PowerEdge 6650 system.

Thanks for your help and quick reply.


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

end of thread, other threads:[~2009-12-03 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02 16:19 [RFC][PATCH] Setting /proc/irq/[n]/smp_affinity failure on 8 cpu systems John Blackwood
2009-12-03  1:13 ` Suresh Siddha
  -- strict thread matches above, loose matches on Subject: below --
2009-12-03 13:30 John Blackwood

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