Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Stan Sieler <sieler@allegro.com>
To: matthew@wil.cx (Matthew Wilcox)
Cc: jes@linuxcare.com (Jes Sorensen), matthew@wil.cx (Matthew Wilcox),
	alan@linuxcare.com.au (Alan Modra),
	jsm@udlkern.fc.hp.com (John Marvin),
	parisc-linux@thepuffingroup.com
Subject: Re: [parisc-linux] ldcw in __pthread_acquire
Date: Sat, 16 Dec 2000 17:22:38 -0800 (PST)	[thread overview]
Message-ID: <200012170122.RAA26462@opus.allegro.com> (raw)
In-Reply-To: <20001216192919.A10477@parcelfarce.linux.theplanet.co.uk> from "Matthew Wilcox" at Dec 16, 2000 07:29:19 PM

Re:

> > Matthew> Can we move the __spinlock to be the first element of the

Why not do it "right", with a kernel locking call of some kind?
User code should never do LDCW calls ... we've just seen yet another
example of why: it's difficult to do correctly.  Providing fast
locking mechanisms is the *kernel's* job.

(That's the real short version of the well-founded diatribe I launched
against HP for suggesting that developers do their own spinlocks...
and I was proved correct when a couple of months later HP said "oops,
our suggested code was wrong". :)

Another reason for kernel implementation: *real world experience*:
the programmer might *think* that the lock will *always* be held
for a very short time, so the spin loop is acceptable ... but ... yes,
things happen ... and sometimes the programmer is wrong, and that
can have tragic consequences.  A kernel-implemented fast-lock would
presumably ...like on MPE/iX ... have a max number of hard loops,
and then revert to a blocking-lock of some kind.

BTW, MPE's solution to misaligned semaphore structures is to select
one of 15 reserved kernel semaphores (based on the bottom 4 bits of
the address of the user's misaligned semaphore) as a temporary
"helper" semaphore (to loop/ldcws on).  At least that way,
there's a 14/15 chance that two different misaligned semaphores won't
compete with each other when they shouldn't.  

Sorry this isn't a solution, just a suggestion that requires a bit 
more work :)

-- 
Stan Sieler                                           sieler@allegro.com
www.allegro.com/sieler/wanted/index.html                  www.sieler.com        

  parent reply	other threads:[~2000-12-17  1:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-15 10:12 [parisc-linux] ldcw in __pthread_acquire John Marvin
2000-12-15 11:37 ` Alan Modra
2000-12-15 16:37   ` Matthew Wilcox
2000-12-15 17:32     ` Jes Sorensen
2000-12-16 19:29       ` Matthew Wilcox
2000-12-16 21:58         ` Jes Sorensen
2000-12-17  4:31           ` Alan Modra
2000-12-17  1:22         ` Stan Sieler [this message]
2000-12-17  2:38           ` Alan Cox
2000-12-17  4:18             ` LaMont Jones
2000-12-18  0:29             ` Stan Sieler
2000-12-18  0:36               ` Alan Cox
2000-12-18  0:48                 ` Stan Sieler
2000-12-18  0:59                   ` Alan Cox
2000-12-18  4:43                     ` LaMont Jones
2000-12-18 11:53                       ` Alan Cox
2000-12-18 12:27                         ` Philippe Benard
2000-12-18 14:40                           ` LaMont Jones
2000-12-18 19:44                             ` Stan Sieler
2000-12-18 19:54                               ` Alan Cox
2000-12-18 20:15                                 ` Stan Sieler
2000-12-18 20:44                                 ` LaMont Jones
2000-12-18 21:56                                   ` Alan Cox
2000-12-18 22:26                               ` LaMont Jones
2000-12-18  7:10                 ` Philippe Benard
2000-12-18 12:06                   ` Alan Cox
2000-12-18 14:49                     ` LaMont Jones
2000-12-18 15:59                       ` Matthew Wilcox
  -- strict thread matches above, loose matches on Subject: below --
2000-12-15 10:26 John Marvin

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=200012170122.RAA26462@opus.allegro.com \
    --to=sieler@allegro.com \
    --cc=alan@linuxcare.com.au \
    --cc=jes@linuxcare.com \
    --cc=jsm@udlkern.fc.hp.com \
    --cc=matthew@wil.cx \
    --cc=parisc-linux@thepuffingroup.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox