LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/1] ring-buffer: raw spinlock fix
@ 2008-11-06  5:30 Steven Rostedt
  2008-11-06  5:30 ` [PATCH 1/1] ring-buffer: convert to raw spinlocks Steven Rostedt
  2008-11-06  6:47 ` [PATCH 0/1] ring-buffer: raw spinlock fix Ingo Molnar
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2008-11-06  5:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Heiko Carstens, Peter Zijlstra, 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 (1):
      ring-buffer: convert to raw spinlocks



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] ring-buffer: convert to raw spinlocks
  2008-11-06  5:30 [PATCH 0/1] ring-buffer: raw spinlock fix Steven Rostedt
@ 2008-11-06  5:30 ` Steven Rostedt
  2008-11-06  6:47 ` [PATCH 0/1] ring-buffer: raw spinlock fix Ingo Molnar
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2008-11-06  5:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Heiko Carstens, Peter Zijlstra, Andrew Morton,
	Steven Rostedt

[-- Attachment #1: 0001-ring-buffer-convert-to-raw-spinlocks.patch --]
[-- Type: text/plain, Size: 3732 bytes --]

Impact: no lockdep debugging of ring buffer

The problem with running lockdep on the ring buffer is that the
ring buffer is the core infrastructure of ftrace. What happens is
that the tracer will start tracing the lockdep code while lockdep
is testing the ring buffers locks.  This can cause lockdep to
fail due to testing cases that have not fully finished their
locking transition.

This patch converts the spin locks used by the ring buffer back
into raw spin locks which lockdep does not check.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/trace/ring_buffer.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a84a187..6781e9a 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -154,7 +154,7 @@ static inline int test_time_stamp(u64 delta)
 struct ring_buffer_per_cpu {
 	int				cpu;
 	struct ring_buffer		*buffer;
-	spinlock_t			lock;
+	raw_spinlock_t			lock;
 	struct lock_class_key		lock_key;
 	struct list_head		pages;
 	struct buffer_page		*head_page;	/* read from head */
@@ -291,7 +291,7 @@ rb_allocate_cpu_buffer(struct ring_buffer *buffer, int cpu)
 
 	cpu_buffer->cpu = cpu;
 	cpu_buffer->buffer = buffer;
-	spin_lock_init(&cpu_buffer->lock);
+	cpu_buffer->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
 	INIT_LIST_HEAD(&cpu_buffer->pages);
 
 	page = kzalloc_node(ALIGN(sizeof(*page), cache_line_size()),
@@ -854,7 +854,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
 	if (write > BUF_PAGE_SIZE) {
 		struct buffer_page *next_page = tail_page;
 
-		spin_lock_irqsave(&cpu_buffer->lock, flags);
+		local_irq_save(flags);
+		__raw_spin_lock(&cpu_buffer->lock);
 
 		rb_inc_page(cpu_buffer, &next_page);
 
@@ -930,7 +931,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
 			rb_set_commit_to_write(cpu_buffer);
 		}
 
-		spin_unlock_irqrestore(&cpu_buffer->lock, flags);
+		__raw_spin_unlock(&cpu_buffer->lock);
+		local_irq_restore(flags);
 
 		/* fail and let the caller try again */
 		return ERR_PTR(-EAGAIN);
@@ -953,7 +955,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
 	return event;
 
  out_unlock:
-	spin_unlock_irqrestore(&cpu_buffer->lock, flags);
+	__raw_spin_unlock(&cpu_buffer->lock);
+	local_irq_restore(flags);
 	return NULL;
 }
 
@@ -1540,7 +1543,8 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
 	unsigned long flags;
 	int nr_loops = 0;
 
-	spin_lock_irqsave(&cpu_buffer->lock, flags);
+	local_irq_save(flags);
+	__raw_spin_lock(&cpu_buffer->lock);
 
  again:
 	/*
@@ -1602,7 +1606,8 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
 	goto again;
 
  out:
-	spin_unlock_irqrestore(&cpu_buffer->lock, flags);
+	__raw_spin_unlock(&cpu_buffer->lock);
+	local_irq_restore(flags);
 
 	return reader;
 }
@@ -1871,9 +1876,11 @@ ring_buffer_read_start(struct ring_buffer *buffer, int cpu)
 	atomic_inc(&cpu_buffer->record_disabled);
 	synchronize_sched();
 
-	spin_lock_irqsave(&cpu_buffer->lock, flags);
+	local_irq_save(flags);
+	__raw_spin_lock(&cpu_buffer->lock);
 	ring_buffer_iter_reset(iter);
-	spin_unlock_irqrestore(&cpu_buffer->lock, flags);
+	__raw_spin_unlock(&cpu_buffer->lock);
+	local_irq_restore(flags);
 
 	return iter;
 }
@@ -1959,11 +1966,13 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu)
 	if (!cpu_isset(cpu, buffer->cpumask))
 		return;
 
-	spin_lock_irqsave(&cpu_buffer->lock, flags);
+	local_irq_save(flags);
+	__raw_spin_lock(&cpu_buffer->lock);
 
 	rb_reset_cpu(cpu_buffer);
 
-	spin_unlock_irqrestore(&cpu_buffer->lock, flags);
+	__raw_spin_unlock(&cpu_buffer->lock);
+	local_irq_restore(flags);
 }
 
 /**
-- 
1.5.6.5

-- 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] ring-buffer: raw spinlock fix
  2008-11-06  5:30 [PATCH 0/1] ring-buffer: raw spinlock fix Steven Rostedt
  2008-11-06  5:30 ` [PATCH 1/1] ring-buffer: convert to raw spinlocks Steven Rostedt
@ 2008-11-06  6:47 ` Ingo Molnar
  1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-11-06  6:47 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Heiko Carstens, Peter Zijlstra, Andrew Morton


* Steven Rostedt <rostedt@goodmis.org> wrote:

> 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 (1):
>       ring-buffer: convert to raw spinlocks

i've pulled these 3 commits from you:

 77b93a0: ring-buffer: convert to raw spinlocks
 615a23a: ftrace: restructure tracing start/stop infrastructure
 93411d5: ftrace: soft tracing stop and start
 da0f875: ftrace: add quick function trace stop

I topicized them into tip/tracing/ftrace, so the sha1's are different.

thanks Steve!

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-06  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-06  5:30 [PATCH 0/1] ring-buffer: raw spinlock fix Steven Rostedt
2008-11-06  5:30 ` [PATCH 1/1] ring-buffer: convert to raw spinlocks Steven Rostedt
2008-11-06  6:47 ` [PATCH 0/1] ring-buffer: raw spinlock fix 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).