From 58dfe883d3bc3b4c08c53a7f39e2ca3ec84f089e Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Thu, 11 Oct 2007 22:25:25 +0200 Subject: lockdep: annotate kprobes irq fiddling kprobes disables irqs for jprobes, but does not tell lockdep about it. This resolves this warning during an allyesconfig bzImage bootup test: [ 423.670337] WARNING: at kernel/lockdep.c:2658 check_flags() [ 423.670341] [] show_trace_log_lvl+0x19/0x2e [ 423.670348] [] show_trace+0x12/0x14 [ 423.670350] [] dump_stack+0x14/0x16 [ 423.670353] [] check_flags+0x95/0x142 [ 423.670357] [] lock_acquire+0x52/0xb8 [ 423.670360] [] _spin_lock+0x2e/0x58 [ 423.670365] [] jtcp_rcv_established+0x6e/0x189 [ 423.670369] [] tcp_v4_do_rcv+0x30b/0x620 [ 423.670373] [] tcp_v4_rcv+0x89d/0x8fa [ 423.670376] [] ip_local_deliver+0x17d/0x225 [ 423.670380] [] ip_rcv+0x493/0x4ce [ 423.670383] [] netif_receive_skb+0x347/0x365 [ 423.670388] [] nv_napi_poll+0x501/0x6c3 [ 423.670393] [] net_rx_action+0xa3/0x1b6 [ 423.670396] [] __do_softirq+0x76/0xfb [ 423.670400] [] do_softirq+0x75/0xf3 [ akpm: checkpatch.pl cleanups ] Cc: Prasanna S Panchamukhi Cc: Ananth N Mavinakayanahalli Cc: Anil S Keshavamurthy Cc: David S. Miller Signed-off-by: Peter Zijlstra Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton --- arch/x86/kernel/kprobes_32.c | 7 +++++++ arch/x86/kernel/kprobes_64.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c index c2d03e96ae9..e7d0d3c2ef6 100644 --- a/arch/x86/kernel/kprobes_32.c +++ b/arch/x86/kernel/kprobes_32.c @@ -557,6 +557,12 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs) resume_execution(cur, regs, kcb); regs->eflags |= kcb->kprobe_saved_eflags; +#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT + if (raw_irqs_disabled_flags(regs->eflags)) + trace_hardirqs_off(); + else + trace_hardirqs_on(); +#endif /*Restore back the original saved kprobes variables and continue. */ if (kcb->kprobe_status == KPROBE_REENTER) { @@ -694,6 +700,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, MIN_STACK_SIZE(addr)); regs->eflags &= ~IF_MASK; + trace_hardirqs_off(); regs->eip = (unsigned long)(jp->entry); return 1; } diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c index 1df17a0ec0c..62e28e52d78 100644 --- a/arch/x86/kernel/kprobes_64.c +++ b/arch/x86/kernel/kprobes_64.c @@ -544,6 +544,12 @@ int __kprobes post_kprobe_handler(struct pt_regs *regs) resume_execution(cur, regs, kcb); regs->eflags |= kcb->kprobe_saved_rflags; +#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT + if (raw_irqs_disabled_flags(regs->eflags)) + trace_hardirqs_off(); + else + trace_hardirqs_on(); +#endif /* Restore the original saved kprobes variables and continue. */ if (kcb->kprobe_status == KPROBE_REENTER) { @@ -684,6 +690,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, MIN_STACK_SIZE(addr)); regs->eflags &= ~IF_MASK; + trace_hardirqs_off(); regs->rip = (unsigned long)(jp->entry); return 1; } -- cgit v1.2.3