linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Eger <eger@havoc.gtf.org>
To: Kronos <kronos@people.it>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	John Zielinski <grim@undead.cc>,
	Linux Fbdev development list
	<linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: radeon_pm.c locking problem
Date: Mon, 5 Jul 2004 17:24:37 -0400	[thread overview]
Message-ID: <20040705212436.GA25860@havoc.gtf.org> (raw)
In-Reply-To: <20040705164104.GA14968@dreamland.darkstar.lan>

On Mon, Jul 05, 2004 at 06:41:04PM +0200, Kronos wrote:
> Il Mon, Jul 05, 2004 at 08:44:53AM -0500, Benjamin Herrenschmidt ha scritto: 
> > > is expanded in:
> > > 
> > > do {
> > >         unsigned long flags;
> > >         spin_lock_irqsave(&rinfo->reg_lock, flags);
> > >         __OUTPLL(pllPIXCLKS_CNTL, INPLL(pllPIXCLKS_CNTL) & ~PIXCLKS_CNTL__PIX2CLK_SRC_SEL_MASK);
> > >         spin_unlock_irqrestore(&rinfo->reg_lock, flags);
> > > } while(0)
> > > 
> > > and INPLL will try to reacquire the lock ->reg_lock. We could either use
> > > __INPLL (which does not take the lock) or make OUTPLL an inline function
> > > (in this way INPLL is called before entering the function).
> > 
> > Make it an inline function...
> 
> Here it is:

Your patch is much, much prettier than mine (which is in mainline),
and Linus is hoping for such a prettier solution.

On the other hand, is there any reason we're taking this
rinfo->reg_lock?   Would it be possible for the fb driver to be called
in two separate contexts at the same time?

Also, having this macro be pretty sort of obsccures the fact that, 
the way the code is now, we're doing

	OUTPLL(foo0, bar0);
	OUTPLL(foo1, bar1);
	OUTPLL(foo2, bar2);

which translates to taking this lock three times in quick succession.
Bleah.

I had half a mind to put a radeon_fifo_wait() call in the
OUTREG() macro (because there needs to be a 1-1 correspondence 
between empty fifo slots and OUTREG calls, but then you add a
chunk of a loop, udelay, and printk to every register write...
again lots of overhead for a simple register write.... 
better to sprinkle the code with the write counts and hope they stay
in line?  Maybe.  That's the route I took, anyways.

-dte


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com

  reply	other threads:[~2004-07-05 21:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02 17:29 radeon_pm.c locking problem John Zielinski
2004-07-02 18:52 ` Kronos
2004-07-05 13:44   ` Benjamin Herrenschmidt
2004-07-05 16:41     ` Kronos
2004-07-05 21:24       ` David Eger [this message]
2004-07-05 22:03         ` Benjamin Herrenschmidt
2004-07-02 20:14 ` David Eger

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=20040705212436.GA25860@havoc.gtf.org \
    --to=eger@havoc.gtf.org \
    --cc=benh@kernel.crashing.org \
    --cc=grim@undead.cc \
    --cc=kronos@people.it \
    --cc=linux-fbdev-devel@lists.sourceforge.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).