MIPS: Assorted fixlets and annotation patches
Subsystems (3)
cover MIPS: Assorted fixlets and annotation patches
Ralf,
the following series is the fallout of the 3.0-rt work for MIPS.
The first 3 patches are bug fixes, the last 3 annotations for spin locks and interrupts which want to be marked NO_THREAD.
There is one bug remaining, which I currently worked around by disabling the dynamic ftrace functionality.
When the tracer starts up then ftrace_dyn_arch_init() is called with interrupts disabled, but the MIPS code issues a SMP function call which complains about interrupts being disabled. Observed on SWARM.
Thanks,
tglx
PATCH 1/7 mips: sibyte: Add missing irq_mask function
Crashes on free_irq() otherwise.
--- arch/mips/sibyte/sb1250/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/sibyte/sb1250/irq.c +1 -1
@@ -178,7 +178,7 @@ static void ack_sb1250_irq(struct irq_dastatic struct irq_chip sb1250_irq_type = { .name ="SB1250-IMR" , - .irq_mask_ack = ack_sb1250_irq, + .irq_mask = ack_sb1250_irq, .irq_unmask = enable_sb1250_irq, #ifdef CONFIG_SMP .irq_set_affinity = sb1250_set_affinity
PATCH 2/7 mips: ftrace: Fix the CONFIG_DYNAMIC_FTRACE=n compile
In reply to Thomas Gleixnerarch/mips/kernel/ftrace.c: In function ‘ftrace_get_parent_ra_addr’:arch/mips/kernel/ftrace.c:212: error: implicit declaration of function ‘in_kernel_space’ arch/mips/kernel/ftrace.c: In function ‘prepare_ftrace_return’:arch/mips/kernel/ftrace.c:314: error: ‘MCOUNT_OFFSET_INSNS’ undeclared (first use in this function) arch/mips/kernel/ftrace.c:314: error: (Each undeclared identifier is reported only once arch/mips/kernel/ftrace.c:314: error: for each function it appears in.)
--- arch/mips/kernel/ftrace.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-)
arch/mips/kernel/ftrace.c +20 -19
@@ -19,6 +19,26 @@#include <asm-generic/sections.h> +#if defined(KBUILD_MCOUNT_RA_ADDRESS ) && defined(CONFIG_32BIT ) +#define MCOUNT_OFFSET_INSNS 5 +#else +#define MCOUNT_OFFSET_INSNS 4 +#endif + +/* +* Check if the address is in kernel space +* +* Clone core_kernel_text() from kernel/extable.c, but doesn't call +* init_kernel_text() for Ftrace doesn't trace functions in init sections. +*/ +static inline int in_kernel_space (unsigned long ip) +{ +if (ip >= (unsigned long )_stext && + ip <= (unsigned long )_etext) +return 1 ; +return 0 ; +} +#ifdef CONFIG_DYNAMIC_FTRACE #define JAL 0x0c000000/* jump & link: ip --> ra, jump to target */
@@ -54,20 +74,6 @@ static inline void ftrace_dyn_arch_init_#endif } -/* -* Check if the address is in kernel space -* -* Clone core_kernel_text() from kernel/extable.c, but doesn't call -* init_kernel_text() for Ftrace doesn't trace functions in init sections. -*/ -static inline int in_kernel_space (unsigned long ip) -{ -if (ip >= (unsigned long )_stext && - ip <= (unsigned long )_etext) -return 1 ; -return 0 ; -} -static int ftrace_modify_code (unsigned long ip,unsigned int new_code) {int faulted;
@@ -112,11 +118,6 @@ static int ftrace_modify_code(unsigned l* 1: offset = 4 instructions */ -#if defined(KBUILD_MCOUNT_RA_ADDRESS ) && defined(CONFIG_32BIT ) -#define MCOUNT_OFFSET_INSNS 5 -#else -#define MCOUNT_OFFSET_INSNS 4 -#endif #define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS) int ftrace_make_nop(struct module *mod,
PATCH 3/7 mips: Enable interrupts in do_signal()
In reply to Thomas Gleixnerdo_signal() does __put_user() which can fault, resulting in a might_sleep() warning in down_read(&mm->mmap_sem) and a "scheduling while atomic" warning when mmap_sem is contented. On swarm this also results in:
WARNING: at kernel/smp.c:459 smp_call_function_many+0x148/0x398() Modules linked in: Call Trace: [<ffffffff804b48a4>] dump_stack+0x1c/0x50 [<ffffffff8013dc94>] warn_slowpath_common+0x8c/0xc8 [<ffffffff8013dcfc>] warn_slowpath_null+0x2c/0x40 [<ffffffff801864a0>] smp_call_function_many+0x148/0x398 [<ffffffff80186748>] smp_call_function+0x58/0xa8 [<ffffffff80119b5c>] r4k_flush_data_cache_page+0x54/0xd8 [<ffffffff801f39bc>] handle_pte_fault+0xa9c/0xad0 [<ffffffff801f40d0>] handle_mm_fault+0x158/0x200 [<ffffffff80115548>] do_page_fault+0x218/0x3b0 [<ffffffff80102744>] ret_from_exception+0x0/0x10 [<ffffffff8010eb18>] copy_siginfo_to_user32+0x50/0x298 [<ffffffff8010edf0>] setup_rt_frame_32+0x90/0x250 [<ffffffff80106414>] do_notify_resume+0x154/0x358 [<ffffffff80102930>] work_notifysig+0xc/0x14
Enable interrupts in do_signal() before delivering signals. Might be done in the entry code before calling do_notify_resume(), but I leave that for the MIPS ASM wizards.
--- arch/mips/kernel/signal.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/kernel/signal.c +2 -0
@@ -603,6 +603,8 @@ static void do_signal(struct pt_regs *reif (!user_mode (regs))return ; +local_irq_enable (); +if (test_thread_flag (TIF_RESTORE_SIGMASK )) oldset = ¤t->saved_sigmask;else
PATCH 4/7 MIPS: Make the die_lock be raw
In reply to Thomas GleixnerFrom: Wu Zhangjin <[email protected]>
On preempt-rt this lock needs to be raw, so it does not get converted to a sleeping spinlock. Trying to sleep in a panic is not really desireable.
--- arch/mips/kernel/traps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/kernel/traps.c +3 -3
@@ -364,7 +364,7 @@ static int regs_to_trapnr(struct pt_regsreturn (regs->cp0_cause >>2 ) &0x1f ; } -static DEFINE_SPINLOCK (die_lock); +static DEFINE_RAW_SPINLOCK (die_lock);void __noreturn die (const char *str,struct pt_regs *regs) {
@@ -378,7 +378,7 @@ void __noreturn die(const char *str, str sig =0 ;console_verbose (); -spin_lock_irq (&die_lock); +raw_spin_lock_irq (&die_lock);bust_spinlocks (1 );#ifdef CONFIG_MIPS_MT_SMTC mips_mt_regdump (dvpret);
@@ -387,7 +387,7 @@ void __noreturn die(const char *str, strprintk ("%s[#%d]:\n" , str, ++die_counter);show_registers (regs);add_taint (TAINT_DIE ); -spin_unlock_irq (&die_lock); +raw_spin_unlock_irq (&die_lock);if (in_interrupt ())panic ("Fatal exception in interrupt" );
PATCH 5/7 MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD
In reply to Thomas GleixnerFrom: Wu Zhangjin <[email protected]>
Mark interrupts with no_action handler, cascade interrupts, low level interrupts (bus error, halt ..) with IRQF_NO_THREAD to exclude them from forced threading.
--- arch/mips/ar7/irq.c | 3 ++- arch/mips/bcm63xx/irq.c | 1 + arch/mips/cobalt/irq.c | 1 + arch/mips/dec/setup.c | 4 ++++ arch/mips/emma/markeins/irq.c | 2 +- arch/mips/lasat/interrupt.c | 1 + arch/mips/mti-malta/malta-int.c | 6 ++++-- arch/mips/pmc-sierra/msp71xx/msp_irq.c | 2 ++ arch/mips/pnx8550/common/int.c | 2 +- arch/mips/sgi-ip22/ip22-int.c | 10 +++++----- arch/mips/sni/rm200.c | 1 + arch/mips/vr41xx/common/irq.c | 1 + 12 files changed, 24 insertions(+), 10 deletions(-)
arch/mips/ar7/irq.c +2 -1
@@ -98,7 +98,8 @@ static struct irq_chip ar7_sec_irq_typestatic struct irqaction ar7_cascade_action = { .handler = no_action, - .name ="AR7 cascade interrupt" + .name ="AR7 cascade interrupt" , + .flags =IRQF_NO_THREAD , };static void __init ar7_irq_init (int base)
arch/mips/bcm63xx/irq.c +1 -0
@@ -222,6 +222,7 @@ static struct irq_chip bcm63xx_external_static struct irqaction cpu_ip2_cascade_action = { .handler = no_action, .name ="cascade_ip2" , + .flags =IRQF_NO_THREAD , };void __init arch_init_irq (void )
arch/mips/cobalt/irq.c +1 -0
@@ -48,6 +48,7 @@ asmlinkage void plat_irq_dispatch(void)static struct irqaction cascade = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };void __init arch_init_irq (void )
arch/mips/dec/setup.c +4 -0
@@ -101,20 +101,24 @@ int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_static struct irqaction ioirq = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };static struct irqaction fpuirq = { .handler = no_action, .name ="fpu" , + .flags =IRQF_NO_THREAD , };static struct irqaction busirq = { .flags =IRQF_DISABLED , .name ="bus error" , + .flags =IRQF_NO_THREAD , };static struct irqaction haltirq = { .handler = dec_intr_halt, .name ="halt" , + .flags =IRQF_NO_THREAD , };
arch/mips/emma/markeins/irq.c +1 -1
@@ -169,7 +169,7 @@ void emma2rh_gpio_irq_init(void)static struct irqaction irq_cascade = { .handler = no_action, - .flags =0 , + .flags =IRQF_NO_THREAD , .name ="cascade" , .dev_id =NULL , .next =NULL ,
arch/mips/lasat/interrupt.c +1 -0
@@ -105,6 +105,7 @@ asmlinkage void plat_irq_dispatch(void)static struct irqaction cascade = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };void __init arch_init_irq (void )
arch/mips/mti-malta/malta-int.c +4 -2
@@ -350,12 +350,14 @@ unsigned int plat_ipi_resched_int_xlate(static struct irqaction i8259irq = { .handler = no_action, - .name ="XT-PIC cascade" + .name ="XT-PIC cascade" , + .flags =IRQF_NO_THREAD , };static struct irqaction corehi_irqaction = { .handler = no_action, - .name ="CoreHi" + .name ="CoreHi" , + .flags =IRQF_NO_THREAD , };static msc_irqmap_t __initdata msc_irqmap[] = {
arch/mips/pmc-sierra/msp71xx/msp_irq.c +2 -0
@@ -109,11 +109,13 @@ asmlinkage void plat_irq_dispatch(structstatic struct irqaction cic_cascade_msp = { .handler = no_action, .name ="MSP CIC cascade" + .flags =IRQF_NO_THREAD , };static struct irqaction per_cascade_msp = { .handler = no_action, .name ="MSP PER cascade" + .flags =IRQF_NO_THREAD , };void __init arch_init_irq (void )
arch/mips/pnx8550/common/int.c +1 -1
@@ -167,7 +167,7 @@ static struct irq_chip level_irq_type =static struct irqaction gic_action = { .handler = no_action, - .flags =IRQF_DISABLED , + .flags =IRQF_DISABLED |IRQF_NO_THREAD , .name ="GIC" , };
arch/mips/sgi-ip22/ip22-int.c +5 -5
@@ -155,32 +155,32 @@ static void __irq_entry indy_buserror_irstatic struct irqaction local0_cascade = { .handler = no_action, - .flags =IRQF_DISABLED , + .flags =IRQF_DISABLED |IRQF_NO_THREAD , .name ="local0 cascade" , };static struct irqaction local1_cascade = { .handler = no_action, - .flags =IRQF_DISABLED , + .flags =IRQF_DISABLED |IRQF_NO_THREAD , .name ="local1 cascade" , };static struct irqaction buserr = { .handler = no_action, - .flags =IRQF_DISABLED , + .flags =IRQF_DISABLED |IRQF_NO_THREAD , .name ="Bus Error" , };static struct irqaction map0_cascade = { .handler = no_action, - .flags =IRQF_DISABLED , + .flags =IRQF_DISABLED |IRQF_NO_THREAD , .name ="mapable0 cascade" , };#ifdef USE_LIO3_IRQ static struct irqaction map1_cascade = { .handler = no_action, - .flags =IRQF_DISABLED , + .flags =IRQF_DISABLED |IRQF_NO_THREAD , .name ="mapable1 cascade" , };#define SGI_INTERRUPTS SGINT_END
arch/mips/sni/rm200.c +1 -0
@@ -359,6 +359,7 @@ void sni_rm200_init_8259A(void)static struct irqaction sni_rm200_irq2 = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };static struct resource sni_rm200_pic1_resource = {
arch/mips/vr41xx/common/irq.c +1 -0
@@ -34,6 +34,7 @@ static irq_cascade_t irq_cascade[NR_IRQSstatic struct irqaction cascade_irqaction = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };int cascade_irq (unsigned int irq,int (*get_irq)(unsigned int ))
PATCH 6/7 MIPS: Loongson: Mark cascade interrupts IRQF_NO_THREAD
In reply to Thomas GleixnerFrom: Wu Zhangjin <[email protected]>
There are two cascade interrupts in Loongson machines, one for bonito northbridge, another for the 8259A controller in the southbridge. Both want to be non threaded.
--- arch/mips/loongson/fuloong-2e/irq.c | 1 + arch/mips/loongson/lemote-2f/irq.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
arch/mips/loongson/fuloong-2e/irq.c +1 -0
@@ -42,6 +42,7 @@ asmlinkage void mach_irq_dispatch(unsignstatic struct irqaction cascade_irqaction = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };void __init mach_init_irq (void )
arch/mips/loongson/lemote-2f/irq.c +2 -1
@@ -96,12 +96,13 @@ static irqreturn_t ip6_action(int cpl, vstruct irqaction ip6_irqaction = { .handler = ip6_action, .name ="cascade" , - .flags =IRQF_SHARED , + .flags =IRQF_SHARED |IRQF_NO_THREAD , };struct irqaction cascade_irqaction = { .handler = no_action, .name ="cascade" , + .flags =IRQF_NO_THREAD , };void __init mach_init_irq (void )
PATCH 7/7 mips: Allow forced irq threading
In reply to Thomas GleixnerAll low level interrupts have been marked NO_THREAD, so MIPS can enjoy the wonderful world of forced threaded interrupt handlers.
--- arch/mips/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/Kconfig +1 -0
@@ -24,6 +24,7 @@ config MIPS select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select HAVE_ARCH_JUMP_LABEL + select IRQ_FORCED_THREADING menu "Machine selection"
Re: [patch 1/7] mips: sibyte: Add missing irq_mask function
In reply to Thomas GleixnerQuoted 12 lines · Thomas Gleixner
Crashes on
free_irq()otherwise.Signed-off-by Thomas Gleixner <[email protected]>--- arch/mips/sibyte/sb1250/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux-2.6/arch/mips/sibyte/sb1250/irq.c
===================================================================
arch/mips/sibyte/sb1250/irq.c static void ack_sb1250_irq(struct irq_da · line 181
Quoted 5 lines
arch/mips/sibyte/sb1250/irq.c +1
-1@@ -178,7 +178,7 @@ static void ack_sb1250_irq(struct irq_dastatic struct irq_chip sb1250_irq_type = { .name ="SB1250-IMR" , - .irq_mask_ack = ack_sb1250_irq, + .irq_mask = ack_sb1250_irq,
This conflicts with 1544129da2de9fa276429deed8fac3fbc45634be [MIPS: SB1250:
Restore dropped irq_mask function] which does:
@@ -180,6 +187,7 @@ static struct irq_chip sb1250_irq_type = {
.name = "SB1250-IMR",
.irq_mask_ack = ack_sb1250_irq,
.irq_unmask = enable_sb1250_irq,
+ .irq_mask = disable_sb1250_irq,
#ifdef CONFIG_SMP
.irq_set_affinity = sb1250_set_affinity#endif
Ralf
Ralf Baechle
AppliedRe: [patch 2/7] mips: ftrace: Fix the CONFIG_DYNAMIC_FTRACE=n compile
In reply to Thomas GleixnerThanks, applied.
Ralf
Ralf Baechle
AppliedRe: [patch 4/7] MIPS: Make the die_lock be raw
In reply to Thomas GleixnerThanks, applied.
Ralf
Ralf Baechle
AppliedRe: [patch 5/7] MIPS: Mark cascade and low level interrupts IRQF_NO_THREAD
In reply to Thomas GleixnerThanks, applied.
Ralf
Ralf Baechle
AppliedRe: [patch 6/7] MIPS: Loongson: Mark cascade interrupts IRQF_NO_THREAD
In reply to Thomas GleixnerThanks, applied.
Ralf
Ralf Baechle
AppliedRe: [patch 7/7] mips: Allow forced irq threading
In reply to Thomas GleixnerThanks, applied.
Ralf
Re: [patch 3/7] mips: Enable interrupts in do_signal()
In reply to Thomas GleixnerOn Sat, Jul 23, 2011 at 12:41:23PM -0000, Thomas Gleixner wrote:
Uwh.. This one affects master and all -stable branches. But as discussed on IRC I"ve placed the call directly into do_notify_resume - the less code running with interrutps disabled the better.
Ralf
Re: [patch 1/7] mips: sibyte: Add missing irq_mask function
In reply to Thomas GleixnerAnd dropped as you suggested on IRC.
Thanks,
Ralf