From: Steven Rostedt <rostedt@goodmis.org>
To: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>, Michael Rubin <mrubin@google.com>,
David Sharp <dhsharp@google.com>,
Justin Teravest <teravest@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/4] trace: Make removal of ring buffer pages atomic
Date: Sat, 21 Apr 2012 00:27:40 -0400 [thread overview]
Message-ID: <1334982460.28106.90.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1328212844-11889-2-git-send-email-vnagarnaik@google.com>
On Thu, 2012-02-02 at 12:00 -0800, Vaibhav Nagarnaik wrote:
> This patch adds the capability to remove pages from a ring buffer
> without destroying any existing data in it.
>
> This is done by removing the pages after the tail page. This makes sure
> that first all the empty pages in the ring buffer are removed. If the
> head page is one in the list of pages to be removed, then the page after
> the removed ones is made the head page. This removes the oldest data
> from the ring buffer and keeps the latest data around to be read.
>
> To do this in a non-racey manner, tracing is stopped for a very short
> time while the pages to be removed are identified and unlinked from the
> ring buffer. The pages are freed after the tracing is restarted to
> minimize the time needed to stop tracing.
>
> The context in which the pages from the per-cpu ring buffer are removed
> runs on the respective CPU. This minimizes the events not traced to only
> NMI trace contexts.
Can't do this. (see below)
> +rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned int
> nr_pages)
> {
> - struct buffer_page *bpage;
> - struct list_head *p;
> - unsigned i;
> + unsigned int nr_removed;
> + int page_entries;
> + struct list_head *tail_page, *to_remove, *next_page;
> + unsigned long head_bit;
> + struct buffer_page *last_page, *first_page;
> + struct buffer_page *to_remove_page, *tmp_iter_page;
>
Also, please use the "upside down x-mas tree" for the declarations:
ie.
struct list_head *tail_page, *to_remove, *next_page;
struct buffer_page *to_remove_page, *tmp_iter_page;
struct buffer_page *last_page, *first_page;
unsigned int nr_removed;
unsigned long head_bit;
int page_entries;
See, it looks easier to read then what you had.
> + /* fire off all the required work handlers */
> + for_each_buffer_cpu(buffer, cpu) {
> + cpu_buffer = buffer->buffers[cpu];
> + if (!cpu_buffer->nr_pages_to_update)
> + continue;
> + schedule_work_on(cpu, &cpu_buffer->update_pages_work);
This locks up. I just tried the following, and it hung the task.
Here:
# cd /sys/kernel/debug/tracing
# echo 1 > events/enable
# sleep 10
# echo 0 > event/enable
# echo 0 > /sys/devices/system/cpu/cpu1/online
# echo 100 > buffer_size_kb
<locked!>
I guess you could test if the cpu is online. And if so, then do the
schedule_work_on(). You will need to get_online_cpus first.
If the cpu is offline, just change it.
-- Steve
PS. The first patch looks good, but I think you need to add some more
blank lines in your patches. You like to bunch a lot of text together,
and that causes some eye strain.
next prev parent reply other threads:[~2012-04-21 4:27 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 22:59 [PATCH 0/5] Add dynamic updates to trace ring buffer Vaibhav Nagarnaik
2011-07-26 22:59 ` [PATCH 1/5] trace: Add a new readonly entry to report total buffer size Vaibhav Nagarnaik
2011-07-29 18:01 ` Steven Rostedt
2011-07-29 19:09 ` Vaibhav Nagarnaik
2011-07-26 22:59 ` [PATCH 2/5] trace: Add ring buffer stats to measure rate of events Vaibhav Nagarnaik
2011-07-29 18:10 ` Steven Rostedt
2011-07-29 19:10 ` Vaibhav Nagarnaik
2011-07-26 22:59 ` [PATCH 3/5] trace: Add per_cpu ring buffer control files Vaibhav Nagarnaik
2011-07-29 18:14 ` Steven Rostedt
2011-07-29 19:13 ` Vaibhav Nagarnaik
2011-07-29 21:25 ` Steven Rostedt
2011-07-26 22:59 ` [PATCH 4/5] trace: Make removal of ring buffer pages atomic Vaibhav Nagarnaik
2011-07-29 21:23 ` Steven Rostedt
2011-07-29 23:30 ` Vaibhav Nagarnaik
2011-07-30 1:12 ` Steven Rostedt
2011-07-30 1:50 ` David Sharp
2011-07-30 2:43 ` Steven Rostedt
2011-07-30 3:44 ` David Sharp
2011-07-26 22:59 ` [PATCH 5/5] trace: Make addition of pages in ring buffer atomic Vaibhav Nagarnaik
2011-08-16 21:46 ` [PATCH v2 0/5] Add dynamic updates to trace ring buffer Vaibhav Nagarnaik
2011-08-16 21:46 ` [PATCH v2 1/5] trace: Add a new readonly entry to report total buffer size Vaibhav Nagarnaik
2011-08-16 21:46 ` [PATCH v2 2/5] trace: Add ring buffer stats to measure rate of events Vaibhav Nagarnaik
2011-08-16 21:46 ` [PATCH v2 3/5] trace: Add per_cpu ring buffer control files Vaibhav Nagarnaik
2011-08-22 20:29 ` Steven Rostedt
2011-08-22 20:36 ` Vaibhav Nagarnaik
2011-08-22 22:09 ` [PATCH v3] " Vaibhav Nagarnaik
2011-08-23 0:49 ` Steven Rostedt
2011-08-23 1:16 ` Vaibhav Nagarnaik
2011-08-23 1:17 ` Vaibhav Nagarnaik
2011-09-03 2:45 ` Steven Rostedt
2011-09-06 18:56 ` Vaibhav Nagarnaik
2011-09-07 17:13 ` Steven Rostedt
2011-10-12 1:20 ` [PATCH v4 1/4] " Vaibhav Nagarnaik
2012-01-31 23:53 ` Vaibhav Nagarnaik
2012-02-02 2:42 ` Steven Rostedt
2012-02-02 19:20 ` Vaibhav Nagarnaik
2012-02-02 20:00 ` [PATCH v5 " Vaibhav Nagarnaik
2012-02-02 20:00 ` [PATCH v5 2/4] trace: Make removal of ring buffer pages atomic Vaibhav Nagarnaik
2012-04-21 4:27 ` Steven Rostedt [this message]
2012-04-23 17:31 ` Vaibhav Nagarnaik
2012-04-25 21:18 ` [PATCH v6 1/3] " Vaibhav Nagarnaik
2012-04-25 21:18 ` [PATCH v6 2/3] trace: Make addition of pages in ring buffer atomic Vaibhav Nagarnaik
2012-04-25 21:18 ` [PATCH v6 3/3] trace: change CPU ring buffer state from tracing_cpumask Vaibhav Nagarnaik
2012-05-03 1:55 ` [PATCH v6 1/3] trace: Make removal of ring buffer pages atomic Steven Rostedt
2012-05-03 6:40 ` Vaibhav Nagarnaik
2012-05-03 12:57 ` Steven Rostedt
2012-05-03 14:12 ` Steven Rostedt
2012-05-03 18:43 ` Vaibhav Nagarnaik
2012-05-03 18:54 ` Steven Rostedt
2012-05-03 18:54 ` Vaibhav Nagarnaik
2012-05-04 1:59 ` [PATCH v7 " Vaibhav Nagarnaik
2012-05-04 1:59 ` [PATCH v7 2/3] trace: Make addition of pages in ring buffer atomic Vaibhav Nagarnaik
2012-05-19 10:18 ` [tip:perf/core] ring-buffer: " tip-bot for Vaibhav Nagarnaik
2012-05-04 1:59 ` [PATCH v7 3/3] trace: change CPU ring buffer state from tracing_cpumask Vaibhav Nagarnaik
2012-05-19 10:21 ` [tip:perf/core] tracing: " tip-bot for Vaibhav Nagarnaik
2012-05-07 20:22 ` [PATCH v7 1/3] trace: Make removal of ring buffer pages atomic Steven Rostedt
2012-05-07 21:48 ` Vaibhav Nagarnaik
2012-05-08 0:14 ` Steven Rostedt
2012-05-09 3:38 ` Steven Rostedt
2012-05-09 5:00 ` Vaibhav Nagarnaik
2012-05-09 14:29 ` Steven Rostedt
2012-05-09 17:46 ` Vaibhav Nagarnaik
2012-05-09 17:54 ` Steven Rostedt
2012-05-19 10:17 ` [tip:perf/core] ring-buffer: " tip-bot for Vaibhav Nagarnaik
2012-02-02 20:00 ` [PATCH v5 3/4] trace: Make addition of pages in ring buffer atomic Vaibhav Nagarnaik
2012-02-02 20:00 ` [PATCH v5 4/4] trace: change CPU ring buffer state from tracing_cpumask Vaibhav Nagarnaik
2012-03-08 23:51 ` [PATCH v5 1/4] trace: Add per_cpu ring buffer control files Vaibhav Nagarnaik
2012-05-02 21:03 ` [tip:perf/core] ring-buffer: " tip-bot for Vaibhav Nagarnaik
2011-10-12 1:20 ` [PATCH v4 2/4] trace: Make removal of ring buffer pages atomic Vaibhav Nagarnaik
2011-10-12 1:20 ` [PATCH v4 3/4] trace: Make addition of pages in ring buffer atomic Vaibhav Nagarnaik
2011-10-12 1:20 ` [PATCH v4 4/4] trace: change CPU ring buffer state from tracing_cpumask Vaibhav Nagarnaik
2011-08-16 21:46 ` [PATCH v2 4/5] trace: Make removal of ring buffer pages atomic Vaibhav Nagarnaik
2011-08-23 3:27 ` Steven Rostedt
2011-08-23 18:55 ` Vaibhav Nagarnaik
2011-08-23 18:55 ` [PATCH v3 " Vaibhav Nagarnaik
2011-08-23 19:16 ` David Sharp
2011-08-23 19:20 ` Vaibhav Nagarnaik
2011-08-23 19:24 ` Steven Rostedt
2011-08-23 18:55 ` [PATCH v3 5/5] trace: Make addition of pages in ring buffer atomic Vaibhav Nagarnaik
2011-08-16 21:46 ` [PATCH v2 " Vaibhav Nagarnaik
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=1334982460.28106.90.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=dhsharp@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mrubin@google.com \
--cc=teravest@google.com \
--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
all inboxes | Powered by JetHome®