From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Alex Neronskiy <zakmagnus@chromium.org>,
linux-kernel@vger.kernel.org, Don Zickus <dzickus@redhat.com>,
Mandeep Singh Baines <msb@chromium.org>,
Alex Neronskiy <zakmagnus@chromium.com>
Subject: Re: [PATCH v6 2/2] Output stall data in debugfs
Date: Fri, 12 Aug 2011 11:06:07 +0200 [thread overview]
Message-ID: <20110812090607.GE28956@elte.hu> (raw)
In-Reply-To: <1313091323.8491.30.camel@twins>
* Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, 2011-08-10 at 11:02 -0700, Alex Neronskiy wrote:
> > @@ -210,22 +236,27 @@ void touch_softlockup_watchdog_sync(void)
> > /* watchdog detector functions */
> > static void update_hardstall(unsigned long stall, int this_cpu)
> > {
> > if (stall > hardstall_thresh && stall > worst_hardstall) {
> > unsigned long flags;
> > + spin_lock_irqsave(&hardstall_write_lock, flags);
> > + if (stall > worst_hardstall) {
> > + int write_ind = hard_read_ind;
> > + int locked = spin_trylock(&hardstall_locks[write_ind]);
> > + /* cannot wait, so if there's contention,
> > + * switch buffers */
> > + if (!locked)
> > + write_ind = !write_ind;
> > +
> > worst_hardstall = stall;
> > + hardstall_traces[write_ind].nr_entries = 0;
> > + save_stack_trace(&hardstall_traces[write_ind]);
> >
> > + /* tell readers to use the new buffer from now on */
> > + hard_read_ind = write_ind;
> > + if (locked)
> > + spin_unlock(&hardstall_locks[write_ind]);
> > + }
> > + spin_unlock_irqrestore(&hardstall_write_lock, flags);
> > }
> > }
>
> That must be the most convoluted locking I've seen in a while.. OMG!
Well, but there are conceptual problems at the higher levels: the
concept of recording a worst-case (or best-case) latency is not
limited to the comparatively minor usecase of soft-watchdog stalls.
We have numerous tracers in ftrace that output their own kinds of
min/max latencies, with associated stack trace signatures.
So the right approach would *not* be to add yet another
special-purpose debugfs variant for this, but to integrate this
capability into perf tracing. That way it would be useful for:
- soft stalls
- irq service latencies
- irq disable latencies
- preempt disable latencies
- wakeup latencies
- and much more: it could be used for just about any event that
measures some sort of latency.
To implement it i'd first suggest to add a TRACE_EVENT() for the
softwatchdog latencies, and then look at how a stack-trace attached
to the worst-case latency could be emitted via the perf ring-buffer.
We do something very, very similar for callchains already, so all the
low level machinery is already there.
Alex, would you be interested in taking a stab at this approach? Such
an approach looks a *lot* more palatable from an upstream merge point
of view and it would give you all the functionality that the current
patches are providing you (and more).
Thanks,
Ingo
next prev parent reply other threads:[~2011-08-12 9:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 18:02 [PATCH v6 1/2] Track hard and soft "short lockups" or "stalls." Alex Neronskiy
2011-08-10 18:02 ` [PATCH v6 2/2] Output stall data in debugfs Alex Neronskiy
2011-08-11 18:48 ` Andi Kleen
2011-08-11 19:04 ` Don Zickus
2011-08-11 21:05 ` Andi Kleen
2011-08-11 19:13 ` Peter Zijlstra
2011-08-11 19:35 ` Peter Zijlstra
2011-08-11 20:10 ` Alex Neronskiy
2011-08-11 20:23 ` Peter Zijlstra
2011-08-11 20:31 ` Alex Neronskiy
2011-08-11 21:17 ` Peter Zijlstra
2011-08-11 22:02 ` Alex Neronskiy
2011-08-11 23:00 ` Mandeep Singh Baines
2011-08-12 12:14 ` Peter Zijlstra
2011-08-16 19:32 ` Mandeep Singh Baines
2011-08-12 9:06 ` Ingo Molnar [this message]
2011-08-12 19:46 ` Alex Neronskiy
2011-08-11 19:43 ` Peter Zijlstra
2011-08-11 19:51 ` Alex Neronskiy
2011-08-11 19:57 ` Peter Zijlstra
2011-08-11 19:09 ` [PATCH v6 1/2] Track hard and soft "short lockups" or "stalls." Peter Zijlstra
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=20110812090607.GE28956@elte.hu \
--to=mingo@elte.hu \
--cc=dzickus@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=msb@chromium.org \
--cc=peterz@infradead.org \
--cc=zakmagnus@chromium.com \
--cc=zakmagnus@chromium.org \
/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