From: Steven Rostedt <rostedt@goodmis.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: John Kacur <jkacur@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Clark Williams <williams@redhat.com>
Subject: Re: [PATCH 14/26] trace: Convert various locks to raw_spinlock
Date: Wed, 13 Jan 2010 10:28:24 -0500 [thread overview]
Message-ID: <20100113152824.GA15301@goodmis.org> (raw)
In-Reply-To: <20100112033931.GF5243@nowhere>
On Tue, Jan 12, 2010 at 04:39:32AM +0100, Frederic Weisbecker wrote:
> On Mon, Jan 11, 2010 at 10:26:44PM +0100, John Kacur wrote:
> > Convert locks that cannot sleep in preempt-rt to raw_spinlocks.
> >
> > See also: 87654a70523a8c5baadcbbc07d80cbae8f912837
> >
> > Signed-off-by: John Kacur <jkacur@redhat.com>
> > ---
> > kernel/trace/ring_buffer.c | 52 +++++++++++++++++++++---------------------
> > kernel/trace/trace.c | 10 ++++----
> > kernel/trace/trace_irqsoff.c | 6 ++--
> > 3 files changed, 34 insertions(+), 34 deletions(-)
> >
> > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> > index 2326b04..ffaddc5 100644
> > --- a/kernel/trace/ring_buffer.c
> > +++ b/kernel/trace/ring_buffer.c
> > @@ -422,7 +422,7 @@ int ring_buffer_print_page_header(struct trace_seq *s)
> > struct ring_buffer_per_cpu {
> > int cpu;
> > struct ring_buffer *buffer;
> > - spinlock_t reader_lock; /* serialize readers */
> > + raw_spinlock_t reader_lock; /* serialize readers */
>
>
>
> Why this one? This is a reader lock, not taken in any tracing fast path
> places. Why should it never sleep in rt, it's taken by a reader of the ring
> buffer, which doesn't seem to me involved in any critical work.
>
> I may be wrong though, better wait for Steve to correct me
> if needed.
>
> In any case, the changelog needs more details about the individual
> purpose of this patch.
At first I would agree, but looking at where the lock is taken, the one place
that worries me is in ftrace_dump(). It can be called with interrupts
disabled, and if so, it will take this lock. If we let this lock convert
to a mutex, then it can cause issues when ftrace_dump() takes the lock with
interrupts disabled.
>
>
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 0df1b0f..0c6bbcb 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -258,7 +258,7 @@ unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
> > TRACE_ITER_GRAPH_TIME;
> >
> > static int trace_stop_count;
> > -static DEFINE_SPINLOCK(tracing_start_lock);
> > +static DEFINE_RAW_SPINLOCK(tracing_start_lock);
>
>
> Same here. I don't understand why this should never sleep in -rt.
> This is not a critical lock. It is taken in rare and not critical
> places, mostly in reader places when we open/release a trace
> file and also in tracing selftests.
This one I don't see as an issue in changing to a mutex in -rt.
So I agree with Frederic on this.
>
>
>
> > diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
> > index 2974bc7..60ba58e 100644
> > --- a/kernel/trace/trace_irqsoff.c
> > +++ b/kernel/trace/trace_irqsoff.c
> > @@ -23,7 +23,7 @@ static int tracer_enabled __read_mostly;
> >
> > static DEFINE_PER_CPU(int, tracing_cpu);
> >
> > -static DEFINE_SPINLOCK(max_trace_lock);
> > +static DEFINE_RAW_SPINLOCK(max_trace_lock);
>
>
> But there yeah, it does seem necessary as it is involved
> in irqsoff tracing fastpath.
>
> This needs a comment though.
Yeah, you can simply say, this lock is taken by the interrupts off latency
tracer and will always be taken with interrupts disabled.
-- Steve
next prev parent reply other threads:[~2010-01-13 15:28 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 21:26 [PATCH 00/26] Convert locks that can't sleep in -rt to raw_spinlock John Kacur
2010-01-11 21:26 ` [PATCH 01/26] xtime_lock: Convert atomic_seqlock to raw_seqlock, fix up all users John Kacur
2010-01-11 21:26 ` [PATCH 02/26] seqlock: Create raw_seqlock John Kacur
2010-01-11 21:26 ` [PATCH 03/26] x86: Convert tlbstate_lock to raw_spinlock John Kacur
2010-01-11 21:26 ` [PATCH 04/26] sched: Convert thread_group_cputimer lock " John Kacur
2010-01-11 21:26 ` [PATCH 05/26] x86: Convert ioapic_lock and vector_lock to raw_spinlocks John Kacur
2010-01-11 21:26 ` [PATCH 06/26] x86: Convert i8259A_lock to raw_spinlock John Kacur
2010-01-11 21:26 ` [PATCH 07/26] x86: Convert pci_config_lock " John Kacur
2010-01-11 21:26 ` [PATCH 08/26] i8253: Convert i8253_lock " John Kacur
2010-01-11 21:26 ` [PATCH 09/26] x86: Convert set_atomicity_lock " John Kacur
2010-01-11 21:26 ` [PATCH 10/26] ACPI: Convert c3_lock " John Kacur
2010-01-11 21:26 ` [PATCH 11/26] rtmutex: Convert wait_lock and pi_lock " John Kacur
2010-01-11 21:26 ` [PATCH 12/26] printk: Convert lock " John Kacur
2010-01-11 21:26 ` [PATCH 13/26] genirq: Convert locks to raw_spinlocks John Kacur
2010-01-11 21:26 ` [PATCH 14/26] trace: Convert various locks to raw_spinlock John Kacur
2010-01-11 21:26 ` [PATCH 15/26] clocksource: Convert watchdog_lock " John Kacur
2010-01-11 21:26 ` [PATCH 16/26] timer_stats: Convert to raw_spinlocks John Kacur
2010-01-11 21:26 ` [PATCH 17/26] x86: kvm: Convert i8254/i8259 locks to raw_spinlock John Kacur
2010-01-11 21:26 ` [PATCH 18/26] x86 - nmi: Convert nmi_lock " John Kacur
2010-01-11 21:26 ` [PATCH 19/26] cgroups: Convert cgroups release_list_lock " John Kacur
2010-01-11 21:26 ` [PATCH 20/26] proportions: Convert spinlocks to raw_spinlocks John Kacur
2010-01-11 21:26 ` [PATCH 21/26] percpu_counter: Convert to raw_spinlock John Kacur
2010-01-11 21:26 ` [PATCH 22/26] oprofile: " John Kacur
2010-01-11 21:26 ` [PATCH 23/26] vgacon: Convert vga console lock " John Kacur
2010-01-11 21:26 ` [PATCH 24/26] pci-access: Convert pci_lock " John Kacur
2010-01-11 21:26 ` [PATCH 25/26] kprobes: Convert to raw_spinlocks John Kacur
2010-01-11 21:26 ` [PATCH 26/26] softlockup: " John Kacur
2010-01-12 3:54 ` [PATCH 25/26] kprobes: " Frederic Weisbecker
2010-01-11 21:50 ` [PATCH 19/26] cgroups: Convert cgroups release_list_lock to raw_spinlock Paul Menage
2010-01-11 22:11 ` John Kacur
2010-01-12 3:39 ` [PATCH 14/26] trace: Convert various locks " Frederic Weisbecker
2010-01-13 15:28 ` Steven Rostedt [this message]
2010-01-13 15:36 ` John Kacur
2010-01-13 15:41 ` Steven Rostedt
2010-01-13 18:09 ` John Kacur
2010-01-17 13:00 ` Frederic Weisbecker
2010-01-12 3:24 ` [PATCH 00/26] Convert locks that can't sleep in -rt " Frederic Weisbecker
2010-01-12 3:49 ` Frederic Weisbecker
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=20100113152824.GA15301@goodmis.org \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=williams@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.