LKML Archive on lore.kernel.org help / color / mirror / Atom feed
* [PATCH 0/2] ring-buffer updates for tip @ 2008-11-12 5:01 Steven Rostedt 2008-11-12 5:01 ` [PATCH 1/2] ring-buffer: fix deadlock from reader_lock in read_start Steven Rostedt 2008-11-12 5:01 ` [PATCH 2/2] ring-buffer: no preempt for sched_clock Steven Rostedt 0 siblings, 2 replies; 5+ messages in thread From: Steven Rostedt @ 2008-11-12 5:01 UTC (permalink / raw) To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton Ingo, The following patches are in: git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git branch: tip/devel Steven Rostedt (2): ring-buffer: fix deadlock from reader_lock in read_start ring-buffer: no preempt for sched_clock ---- kernel/trace/ring_buffer.c | 37 ++++++++++++++++++++++++------------- 1 files changed, 24 insertions(+), 13 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ring-buffer: fix deadlock from reader_lock in read_start 2008-11-12 5:01 [PATCH 0/2] ring-buffer updates for tip Steven Rostedt @ 2008-11-12 5:01 ` Steven Rostedt 2008-11-12 10:25 ` Ingo Molnar 2008-11-12 5:01 ` [PATCH 2/2] ring-buffer: no preempt for sched_clock Steven Rostedt 1 sibling, 1 reply; 5+ messages in thread From: Steven Rostedt @ 2008-11-12 5:01 UTC (permalink / raw) To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Steven Rostedt [-- Attachment #1: 0001-ring-buffer-fix-deadlock-from-reader_lock-in-read_s.patch --] [-- Type: text/plain, Size: 2276 bytes --] Impact: deadlock fix in ring_buffer_read_start The ring_buffer_iter_reset was called from ring_buffer_read_start where both grabbed the reader_lock. This patch separates out the internals of ring_buffer_iter_reset to its own function so that both APIs may grab the reader_lock. Signed-off-by: Steven Rostedt <srostedt@redhat.com> --- kernel/trace/ring_buffer.c | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index c04c433..86dc353 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1475,19 +1475,9 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer) return overruns; } -/** - * ring_buffer_iter_reset - reset an iterator - * @iter: The iterator to reset - * - * Resets the iterator, so that it will start from the beginning - * again. - */ -void ring_buffer_iter_reset(struct ring_buffer_iter *iter) +static void rb_iter_reset(struct ring_buffer_iter *iter) { struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; - unsigned long flags; - - spin_lock_irqsave(&cpu_buffer->reader_lock, flags); /* Iterator usage is expected to have record disabled */ if (list_empty(&cpu_buffer->reader_page->list)) { @@ -1501,7 +1491,22 @@ void ring_buffer_iter_reset(struct ring_buffer_iter *iter) iter->read_stamp = cpu_buffer->read_stamp; else iter->read_stamp = iter->head_page->time_stamp; +} +/** + * ring_buffer_iter_reset - reset an iterator + * @iter: The iterator to reset + * + * Resets the iterator, so that it will start from the beginning + * again. + */ +void ring_buffer_iter_reset(struct ring_buffer_iter *iter) +{ + struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; + unsigned long flags; + + spin_lock_irqsave(&cpu_buffer->reader_lock, flags); + rb_iter_reset(iter); spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); } @@ -1957,7 +1962,7 @@ ring_buffer_read_start(struct ring_buffer *buffer, int cpu) spin_lock_irqsave(&cpu_buffer->reader_lock, flags); __raw_spin_lock(&cpu_buffer->lock); - ring_buffer_iter_reset(iter); + rb_iter_reset(iter); __raw_spin_unlock(&cpu_buffer->lock); spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); -- 1.5.6.5 -- ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ring-buffer: fix deadlock from reader_lock in read_start 2008-11-12 5:01 ` [PATCH 1/2] ring-buffer: fix deadlock from reader_lock in read_start Steven Rostedt @ 2008-11-12 10:25 ` Ingo Molnar 0 siblings, 0 replies; 5+ messages in thread From: Ingo Molnar @ 2008-11-12 10:25 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton, Steven Rostedt * Steven Rostedt <rostedt@goodmis.org> wrote: > Impact: deadlock fix in ring_buffer_read_start > > The ring_buffer_iter_reset was called from ring_buffer_read_start > where both grabbed the reader_lock. > > This patch separates out the internals of ring_buffer_iter_reset > to its own function so that both APIs may grab the reader_lock. > > Signed-off-by: Steven Rostedt <srostedt@redhat.com> > --- > kernel/trace/ring_buffer.c | 29 +++++++++++++++++------------ > 1 files changed, 17 insertions(+), 12 deletions(-) applied to tip/tracing/ring-buffer, thanks Steve! Ingo ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ring-buffer: no preempt for sched_clock 2008-11-12 5:01 [PATCH 0/2] ring-buffer updates for tip Steven Rostedt 2008-11-12 5:01 ` [PATCH 1/2] ring-buffer: fix deadlock from reader_lock in read_start Steven Rostedt @ 2008-11-12 5:01 ` Steven Rostedt 2008-11-12 10:24 ` Ingo Molnar 1 sibling, 1 reply; 5+ messages in thread From: Steven Rostedt @ 2008-11-12 5:01 UTC (permalink / raw) To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Steven Rostedt [-- Attachment #1: 0002-ring-buffer-no-preempt-for-sched_clock.patch --] [-- Type: text/plain, Size: 1049 bytes --] Impact: disable preemption no calling sched_clock The ring_buffer_time_stamp still uses sched_clock as its counter. But it is a bug to call it with preemption enabled. This requirement should not be pushed to the ring_buffer_time_stamp callers, so the ring_buffer_time_stamp needs to disable preemption when calling sched_clock. Signed-off-by: Steven Rostedt <srostedt@redhat.com> --- kernel/trace/ring_buffer.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 86dc353..2d6c2cf 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -53,8 +53,14 @@ void tracing_off(void) /* FIXME!!! */ u64 ring_buffer_time_stamp(int cpu) { + u64 time; + + preempt_disable_notrace(); /* shift to debug/test normalization and TIME_EXTENTS */ - return sched_clock() << DEBUG_SHIFT; + time = sched_clock() << DEBUG_SHIFT; + preempt_enable_notrace(); + + return time; } void ring_buffer_normalize_time_stamp(int cpu, u64 *ts) -- 1.5.6.5 -- ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ring-buffer: no preempt for sched_clock 2008-11-12 5:01 ` [PATCH 2/2] ring-buffer: no preempt for sched_clock Steven Rostedt @ 2008-11-12 10:24 ` Ingo Molnar 0 siblings, 0 replies; 5+ messages in thread From: Ingo Molnar @ 2008-11-12 10:24 UTC (permalink / raw) To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton, Steven Rostedt * Steven Rostedt <rostedt@goodmis.org> wrote: > Impact: disable preemption no calling sched_clock > > The ring_buffer_time_stamp still uses sched_clock as its counter. > But it is a bug to call it with preemption enabled. This requirement > should not be pushed to the ring_buffer_time_stamp callers, so > the ring_buffer_time_stamp needs to disable preemption when calling > sched_clock. > > Signed-off-by: Steven Rostedt <srostedt@redhat.com> > --- > kernel/trace/ring_buffer.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) applied to tip/tracing/urgent, thanks Steve! Ingo ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-11-12 10:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-11-12 5:01 [PATCH 0/2] ring-buffer updates for tip Steven Rostedt 2008-11-12 5:01 ` [PATCH 1/2] ring-buffer: fix deadlock from reader_lock in read_start Steven Rostedt 2008-11-12 10:25 ` Ingo Molnar 2008-11-12 5:01 ` [PATCH 2/2] ring-buffer: no preempt for sched_clock Steven Rostedt 2008-11-12 10:24 ` Ingo Molnar
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).