From: Oleg Nesterov <oleg@redhat.com>
To: Al Viro <viro@zeniv.linux.org.uk>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Alexander Z Lam <azl@google.com>,
David Sharp <dhsharp@google.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Vaibhav Nagarnaik <vnagarnaik@google.com>,
"zhangwei(Jovi)" <jovi.zhangwei@huawei.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/7] tracing: Kill the buggy trace_cpu
Date: Tue, 23 Jul 2013 17:25:31 +0200 [thread overview]
Message-ID: <20130723152531.GA23688@redhat.com> (raw)
Hello.
This series kills tracing_open_generic_tc/trace_cpu/etc.
trace_array_get(inode->i_private) is mostly fine, we do not
dereference this pointer untill trace_array_get() succeeds.
But trace_array_get(tc->tr) is wrong by the same reason why
tracing_open_generic_file/etc are wrong, see 1/7.
(Steven, I think you are right and we can also remove the
list_for_each_entry() loop from trace_array_get() later,
and avoid the (harmless but still) race with rmdir + mkdir.
Lets discuss this after we fix the problems with file/call).
Changes:
1/7: Fix the whitespace problems.
Add the comment above tracing_get_cpu() and update
the changelog. tracing_get_cpu() is always safe but
the code like
cpu = tracing_get_cpu(inode);
if (trace_array_get(tr) == 0)
do_something(tr, cpu);
is racy, it can wrongly use RING_BUFFER_ALL_CPUS.
IOW, tracing_get_cpu() should be used only after
trace_array_get() or something else which takes
trace_types_lock at least once.
5/7: No changes. checkpatch.pl complains, but that
"line over 80 characters" in tracing_entries_read()
was not added by this patch and I do not know how
can I make checkpatch.pl happy without adding a
helper for per_cpu_ptr(tr->trace_buffer.data).
6/7: Incorporated the fix from Steven (thanks!).
Oleg.
kernel/trace/trace.c | 194 +++++++++++++++++++++-----------------------------
kernel/trace/trace.h | 8 --
2 files changed, 80 insertions(+), 122 deletions(-)
next reply other threads:[~2013-07-23 15:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 15:25 Oleg Nesterov [this message]
2013-07-23 15:25 ` [PATCH v2 1/7] tracing: Introduce trace_create_cpu_file() and tracing_get_cpu() Oleg Nesterov
2013-07-23 15:25 ` [PATCH v2 2/7] tracing: Change tracing_pipe_fops() to rely on tracing_get_cpu() Oleg Nesterov
2013-07-23 15:26 ` [PATCH v2 3/7] tracing: Change tracing_buffers_fops " Oleg Nesterov
2013-07-23 15:26 ` [PATCH v2 4/7] tracing: Change tracing_stats_fops " Oleg Nesterov
2013-07-23 15:26 ` [PATCH v2 5/7] tracing: Change tracing_entries_fops " Oleg Nesterov
2013-07-23 15:26 ` [PATCH v2 6/7] tracing: Change tracing_fops/snapshot_fops " Oleg Nesterov
2013-07-23 15:26 ` [PATCH v2 7/7] tracing: Kill trace_cpu struct/members Oleg Nesterov
2013-07-23 15:34 ` [PATCH v2 0/7] tracing: Kill the buggy trace_cpu Steven Rostedt
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=20130723152531.GA23688@redhat.com \
--to=oleg@redhat.com \
--cc=azl@google.com \
--cc=dhsharp@google.com \
--cc=fweisbec@gmail.com \
--cc=jovi.zhangwei@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=viro@zeniv.linux.org.uk \
--cc=vnagarnaik@google.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;
as well as URLs for NNTP newsgroup(s).