From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Petr Mladek <pmladek@suse.cz>,
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 v6 3/8] x86: add generic function to modify more calls using int3 framework
Date: Wed, 15 Jan 2014 17:18:01 +0900 [thread overview]
Message-ID: <52D64439.5040800@hitachi.com> (raw)
In-Reply-To: <20140114193338.4375f205@gandalf.local.home>
(2014/01/15 9:33), Steven Rostedt wrote:
> On Tue, 10 Dec 2013 16:42:15 +0100
> Petr Mladek <pmladek@suse.cz> wrote:
>
>> diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
>> index 586747f5f41d..82ffe7e1529c 100644
>> --- a/arch/x86/include/asm/alternative.h
>> +++ b/arch/x86/include/asm/alternative.h
>> @@ -232,4 +232,40 @@ extern int text_poke_bp(void *addr, const void *opcode, size_t len,
>> extern void text_poke_bp_or_die(void *addr, const void *opcode, size_t len,
>> void *handler);
>
> Small nit. If you can, place comments on the same line as the
> structure field.
>
>> +struct text_poke_bp_iter {
>> + /* information used to start iteration from the beginning */
>> + void *init;
>> + /* length of the patched instruction */
>> + size_t len;
>> + /* details about failure if any */
>> + int fail_count;
>> + void *fail_addr;
>
> The above should have the comments on the same line as the field.
> Something like this:
>
> void *init; /* information used to start
> iteration from the beginning */
>
> The comments for the function pointers below are fine.
>
>> + /* iteration over entries */
>> + void *(*start)(void *init);
>> + void *(*next)(void *prev);
>> + /* callback to get patched address */
>> + void *(*get_addr)(void *cur);
>> + /*
>> + * Callbacks to get the patched code. They could return NULL if no
>> + * patching is needed; This is useful for example in ftrace.
>> + */
>> + const void *(*get_opcode)(void *cur);
>> + const void *(*get_old_opcode)(void *cur);
>> + /*
>> + * Optional function that is called when the patching of the given
>> + * has finished. It might be NULL if no postprocess is needed.
>> + */
>> + int (*finish)(void *cur);
>> + /*
>> + * Helper function for int3 handler. It decides whether the given IP
>> + * is being patched or not.
>> + *
>> + * Try to implement it as fast as possible. It affects performance
>> + * of the system when the patching is in progress.
>> + */
>> + void *(*is_handled)(const unsigned long ip);
>> +};
>> +
>> +extern int text_poke_bp_list(struct text_poke_bp_iter *iter);
>> +
>> #endif /* _ASM_X86_ALTERNATIVE_H */
>> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>> index 6436beec7b0c..8e57ac03a0e8 100644
>> --- a/arch/x86/kernel/alternative.c
>> +++ b/arch/x86/kernel/alternative.c
>> @@ -7,6 +7,7 @@
>> #include <linux/stringify.h>
>> #include <linux/kprobes.h>
>> #include <linux/mm.h>
>> +#include <linux/uaccess.h>
>> #include <linux/vmalloc.h>
>> #include <linux/memory.h>
>> #include <linux/stop_machine.h>
>> @@ -610,8 +611,11 @@ static void run_sync(void)
>> on_each_cpu(do_sync_core, NULL, 1);
>> }
>>
>> +static char bp_int3;
>
> bp_int3 is not going to be anything but 0xcc. Let's change that to:
>
> static char bp_int3 = 0xcc;
>
> And remove the other initializations.
just a comment.
If it is always 0xcc, it should be a const variable.
Thank you,
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2014-01-15 8:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 15:42 [PATCH v6 0/8] x86: use new text_poke_bp in ftrace Petr Mladek
2013-12-10 15:42 ` [PATCH v6 1/8] x86: allow to handle errors in text_poke function family Petr Mladek
2013-12-11 2:52 ` Masami Hiramatsu
2014-01-14 23:20 ` Steven Rostedt
2014-01-21 13:00 ` Petr Mladek
2014-01-21 14:02 ` Steven Rostedt
2014-01-22 0:52 ` Masami Hiramatsu
2014-01-22 1:18 ` Steven Rostedt
2013-12-10 15:42 ` [PATCH v6 2/8] x86: allow to call text_poke_bp during boot Petr Mladek
2013-12-10 15:46 ` Borislav Petkov
2013-12-10 16:01 ` Steven Rostedt
2013-12-10 16:08 ` Borislav Petkov
2013-12-10 16:44 ` Petr Mladek
2013-12-10 15:42 ` [PATCH v6 3/8] x86: add generic function to modify more calls using int3 framework Petr Mladek
2014-01-15 0:33 ` Steven Rostedt
2014-01-15 8:18 ` Masami Hiramatsu [this message]
2014-01-15 14:11 ` Steven Rostedt
2014-01-21 13:50 ` Petr Mladek
2014-01-21 14:07 ` Steven Rostedt
2013-12-10 15:42 ` [PATCH v6 4/8] x86: speed up int3-based patching using direct write Petr Mladek
2014-01-15 0:45 ` Steven Rostedt
2013-12-10 15:42 ` [PATCH v6 5/8] x86: do not trace __probe_kernel_read Petr Mladek
2014-01-15 0:51 ` Steven Rostedt
2013-12-10 15:42 ` [PATCH v6 6/8] x86: modify ftrace function using the new int3-based framework Petr Mladek
2014-01-15 1:04 ` Steven Rostedt
2013-12-10 15:42 ` [PATCH v6 7/8] x86: patch all traced function calls using the " Petr Mladek
2014-01-15 15:47 ` Steven Rostedt
2014-01-22 13:20 ` Petr Mladek
2014-01-23 14:21 ` Petr Mladek
2014-01-23 16:10 ` Steven Rostedt
2013-12-10 15:42 ` [PATCH v6 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=52D64439.5040800@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=fweisbec@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pmladek@suse.cz \
--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