mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.cz>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Jiri Kosina <jkosina@suse.cz>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH v3 4/8] x86: speed up int3-based patching using direct write
Date: Thu, 14 Nov 2013 13:46:39 +0100	[thread overview]
Message-ID: <1384433199.17374.19.camel@pathway.suse.cz> (raw)
In-Reply-To: <5284B5D2.70206@hitachi.com>

Masami Hiramatsu píše v Čt 14. 11. 2013 v 20:36 +0900:
> (2013/11/14 19:41), Petr Mladek wrote:
> > @@ -837,7 +882,7 @@ static void recover_iter(struct text_poke_bp_iter *iterator,
> >  	}
> >  
> >  	/* Finally, put back the first byte from the old code */
> > -	err = text_poke(addr, old_opcode, sizeof(bp_int3));
> > +	err = text_poke_part(addr, old_opcode, sizeof(bp_int3));
> >  	/* we can not continue if the interrupt is still there */
> >  	BUG_ON(err);
> >  }
> > @@ -865,7 +910,9 @@ static void recover_iter(struct text_poke_bp_iter *iterator,
> >   * It is a bit more paranoid than text_poke_bp because it checks the actual
> >   * code before patching. This is a good practice proposed by the ftrace code.
> >   *
> > - * Note: This function must be called under text_mutex.
> > + * Note: This function must be called under text_mutex. Also the caller is
> > + * responsible for making the patched code read-write, for example using
> > + * set_kernel_text_rw() and set_all_modules_text_rw()
> 
> OK, I got the reason why we can do it.
> But if so, we should change all existing caller of text_poke_bp() to
> call it in this patch, or they must fail at this point.

Ah, I used "text_poke_part" only in "text_poke_bp_iter" in the end. This
function is currently used only in ftrace that sets the code read-write
in "ftrace_arch_code_modify_prepare", see arch/x86/kernel/ftrace.c.

Note that "text_poke_bp" still uses "text_poke". It seems that the
remapping is faster if you patch only one address.

So, we should be on the safe side.

Thanks a lot for review.

Best Regards,
Petr


  reply	other threads:[~2013-11-14 12:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 10:41 [PATCH v3 0/8] x86: use new text_poke_bp in ftrace Petr Mladek
2013-11-14 10:41 ` [PATCH v3 1/8] x86: allow to handle errors in text_poke function family Petr Mladek
2013-11-14 11:10   ` Masami Hiramatsu
2013-11-14 10:41 ` [PATCH v3 2/8] x86: allow to call text_poke_bp during boot Petr Mladek
2013-11-14 11:12   ` Masami Hiramatsu
2013-11-14 10:41 ` [PATCH v3 3/8] x86: add generic function to modify more calls using int3 framework Petr Mladek
2013-11-14 10:41 ` [PATCH v3 4/8] x86: speed up int3-based patching using direct write Petr Mladek
2013-11-14 11:36   ` Masami Hiramatsu
2013-11-14 12:46     ` Petr Mladek [this message]
2013-11-14 13:07       ` Masami Hiramatsu
2013-11-14 10:41 ` [PATCH v3 5/8] x86: do not trace __probe_kernel_read Petr Mladek
2013-11-14 10:41 ` [PATCH v3 6/8] x86: modify ftrace function using the new int3-based framework Petr Mladek
2013-11-14 10:41 ` [PATCH v3 7/8] x86: patch all traced function calls using the " Petr Mladek
2013-11-14 10:41 ` [PATCH v3 8/8] x86: enable/disable ftrace graph call using new " Petr Mladek

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=1384433199.17374.19.camel@pathway.suse.cz \
    --to=pmladek@suse.cz \
    --cc=fweisbec@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=x86@kernel.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

Powered by JetHome