All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Steven Rostedt <srostedt@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] ftrace: fast path for do_ftrace_mod_code()
Date: Wed, 18 Mar 2009 15:02:15 +0800	[thread overview]
Message-ID: <49C09C77.3050300@cn.fujitsu.com> (raw)
In-Reply-To: <1237300777.3624.36.camel@localhost.localdomain>

Steven Rostedt wrote:
> 
> I'm a bit nervous about this code. We do not get much benefit from it,
> because the NMI case is an anomaly, and is not a fast path anyway. This
> code only happens when we are running the stop_machine, and this adds
> added complexity for little benefit.
> 
> The original patch was to prevent an actual live lock I got in one of my
> tests. The problem was that the failure of the write caused a printk
> stack dump. But the time it took the print to go out over the serial was
> long enough that the next NMI triggered when it finished. The new NMI
> hit the same error and did another print. Thus, all I got was a lot of
> prints out over the serial, but the system was dead.
> 

Thank you. I understand.


> I like the first patch. but you remove the protection there. It should
> have been in this patch. But it should have still added the
> functionality of the previous method.

I separated it into two parts, I thought it will good for review.
But I wrote two bad patches.

>> @@ -161,6 +167,7 @@ do_ftrace_mod_code(unsigned long ip, void *new_code)
>>  {
>>  	mod_code_ip = (void *)ip;
>>  	mod_code_newcode = new_code;
>> +	mod_code_no_write = 0;
> 
> Here's another issue, if mod_code_status failed, we do not want to have
> mod_code_no_write become zero again. The logic may indeed prevent this,
> but I rather have the logic be straight forward, and just set this to
> one when we have a failure and forget about it. Yes, it is a bit more
> expensive, but it makes the code clearer.

It confused me.

do_ftrace_mod_code() is called sequently, mod_code_no_write should become zero
in new calls.

Not like old code, when the first patch is applied, there is no NMI
is attempt to call probe_kernel_write() when we just enter do_ftrace_mod_code(),
so setting mod_code_no_write to 0 is safe.(Because the flag is not set)

Lai.



  reply	other threads:[~2009-03-18  7:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 12:54 [PATCH] ftrace: protect executing nmi Lai Jiangshan
2009-03-16 17:42 ` Steven Rostedt
2009-03-17 12:54   ` [PATCH 1/2] ftrace: protect running nmi Lai Jiangshan
2009-03-17 12:58     ` [PATCH 2/2] ftrace: fast path for do_ftrace_mod_code() Lai Jiangshan
2009-03-17 14:39       ` Steven Rostedt
2009-03-18  7:02         ` Lai Jiangshan [this message]
2009-03-18  8:42     ` [PATCH] ftrace: protect running nmi (V3) Lai Jiangshan
2009-03-19  0:33       ` Steven Rostedt
2009-03-19  2:02         ` Lai Jiangshan
2009-03-20 10:18       ` [tip:tracing/ftrace] " Lai Jiangshan

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=49C09C77.3050300@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=srostedt@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.