Messages in this thread Patch in this message | | | Date | Tue, 22 Apr 2008 12:18:23 -0400 | From | Masami Hiramatsu <> | Subject | Re: [Bug 10489] Kprobe smoke test lockdep warning |
| |
Hi Peter,
Thank you for the patch,
Peter Zijlstra wrote: > So the below makes it work - but I'm not getting this code; at the time > I wrote that stuff I CC'ed each and every kprobe maintainer listed in > the usual places but got no reposonse - can some please explain this > stuff to me?
Sure, I came to the same decision. It is enough to remove unnecessary trace_hardirqs_fixup_flags() from post_kprobe_handler. pt_regs->flags is just a variable on stack -- not effective flags in that time. So we don't need to change thread's hardirq flag.
> Are the saved flags only for the TF bit or are they made in full effect > later (and if so, where) ?
The saved flags is for TF and IF bits. Actually, kprobes does following:
--- do_int3() kprobe_exceptions_notify() kprobe_handler() prepare_singlestep() : save regs->flags, set TF and clear IF on regs->flags "iret" : pop regs->flags image to EFLAGS reg.
<single step an instruction>
do_debug() kprobe_exceptions_notify() post_kprobe_handler() : restore regs->flags (clearing TF and restoring IF) "iret" : pop regs->flags image to EFLAGS reg. ---
While executing a single step, EFLAGS is different from the original EFLAGS. However, it will be recovered soon by post_kprobe_handler. NOTE: if the single-stepping instruction is a pushf, kprobes writes saved EFLAGS to the top of stack.
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
I tested it on x86-64/i386.
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
> --- > diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c > index 34a5912..fe71e64 100644 > --- a/arch/x86/kernel/kprobes.c > +++ b/arch/x86/kernel/kprobes.c > @@ -865,7 +865,6 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs) > > resume_execution(cur, regs, kcb); > regs->flags |= kcb->kprobe_saved_flags; > - trace_hardirqs_fixup_flags(regs->flags); > > /* Restore back the original saved kprobes variables and continue. */ > if (kcb->kprobe_status == KPROBE_REENTER) { > > >
-- Masami Hiramatsu
Software Engineer Hitachi Computer Products (America) Inc. Software Solutions Division
e-mail: mhiramat@redhat.com
| |