ppc64 xics.c: what is smp_threads_ready exactly used for?
Hi Anton,
during a cleanup, I stumbled upon the following:
arch/ppc64/kernel/smp.c (in 2.6.11-rc1-mm1) says:
/* XXX fix this, xics currently relies on it - Anton */
smp_threads_ready = 1;arch/ppc64/kernel/xics.c is the _only_ place in the whole kernel where smp_threads_ready is actually used, and this is the _only_ place where smp_threads_ready ever changes it's value on ppc64.
I have to admit I'm a bit lost in the sequence of function calls on ppc64. Is it possible to make any assumptions about the ordering of the assignment and the usage of smp_threads_ready?
TIA
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedHi,
Quoted 5 lines
during a cleanup, I stumbled upon the following:
arch/ppc64/kernel/smp.c(in 2.6.11-rc1-mm1) says:
Quoted 7 lines
/* XXX fix this, xics currently relies on it - Anton */ smp_threads_ready = 1;
arch/ppc64/kernel/xics.cis the _only_ place in the whole kernel wheresmp_threads_readyis actually used, and this is the _only_ place wheresmp_threads_readyever changes it's value on ppc64.
It turns out I was about to submit a patch to remove the ppc64 use of smp_threads_ready. With that patch it makes sense to kill smp_threads_ready completely.
Anton
Quoted 2 lines · Anton Blanchard
Hi,
Hi Anton,
Quoted 9 lines
Quoted 9 lines
during a cleanup, I stumbled upon the following:
arch/ppc64/kernel/smp.c(in 2.6.11-rc1-mm1) says:/* XXX fix this, xics currently relies on it - Anton */ smp_threads_ready = 1;
Quoted 7 lines
Quoted 3 lines
arch/ppc64/kernel/xics.cis the _only_ place in the whole kernel wheresmp_threads_readyis actually used, and this is the _only_ place wheresmp_threads_readyever changes it's value on ppc64.It turns out I was about to submit a patch to remove the ppc64 use of
smp_threads_ready. With that patch it makes sense to killsmp_threads_readycompletely.
I've got a patch ready to remove smp_threads_ready on all architectures.
The only part I still need ids how to replace it in xics.c, since this is the only read access to this variable on all architectures.
Could you send me this part for inclusion into my patch?
Quoted 1 line
Anton
TIA
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedPATCH 1/1 ppc64: Remove CONFIG_IRQ_ALL_CPUS
In reply to Anton BlanchardReplace CONFIG_IRQ_ALL_CPUS with a boot option (noirqdistrib). Compile options arent much use on a distro kernel. This also removes the ppc64 use of smp_threads_ready.
I considered removing the option completely but we have had problems in the past with firmware bugs. In those cases the boot option would have helped.
===== arch/ppc64/Kconfig 1.76 vs edited =====
arch/ppc64/Kconfig +0 -8
@@ -186,14 +186,6 @@ If you don't know what to do here, say Y. -config IRQ_ALL_CPUS - bool "Distribute interrupts on all CPUs by default" - depends on SMP && PPC_MULTIPLATFORM - help - This option gives the kernel permission to distribute IRQs across - multiple CPUs. Saying N here will route all IRQs to the first - CPU. - config NR_CPUS int "Maximum number of CPUs (2-128)" range 2 128
===== arch/ppc64/kernel/irq.c 1.74 vs edited =====
arch/ppc64/kernel/irq.c +8 -0
@@ -62,6 +62,7 @@extern irq_desc_t irq_desc[NR_IRQS ]; +int distribute_irqs =1 ;int __irq_offset_value;int ppc_spurious_interrupts;unsigned long lpevent_count;
@@ -479,3 +480,10 @@#endif /* CONFIG_IRQSTACKS */ +static int __init setup_noirqdistrib (char *str) +{ + distribute_irqs =0 ; +return 1 ; +} + +__setup ("noirqdistrib" , setup_noirqdistrib);
===== arch/ppc64/kernel/mpic.c 1.3 vs edited =====
arch/ppc64/kernel/mpic.c +5 -7
@@ -765,10 +765,8 @@#ifdef CONFIG_SMP struct mpic *mpic = mpic_primary;unsigned long flags; -#ifdef CONFIG_IRQ_ALL_CPUS u32 msk =1 <<hard_smp_processor_id ();unsigned int i; -#endif BUG_ON (mpic ==NULL );
@@ -776,16 +774,16 @@spin_lock_irqsave (&mpic_lock, flags); -#ifdef CONFIG_IRQ_ALL_CPUS /* let the mpic know we want intrs. default affinity is 0xffffffff * until changed via /proc. That's how it's done on x86. If we want * it differently, then we should make sure we also change the default * values of irq_affinity in irq.c. */ -for (i =0 ; i < mpic->num_sources ; i++) -mpic_irq_write (i,MPIC_IRQ_DESTINATION , -mpic_irq_read (i,MPIC_IRQ_DESTINATION ) | msk); -#endif /* CONFIG_IRQ_ALL_CPUS */ +if (distribute_irqs) { +for (i =0 ; i < mpic->num_sources ; i++) +mpic_irq_write (i,MPIC_IRQ_DESTINATION , +mpic_irq_read (i,MPIC_IRQ_DESTINATION ) | msk); + }/* Set current processor priority to 0 */ mpic_cpu_write (MPIC_CPU_CURRENT_TASK_PRI ,0 );
===== arch/ppc64/kernel/pSeries_smp.c 1.9 vs edited =====
arch/ppc64/kernel/pSeries_smp.c +0 -2
@@ -259,7 +259,6 @@if (cur_cpu_spec->firmware_features &FW_FEATURE_SPLPAR )vpa_init (cpu); -#ifdef CONFIG_IRQ_ALL_CPUS /* * Put the calling processor into the GIQ. This is really only * necessary from a secondary thread as the OF start-cpu interface
@@ -267,7 +266,6 @@*/ rtas_set_indicator (GLOBAL_INTERRUPT_QUEUE , (1UL << interrupt_server_size) -1 - default_distrib_server,1 ); -#endif }static spinlock_t timebase_lock =SPIN_LOCK_UNLOCKED ;
===== arch/ppc64/kernel/smp.c 1.104 vs edited =====
arch/ppc64/kernel/smp.c +0 -3
@@ -526,9 +526,6 @@ smp_ops->setup_cpu (boot_cpuid); -/* XXX fix this, xics currently relies on it - Anton */ - smp_threads_ready =1 ; -set_cpus_allowed (current, old_mask);/*
===== arch/ppc64/kernel/xics.c 1.57 vs edited =====
arch/ppc64/kernel/xics.c +14 -18
@@ -242,28 +242,24 @@static int get_irq_server (unsigned int irq) {unsigned int server; - -#ifdef CONFIG_IRQ_ALL_CPUS /* For the moment only implement delivery to all cpus or one cpu */ -if (smp_threads_ready) { -cpumask_t cpumask = irq_affinity[irq]; -cpumask_t tmp =CPU_MASK_NONE ; -if (cpus_equal (cpumask,CPU_MASK_ALL )) { - server = default_distrib_server; - }else { -cpus_and (tmp, cpu_online_map, cpumask); +cpumask_t cpumask = irq_affinity[irq]; +cpumask_t tmp =CPU_MASK_NONE ; + +if (!distribute_irqs) +return default_server; -if (cpus_empty (tmp)) - server = default_distrib_server; -else - server =get_hard_smp_processor_id (first_cpu (tmp)); - } +if (cpus_equal (cpumask,CPU_MASK_ALL )) { + server = default_distrib_server; }else { - server = default_server; +cpus_and (tmp, cpu_online_map, cpumask); + +if (cpus_empty (tmp)) + server = default_distrib_server; +else + server =get_hard_smp_processor_id (first_cpu (tmp)); } -#else - server = default_server; -#endif +return server; }
===== include/asm-ppc64/irq.h 1.11 vs edited =====
include/asm-ppc64/irq.h +2 -0
@@ -87,6 +87,8 @@return irq; } +extern int distribute_irqs; +struct irqaction ;struct pt_regs ;
Re: [PATCH] ppc64: Remove CONFIG_IRQ_ALL_CPUS
Quoted 5 lines · Anton Blanchard
Replace
CONFIG_IRQ_ALL_CPUSwith a boot option (noirqdistrib). Compile options arent much use on a distro kernel. This also removes the ppc64 use ofsmp_threads_ready.
...
Seems perfect for me. :-)
I'll simply state that my patch depends on ppc64 on your patch.
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed