public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: benh@kernel.crashing.org
Cc: "Moore\, Eric" <Eric.Moore@lsi.com>, linux-kernel@vger.kernel.org
Subject: Re: HELP:  Is writeq an atomic operation??
Date: Sun, 04 May 2008 10:01:55 -0700	[thread overview]
Message-ID: <adaabj62ebg.fsf@cisco.com> (raw)
In-Reply-To: <1209854242.26383.30.camel@pasglop> (Benjamin Herrenschmidt's message of "Sun, 04 May 2008 08:37:22 +1000")

 > > I don't have an authoritative answer, but I can say that I coded
 > > drivers/infiniband/hw/mthca and .../mlx4 assuming that writeq() is
 > > atomic in the sense that you say, and no one has reported any problems.
 > > 
 > > But I'm sure no one has stressed the drivers on 64-bit mips or anything
 > > unusual like that.
 > 
 > Surely only on 64 bits archs right ?

Your question is a bit too terse for me to know exactly what you're
asking, but it is true that these IB drivers use writeq() only on 64-bit
architectures (since no 32-bit architectures even define writeq()!).

The hardware I'm dealing with is smart enough to cope with a driver that
does a write to these 64-bit registers in two 32-bit chunks, as long as
no other writes come in the middle.  So on 32-bit architectures I just
have a spinlock around two writel()s.

The assumption I'm making is that no locking or anything is needed on
64-bit architectures to avoid the writeq() being split into two
transactions with a third unrelated transaction in the middle.

It sounds as though Eric's hardware is much harder to deal with in that
it requires the write to a 64-bit register to be done in a single
transaction, and I'm not sure there is a way to do that on all 32-bit
architectures; certainly we have nothing clean and portable that a
driver can use to do that.

 - R.

  reply	other threads:[~2008-05-04 17:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 22:40 HELP: Is writeq an atomic operation?? Moore, Eric
2008-05-02 22:46 ` Roland Dreier
2008-05-03  0:42   ` H. Peter Anvin
2008-05-03 14:35     ` Alan Cox
2008-05-03 17:40       ` H. Peter Anvin
2008-05-03 22:37   ` Benjamin Herrenschmidt
2008-05-04 17:01     ` Roland Dreier [this message]
2008-05-02 22:50 ` Andi Kleen
2008-05-02 23:03   ` Moore, Eric
2008-05-02 23:13     ` Andi Kleen
2008-05-02 23:04 ` Roland Dreier
2008-05-02 23:20   ` Moore, Eric
2008-05-03  0:10     ` Roland Dreier
2008-05-02 23:12 ` Jesse Barnes
2008-05-03  0:41 ` H. Peter Anvin
     [not found] <0631C836DBF79F42B5A60C8C8D4E822901047B1D@NAMAIL2.ad.lsil.com>
2008-05-02 22:32 ` David Miller
2008-05-02 22:43   ` Roland Dreier
2008-05-02 22:49     ` David Miller
2008-05-02 22:49     ` Moore, Eric
2008-05-02 22:53       ` Roland Dreier
2008-05-02 23:13         ` Moore, Eric
2008-05-02 23:21           ` Roland Dreier
2008-05-02 23:31             ` Moore, Eric

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=adaabj62ebg.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=Eric.Moore@lsi.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.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