User: Password:
|
|
Subscribe / Log in / New account

Re: Opinion on ordering of writel vs. stores to RAM

From:  Linus Torvalds <torvalds-AT-osdl.org>
To:  Michael Buesch <mb-AT-bu3sch.de>
Subject:  Re: Opinion on ordering of writel vs. stores to RAM
Date:  Sun, 10 Sep 2006 10:49:53 -0700 (PDT)
Cc:  Jesse Barnes <jbarnes-AT-virtuousgeek.org>, Benjamin Herrenschmidt <benh-AT-kernel.crashing.org>, Paul Mackerras <paulus-AT-samba.org>, linux-kernel-AT-vger.kernel.org, akpm-AT-osdl.org, segher-AT-kernel.crashing.org, davem-AT-davemloft.net, Alan Cox <alan-AT-lxorguk.ukuu.org.uk>
Archive-link:  Article, Thread



On Sun, 10 Sep 2006, Michael Buesch wrote:
> > 
> > That's what IRIX had.  It would let us get rid of mmiowb and avoid doing 
> > a full sync in writeX, so may be the best option.
> 
> Last time I suggested that, people did not want it.

I would personally _much_ rather have a separate mmiowb() and a regular 
spinlock, than add a magic new spinlock.

Of course, mmiowb() itself is not a great name, and we could/should 
probably rename it to make it more obvious what the hell it is.

> There is one little problem in practice with something
> like spin_unlock_io().
> 
> spin_lock_io(&lock);
> foovalue = new_foovalue;
> if (device_is_fooing)
> 	writel(foovalue, REGISTER);
> spin_unlock_io(&lock);
> 
> That would be an unneccessary sync in case device is not fooing.
> In contrast to the explicit version:
> 
> spin_lock(&lock);
> foovalue = new_foovalue;
> if (device_is_fooing) {
> 	writel(foovalue, REGISTER);
> 	mmiowb();
> }
> spin_unlock(&lock);

I think this is even more important when the actual IO is done somewhere 
totally different from the locking. It's really confusing if you have a 
"spin_unlock_io()" just because some routine you called wanted it.

But more importantly, I don't want to have "spin_unlock_io[_xyzzy]()", 
where "xyzzy()" is all the irq/irqrestore/bh variations. It's just not 
worth it. We already have enough variations on spinlocks, but at least 
right now they are all in the "same category", ie it's all about what the 
context of the _locking_ is, and at least the lock matches the unlock, and 
there are no separate rules.

			Linus


(Log in to post comments)


Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds