Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Grant Grundler <grundler@parisc-linux.org>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] some other small bitops.h suggestion?
Date: Fri, 15 Apr 2005 13:27:13 -0600	[thread overview]
Message-ID: <20050415192713.GA26321@colo.lackof.org> (raw)
In-Reply-To: <200504141439.j3EEd9oX018785@hiauly1.hia.nrc.ca>

On Thu, Apr 14, 2005 at 10:39:08AM -0400, John David Anglin wrote:
...
> I don't believe that a lock can be implemented as shown above on
> PA-RISC as we don't have an atomic test_and_set_bit.  The only atomic
> ops are ldcw and ldcd (load and clear word/double).  So, if test_and_set_bit
> needs locking semantics, it will have to be implemented with spinlocks.

I think linus was just defining what he expects from test_and_set_bit().
If parisc implementation doesn't work that way, he considers it a bug
in the parisc implemenation (vs redefining the interface).

> Secondly, I'm not convinced of the concept of volatile code paths
> and using the volatile keyword to keep loops from being optimized
> away.  I think this approach results in bad code.

My take is "volatile" is just a way to tell gcc something about the
code/data that it can't see. I'm not going to quibble with linus
about whether data is volatile or code is volatile. I think in some
cases it's one (e.g accessing memory mapped HW) or the other
(accessing shared data). Key thing is gcc be able to optimize code
but not remove it (especially in the latter case).

We do use volatile for accessing memory mapped HW in all our readl/writel
implementations. Those are uncached accesses and thus shouldn't
ever get removed. This is the obvious case.

I just realized we often use mb() variants in the kernel to mark at least
boundary of lockless access to shared data. But volatile is almost
never mentioned for many of these accesses.
E.g. tg3.[ch] driver messes around with shared memory areas (descriptor
rings) but doesn't have "volatile" keyword in it.

Though we do NOT mark those accesses (memory writes in particular)
with volatile, it sounds like we should.

grant
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

  reply	other threads:[~2005-04-15 19:27 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-03 14:32 [parisc-linux] pthread problems - test program Randolph Chung
2005-04-03 19:07 ` John David Anglin
2005-04-03 20:24 ` John David Anglin
2005-04-04  0:53   ` Randolph Chung
2005-04-03 20:41 ` John David Anglin
2005-04-04  0:50   ` Randolph Chung
2005-04-05  0:00     ` Carlos O'Donell
2005-04-05  0:02     ` Carlos O'Donell
2005-04-05  6:00       ` Carlos O'Donell
2005-04-06 20:12         ` John David Anglin
2005-04-06 20:25           ` Carlos O'Donell
2005-04-06 20:52             ` John David Anglin
2005-04-06 20:28           ` Carlos O'Donell
2005-04-07  2:45           ` John David Anglin
2005-04-08  2:56             ` John David Anglin
2005-04-08 21:29               ` Carlos O'Donell
2005-04-08 22:54                 ` John David Anglin
     [not found]                   ` <20050409055852.GM1833@baldric.uwo.ca>
2005-04-09  6:37                     ` Carlos O'Donell
2005-04-09 14:44                       ` John David Anglin
2005-04-09 14:48                         ` Randolph Chung
2005-04-09 23:44                       ` John David Anglin
2005-04-15 14:16                         ` Carlos O'Donell
2005-04-15 15:48                           ` John David Anglin
2005-04-09  0:13                 ` John David Anglin
2005-04-09  6:38                   ` Carlos O'Donell
2005-04-09 15:01                     ` John David Anglin
2005-04-15 14:16                       ` Carlos O'Donell
2005-04-06  1:21     ` John David Anglin
2005-04-06  4:59       ` Carlos O'Donell
2005-04-06  8:42         ` John David Anglin
2005-04-06 16:11           ` John David Anglin
2005-04-06 18:13             ` Carlos O'Donell
2005-04-06 18:37               ` John David Anglin
2005-04-06 19:36                 ` Carlos O'Donell
2005-04-06 19:36                 ` Carlos O'Donell
2005-04-05  9:28 ` [parisc-linux] some other small bitops.h suggestion? Joel Soete
2005-04-13  6:14   ` Grant Grundler
2005-04-13  6:58     ` Joel Soete
2005-04-13 17:47   ` Grant Grundler
     [not found]     ` <20050414013105.GB17749@tausq.org>
2005-04-14  1:33       ` Randolph Chung
2005-04-14  5:07       ` Grant Grundler
2005-04-14 14:39         ` John David Anglin
2005-04-15 19:27           ` Grant Grundler [this message]
2005-04-15 21:41             ` John David Anglin
2005-04-16 17:27               ` Grant Grundler

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=20050415192713.GA26321@colo.lackof.org \
    --to=grundler@parisc-linux.org \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=parisc-linux@lists.parisc-linux.org \
    /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