From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Roger Larsson <roger.larsson@norran.net>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: shared config registers and locking
Date: Thu, 07 Dec 2006 09:57:45 +1100 [thread overview]
Message-ID: <1165445865.5469.130.camel@localhost.localdomain> (raw)
In-Reply-To: <200612062257.45153.roger.larsson@norran.net>
On Wed, 2006-12-06 at 22:57 +0100, Roger Larsson wrote:
> On Wednesday 06 December 2006 06:10, Benjamin Herrenschmidt wrote:
> >
> > On UP configuration, there is no real problem: local_irq_disable/enable
> > around the code tweaking those bits (read/modify/write) is enough and
> > everybody is happy. That's what the current emac code does.
> >
> > However, on SMP, we need spinlocking (or a semaphore, but for simple
> > register accesses like that, spinlocks are probably better).
> >
> It is actually simple.
>
> You should use
> spin_lock_irq_save()
Thanks you very much for telling me about spinlocks ... I wonder how I
did all these years ... :-)
Now, more seriously, of course the thing will boil down to a spinlock.
My point was what do you guys think about having one shared spinlock
exposed by the powerpc platform code for use by all those little bits
here or there that whack global configuration registers like clock
control things, etc... that we have all over the place on embedded
processors.
Since I don't like exposing a naked data structure though, rather than
exposing the spinlock itself, I was proposing to expose an API of two
functions (just in case we want to do something fancy) though they could
well end up being inline and thus boil down to the same...
Ben.
next prev parent reply other threads:[~2006-12-06 22:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 5:10 shared config registers and locking Benjamin Herrenschmidt
2006-12-06 5:16 ` Benjamin Herrenschmidt
2006-12-06 6:06 ` Eugene Surovegin
2006-12-06 6:36 ` Benjamin Herrenschmidt
2006-12-06 21:57 ` Roger Larsson
2006-12-06 22:57 ` Benjamin Herrenschmidt [this message]
2006-12-06 23:14 ` Michael Galassi
2006-12-06 23:34 ` Benjamin Herrenschmidt
2006-12-07 1:22 ` Roger Larsson
2006-12-07 2:47 ` Benjamin Herrenschmidt
2006-12-07 18:18 ` Roger Larsson
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=1165445865.5469.130.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=linuxppc-embedded@ozlabs.org \
--cc=roger.larsson@norran.net \
/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;
as well as URLs for NNTP newsgroup(s).