All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Carlos O'Donell <carlos@systemhalted.org>,
	Guy Martin <gmsoft@tuxicoman.be>
Cc: linux-parisc <linux-parisc@vger.kernel.org>
Subject: Re: Implementing 64bit atomic gcc built-ins
Date: Wed, 16 Jul 2014 21:37:39 +0200	[thread overview]
Message-ID: <53C6D483.3000903@gmx.de> (raw)
In-Reply-To: <CAE2sS1hY-XB60MiBxguJgUCAFwJ8bxMuFHNqE40vW=OBafzwjg@mail.gmail.com>

On 07/16/2014 04:24 PM, Carlos O'Donell wrote:
> On Wed, Jul 16, 2014 at 8:40 AM, Guy Martin <gmsoft@tuxicoman.be> wrote:
>> In the case of a 32 bit kernel, I'm not sure if it's possible to implement
>> an atomic CAS that would work on two registers at once. If it's possible,
>> most probably a lws_compare_and_swap_dword or so LWS should be created as I
>> can't see the current ABI working in this scenario. As far as I understand
>> the code in syscall.S, it would just be a matter of adding a ldw/stw
>> instruction pair in cas_action to have 64bit operations (on top of changing
>> the ABI).
> 
> It is *absolutely* possible and very easy.
> 
> For a 32-bit kernel to do a 64-bit atomic operation it needs to do
> everything in two steps while holding the lws_cas locks.

I agree this would work if userspace only modifies the atomic dword through the new lws call.
But is it still "atomic" if some other thread modifies the 64bit value not through the lws?
I mean, isn't there a possibility, that the upper or lower 32bit may be changed unexpectedly and out-of-sync?

Helge

  reply	other threads:[~2014-07-16 19:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16 12:40 Implementing 64bit atomic gcc built-ins Guy Martin
2014-07-16 14:24 ` Carlos O'Donell
2014-07-16 19:37   ` Helge Deller [this message]
2014-07-16 21:16 ` James Bottomley
2014-07-17  1:52   ` Carlos O'Donell
2014-07-17  8:44     ` Guy Martin
2014-07-17 12:46       ` John David Anglin
2014-07-19  0:30       ` John David Anglin

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=53C6D483.3000903@gmx.de \
    --to=deller@gmx.de \
    --cc=carlos@systemhalted.org \
    --cc=gmsoft@tuxicoman.be \
    --cc=linux-parisc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.