From: Timothy Miller <miller@techsource.com>
To: "David S. Miller" <davem@redhat.com>
Cc: Larry McVoy <lm@bitmover.com>,
phillips@arcor.de, mbligh@aracnet.com, piggin@cyberone.com.au,
anton@samba.org, linux-kernel@vger.kernel.org
Subject: Lock EVERYTHING (for testing) [was: Re: Scaling noise]
Date: Wed, 10 Sep 2003 11:47:53 -0400 [thread overview]
Message-ID: <3F5F47A9.3000300@techsource.com> (raw)
In-Reply-To: 20030903215850.0827c589.davem@redhat.com
David S. Miller wrote:
>
> So again, if you're going to argue against huge SMP (at least to me),
> don't use the locking complexity argument. Not only have we basically
> conquered it, we've along the way found some amazing ways to find
> locking bugs both at runtime and at compile time. You can even debug
> them on uniprocessor systems. And this doesn't even count the
> potential things we can do with Linus's sparse tool.
Pardon me for suggesting another idea for which I have no code written,
but I was just wondering...
Is there a way we could get gcc to wrap EVERY memory access with some
kind of debug lock?
Actually, I do have code, but for another application. I designed a
graphics drawing engine which has a FIFO for commands. Before sending
commands, you have to be sure there is enough free space in the FIFO, so
there is a macro we use which tries to do this in an efficient way.
Anyhow, there have been instances where we didn't check for enough space
or didn't check for space at all, etc., and those bugs have been
sometimes hard to find.
Two macros involved are CHECK_FIFO and WRITE_WORD. Normally, CHECK_FIFO
just checks for space, and WRITE_WORD just writes a word (it's more
complicated than that, but never mind). However, we have a second set
of macros which check to make sure we're doing everything right. The
"check checker" macros have CHECK_FIFO set a counter and WRITE_WORD
decrement that. (Again, a bit more complex than that.) If the counter
ever goes below zero, we know we screwed up and exactly where. Another
thing we have is a way to indicate that we know we're doing something
that looks like it may violate the normal way of things but really
doesn't (for instance, sometimes, we write fewer words than we check
for, and that is something we still print warnings about, but not in the
cases where it's intentional).
The analogy for Linux is this: At a machine level, we add a check to
EVERY access. The check is there to ensure that every memory access is
properly locked. So, if some access is made where there isn't a proper
lock applied, then we can print a warning with the line number or drop
out into kdb or something of that sort.
I'm betting there's another solution to this, otherwise, I wouldn't
suggest such an idea, because of the relative amount of work versus
benefit. But it may require massive modifications to GCC to add this
code in at the machine level.
Perhaps an even better solution would be to run an emulator. Anyone
know of a 686 emulator I can compile for intel? The emulator could be
modified to track locks and determine if any accesses are made without
proper locks.
And another option that I could REALLY sink my teeth into. If there was
a 686 implementation in Verilog that I could run on an FPGA, it would be
an order of magnitude slower than a real CPU, but still faster than an
emulator.
One idea is to have something which can run 686 ISA that fits in a
Virtex 1000 and runs at maybe 66mhz. We put that with some adaptor
board into an old dual processor PC that expects a Pentium Pro with a
66mhz FSB.
That's probably overly ambitious, although I do do chip design for a
living, so it's not entirely beyond the realm of possibility.
One problem is that we need to have metadata about memory accesses so we
can track the difference between accesses which are to memory private to
a CPU (no lock required) and accesses which are to shared memory (lock
required) so we can determine what is a violation. The FPGA daughter
board would have to have its own RAM on it to track that.
And that leads me to another idea: Reprogramming Transmeta processors
to do all that. :)
next prev parent reply other threads:[~2003-09-10 15:26 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-03 4:03 Scaling noise Larry McVoy
2003-09-03 4:12 ` Roland Dreier
2003-09-03 4:20 ` Larry McVoy
2003-09-03 15:12 ` Martin J. Bligh
2003-09-03 4:18 ` Anton Blanchard
2003-09-03 4:29 ` Larry McVoy
2003-09-03 4:33 ` CaT
2003-09-03 5:08 ` Larry McVoy
2003-09-03 5:44 ` Mikael Abrahamsson
2003-09-03 6:12 ` Bernd Eckenfels
2003-09-03 12:09 ` Alan Cox
2003-09-03 15:10 ` Martin J. Bligh
2003-09-03 16:01 ` Jörn Engel
2003-09-03 16:21 ` Martin J. Bligh
2003-09-03 19:41 ` Mike Fedyk
2003-09-03 20:11 ` Martin J. Bligh
2003-09-04 20:36 ` Rik van Riel
2003-09-04 20:47 ` Martin J. Bligh
2003-09-04 21:30 ` William Lee Irwin III
2003-09-03 8:11 ` Giuliano Pochini
2003-09-03 14:25 ` Steven Cole
2003-09-03 12:47 ` Antonio Vargas
2003-09-03 15:31 ` Steven Cole
2003-09-04 1:50 ` Daniel Phillips
2003-09-04 1:52 ` Larry McVoy
2003-09-04 4:42 ` David S. Miller
2003-09-08 19:40 ` bill davidsen
2003-09-04 2:18 ` William Lee Irwin III
2003-09-04 2:19 ` Steven Cole
2003-09-04 2:35 ` William Lee Irwin III
2003-09-04 2:40 ` Steven Cole
2003-09-04 3:20 ` Nick Piggin
2003-09-04 3:07 ` Daniel Phillips
2003-09-08 19:27 ` bill davidsen
2003-09-08 19:12 ` bill davidsen
2003-09-03 16:37 ` Kurt Wall
2003-09-06 15:08 ` Pavel Machek
2003-09-08 13:38 ` Alan Cox
2003-09-09 6:11 ` Rob Landley
2003-09-09 16:07 ` Ricardo Bugalho
2003-09-10 5:14 ` Rob Landley
2003-09-10 5:45 ` David Mosberger
2003-09-10 10:10 ` Ricardo Bugalho
2003-09-03 6:28 ` Anton Blanchard
2003-09-03 6:55 ` Nick Piggin
2003-09-03 15:23 ` Martin J. Bligh
2003-09-03 15:39 ` Larry McVoy
2003-09-03 15:50 ` Martin J. Bligh
2003-09-04 0:49 ` Larry McVoy
2003-09-04 2:21 ` Daniel Phillips
2003-09-04 2:35 ` Martin J. Bligh
2003-09-04 2:46 ` Larry McVoy
2003-09-04 4:58 ` David S. Miller
2003-09-10 15:47 ` Timothy Miller [this message]
2003-09-04 4:49 ` David S. Miller
2003-09-08 19:50 ` bill davidsen
2003-09-08 23:39 ` Peter Chubb
2003-09-03 17:16 ` William Lee Irwin III
2003-09-03 15:51 ` UP Regression (was) " Cliff White
2003-09-03 17:21 ` William Lee Irwin III
2003-09-03 18:53 ` Cliff White
2003-09-04 0:54 ` Nick Piggin
-- strict thread matches above, loose matches on Subject: below --
2003-09-10 15:47 Lock EVERYTHING (for testing) [was: Re: Scaling noise] John Bradford
2003-09-11 16:37 ` Jeremy Fitzhardinge
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=3F5F47A9.3000300@techsource.com \
--to=miller@techsource.com \
--cc=anton@samba.org \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm@bitmover.com \
--cc=mbligh@aracnet.com \
--cc=phillips@arcor.de \
--cc=piggin@cyberone.com.au \
/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