From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
"zhangwei(Jovi)" <jovi.zhangwei@huawei.com>,
Jiri Olsa <jolsa@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: PATCH? trace_remove_event_call() should fail if call is active
Date: Wed, 03 Jul 2013 11:42:21 +0900 [thread overview]
Message-ID: <51D38F8D.3010708@hitachi.com> (raw)
In-Reply-To: <20130702222359.GA27629@redhat.com>
(2013/07/03 7:23), Oleg Nesterov wrote:
> On 07/02, Oleg Nesterov wrote:
>>
>> So please ignore modules ;)
>
> Or lets discuss the change above.
No, I think this still doesn't ensure that we can remove dynamic
event safely. Since the event is related to several files under
events/ dir and buffer instances, someone can just stay open the
files while the event is removed and read/write it.
Perhaps, we need per-event_call refcounter not per-trace_array
one, and do as below.
Open file:
-> lock event_mutex
-> find event_call and event_file
-> get event_call
-> unlock event_mutex
Close:
-> lock event_mutex
-> put event_call
-> unlock event_mutex
Remove event (via kprobe_events):
-> lock event_mutex
-> find event_call
-> -EBUSY if event is enabled or refcount != 0
(here, no one accessing the event and not enabled)
-> unregister_kprobe
-> remove event
-> unlock event_mutex
The key is holding event_mutex *and* getting refcount
under any operation.
And of course, we can unregister the kprobe outside of
the event_mutex, but it still need a synchronize_sched
for safety.
-> lock event_mutex
-> wait_for_rcu (to ensure no disabled kprobe accesses the event)
-> find event_call
-> -EBUSY if event is enabled or refcount != 0
(here, no one accessing the event and not enabled)
-> remove event
-> unlock event_mutex
-> unregister_kprobe
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:[~2013-07-03 2:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 8:16 [PATCH 2/2] tracing/uprobes: disallow unregister trace_uprobe when trace_uprobe is in use zhangwei(Jovi)
2013-06-25 17:23 ` Oleg Nesterov
[not found] ` <20130626185205.GA27894@redhat.com>
[not found] ` <51CBEE3E.70103@hitachi.com>
[not found] ` <20130627161716.GA17889@redhat.com>
[not found] ` <51CCF8BA.4030601@hitachi.com>
[not found] ` <20130628180946.GA30838@redhat.com>
[not found] ` <51D16E1D.5040904@hitachi.com>
[not found] ` <20130702190037.GA6289@redhat.com>
2013-07-02 19:34 ` PATCH? trace_remove_event_call() should fail if call is active Oleg Nesterov
2013-07-02 21:04 ` Steven Rostedt
2013-07-02 21:35 ` Steven Rostedt
2013-07-02 21:38 ` Oleg Nesterov
2013-07-02 21:41 ` Oleg Nesterov
2013-07-02 22:23 ` Oleg Nesterov
2013-07-02 22:49 ` Steven Rostedt
2013-07-02 22:53 ` Steven Rostedt
2013-07-03 2:42 ` Masami Hiramatsu [this message]
2013-07-03 2:57 ` Steven Rostedt
2013-07-03 3:12 ` Masami Hiramatsu
2013-07-03 17:20 ` Oleg Nesterov
2013-07-03 17:54 ` Oleg Nesterov
2013-07-03 18:02 ` Steven Rostedt
2013-07-03 19:17 ` Oleg Nesterov
2013-07-03 20:34 ` Steven Rostedt
2013-07-03 20:36 ` Steven Rostedt
2013-07-03 23:11 ` Oleg Nesterov
2013-07-03 22:18 ` Oleg Nesterov
2013-07-04 0:19 ` Steven Rostedt
2013-07-03 21:02 ` Steven Rostedt
2013-07-04 4:25 ` Masami Hiramatsu
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=51D38F8D.3010708@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=jovi.zhangwei@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.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