mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH v4 01/11] tracing: Add support for SOFT_DISABLE to syscall events
Date: Mon, 05 Aug 2013 20:42:52 +0900	[thread overview]
Message-ID: <51FF8FBC.2090504@hitachi.com> (raw)
In-Reply-To: <86c82034b47fb27e30555aaf6a4a962e49581c1d.1375111640.git.tom.zanussi@linux.intel.com>

(2013/07/30 1:40), Tom Zanussi wrote:
> The original SOFT_DISABLE patches didn't add support for soft disable
> of syscall events; this adds it and paves the way for future patches
> allowing triggers to be added to syscall events, since triggers are
> built on top of SOFT_DISABLE.
> 
> Add an array of ftrace_event_file pointers indexed by syscall number
> to the trace array and remove the existing enabled bitmaps, which as a
> result are now redundant.  The ftrace_event_file structs in turn
> contain the soft disable flags we need for per-syscall soft disable
> accounting; later patches add additional 'trigger' flags and
> per-syscall triggers and filters.

At this point, this looks OK for me.

Note, this could be racy after introducing event-trigger which makes
some other event soft-disabled. Currently only function tracer makes
soft-disabled and it works only on the default instance.
However introducing trigger interface, there can be events in soft-mode,
and  ftrace_event_enable_disable(file, set = 0) to those events always fail.

> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  kernel/trace/trace.h          |  4 ++--
>  kernel/trace/trace_syscalls.c | 34 ++++++++++++++++++++++++++++------
>  2 files changed, 30 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index afaae41..3dd994e8 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -192,8 +192,8 @@ struct trace_array {
>  #ifdef CONFIG_FTRACE_SYSCALLS
>  	int			sys_refcount_enter;
>  	int			sys_refcount_exit;
> -	DECLARE_BITMAP(enabled_enter_syscalls, NR_syscalls);
> -	DECLARE_BITMAP(enabled_exit_syscalls, NR_syscalls);
> +	struct ftrace_event_file *enter_syscall_files[NR_syscalls];
> +	struct ftrace_event_file *exit_syscall_files[NR_syscalls];
>  #endif
>  	int			stop_count;
>  	int			clock_id;
> diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
> index 8fd0365..294cfe8 100644
> --- a/kernel/trace/trace_syscalls.c
> +++ b/kernel/trace/trace_syscalls.c
> @@ -302,6 +302,7 @@ static int __init syscall_exit_define_fields(struct ftrace_event_call *call)
>  static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
>  {
>  	struct trace_array *tr = data;
> +	struct ftrace_event_file *ftrace_file;
>  	struct syscall_trace_enter *entry;
>  	struct syscall_metadata *sys_data;
>  	struct ring_buffer_event *event;
> @@ -314,7 +315,12 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
>  	syscall_nr = trace_get_syscall_nr(current, regs);
>  	if (syscall_nr < 0)
>  		return;
> -	if (!test_bit(syscall_nr, tr->enabled_enter_syscalls))
> +

OK, since all tracepoint handlers run under rcu_read_lock, we can safely
use rcu_dereference_raw() here. :)
To avoid misread, I think you'd better add a comment here.

> +	ftrace_file = rcu_dereference_raw(tr->enter_syscall_files[syscall_nr]);
> +	if (!ftrace_file)
> +		return;
> +
> +	if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &ftrace_file->flags))
>  		return;
>  

Thank you,


-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2013-08-05 11:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 16:40 [PATCH v4 00/11] tracing: trace event triggers Tom Zanussi
2013-07-29 16:40 ` [PATCH v4 01/11] tracing: Add support for SOFT_DISABLE to syscall events Tom Zanussi
2013-08-05 11:42   ` Masami Hiramatsu [this message]
2013-07-29 16:40 ` [PATCH v4 02/11] tracing: add basic event trigger framework Tom Zanussi
2013-08-08  8:30   ` Masami Hiramatsu
2013-08-22 19:54     ` Tom Zanussi
2013-07-29 16:40 ` [PATCH v4 03/11] tracing: add 'traceon' and 'traceoff' event trigger commands Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 04/11] tracing: add 'snapshot' event trigger command Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 05/11] tracing: add 'stacktrace' " Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 06/11] tracing: add 'enable_event' and 'disable_event' event trigger commands Tom Zanussi
2013-08-08  5:54   ` Masami Hiramatsu
2013-07-29 16:41 ` [PATCH v4 07/11] tracing: add and use generic set_trigger_filter() implementation Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 08/11] tracing: update event filters for multibuffer Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 09/11] tracing: add documentation for trace event triggers Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 10/11] tracing: make register/unregister_ftrace_command __init Tom Zanussi
2013-07-29 16:41 ` [PATCH v4 11/11] tracing: change event_trigger_open to verify i_private != NULL Tom Zanussi
2013-08-08  2:02 ` [PATCH v4 00/11] tracing: trace event triggers Masami Hiramatsu
2013-08-08  2:15   ` Steven Rostedt
2013-08-22 19:48   ` Tom Zanussi
2013-08-22 23:26     ` Tom Zanussi

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=51FF8FBC.2090504@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.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

Powered by JetHome