linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "tiejun.chen" <tiejun.chen@windriver.com>
To: <ananth@in.ibm.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 16:34:34 +0800	[thread overview]
Message-ID: <4E1AB59A.6050002@windriver.com> (raw)
In-Reply-To: <20110711055516.GA4659@in.ibm.com>

Ananth N Mavinakayanahalli wrote:
> 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 :-)

You're right.

When use EXC_LEVEL_EXCEPTION_PROLOG for Critical/Machine check, if the exception
came from kernel mode, we copy thread_info flags, *preempt*, and task pointer
from the process thread_info. So here I steal EXC_LEVEL_EXCEPTION_PROLOG for
Program Exception, preempt count would be corrupted incorrectly.

Thanks
Tiejun

> 
> Ananth
> 

  reply	other threads:[~2011-07-11  8:35 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   ` [v2 PATCH 2/2] booke/kprobe: remove unnecessary preempt_enable_no_resched Ananth N Mavinakayanahalli
2011-07-11  8:34     ` tiejun.chen [this message]
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=4E1AB59A.6050002@windriver.com \
    --to=tiejun.chen@windriver.com \
    --cc=ananth@in.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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).