From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Tiejun Chen <tiejun.chen@windriver.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [v2 PATCH 2/2] booke/kprobe: remove unnecessary preempt_enable_no_resched
Date: Mon, 11 Jul 2011 11:25:17 +0530 [thread overview]
Message-ID: <20110711055516.GA4659@in.ibm.com> (raw)
In-Reply-To: <1310351976-24078-2-git-send-email-tiejun.chen@windriver.com>
On Mon, Jul 11, 2011 at 10:39:35AM +0800, Tiejun Chen wrote:
> When enable CONFIG_PREEMPT we will trigger the following call trace:
>
> BUG: scheduling while atomic: swapper/1/0x10000000
> ...
>
> krpobe always goes through the following path:
>
> program_check_exception()
> |
> + notify_die(DIE_BPT, "breakpoint",...)
> |
> + kprobe_handler()
> |
> + preempt_disable();
> + break_handler() <- preempt_enable_no_resched()
> + emulate_step()
> + preempt_enable_no_resched()
> ...
> exit
>
> We should remove unnecessary preempt_enable_no_resched() inside of break_handler()
> since looks longjmp_break_handler() always go the above path.
The current code is correct. Reasoning follows...
setjmp_pre_handler() and longjmp_break_handler() are used only for
jprobes. In the case of a jprobe, the code flow would be:
bp hit -> kprobe_handler() -> preempt_disable() -> setjmp_pre_handler()
(not that since this routine returns 1, we skip sstep here) -> jp->entry()
-> jprobe_return() -> bp hit -> kprobe_handler() -> preempt_disable() again
-> longjmp_break_handler() -> preempt_enable() -> sstep -> preempt_enable()
(for the second kprobe_handler() entry).
You could verify this with a preempt_count() printk with a
CONFIG_PREEMPT=y kernel.
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Nack, sorry :-)
Ananth
next prev parent reply other threads:[~2011-07-11 5:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 2:39 [v2 PATCH 1/2] booke/kprobe: make program exception to use one dedicated exception stack Tiejun Chen
2011-07-11 2:39 ` [v2 PATCH 2/2] booke/kprobe: remove unnecessary preempt_enable_no_resched Tiejun Chen
2011-07-11 2:39 ` v2 booke/kprobe: Fix stack corrupt issue when kprobe 'stwu' Tiejun Chen
2011-07-11 5:55 ` Ananth N Mavinakayanahalli [this message]
2011-07-11 8:34 ` [v2 PATCH 2/2] booke/kprobe: remove unnecessary preempt_enable_no_resched tiejun.chen
2011-07-11 11:28 ` tiejun.chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110711055516.GA4659@in.ibm.com \
--to=ananth@in.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=tiejun.chen@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).