public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: "Michael S. Zick" <mszick@morethan.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic
Date: Fri, 22 May 2009 12:24:36 -0700	[thread overview]
Message-ID: <adak5499c0b.fsf@cisco.com> (raw)
In-Reply-To: <200905221350.50027.mszick@morethan.org> (Michael S. Zick's message of "Fri, 22 May 2009 13:50:47 -0500")


 > Unless you have interrupts enabled, then you have two contexts.
 > Only xchg is "naturally" atomic.

Isn't the lock prefix about consistency between multiple processors?
The x86 architecture always handles interrupts on instruction
boundaries.  I'm guessing you're worried about definitions like

static inline void atomic_inc(atomic_t *v)
{
	asm volatile(LOCK_PREFIX "incl %0"
		     : "+m" (v->counter));
}

which compiles to just "incl" (with no lock prefix) on uniprocessor
kernels; but the IA-32 architecture guarantees that the incl instruction
cannot be interrupted between reading the old value and writing the new
value.

 - R.

  reply	other threads:[~2009-05-22 19:24 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 18:50 [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-22 19:24 ` Roland Dreier [this message]
2009-05-22 20:03   ` Michael S. Zick
  -- strict thread matches above, loose matches on Subject: below --
2009-05-22 16:39 Michael S. Zick
2009-05-22 18:23 ` Andi Kleen
2009-05-22 18:36 ` Ingo Molnar
2009-05-22 18:59   ` H. Peter Anvin
2009-05-22 19:20     ` Michael S. Zick
2009-05-22 22:21     ` Michael S. Zick
2009-05-22 23:30       ` H. Peter Anvin
2009-05-23  0:45         ` Michael S. Zick
2009-05-23  0:51           ` H. Peter Anvin
2009-05-23 10:44             ` Michael S. Zick
2009-05-23 11:18               ` Michael S. Zick
2009-05-24  7:04               ` Harald Welte
2009-05-24 12:48                 ` Michael S. Zick
2009-05-24 15:43                 ` Michael S. Zick
2009-05-27 22:13               ` Roland Dreier
2009-05-27 22:33                 ` Michael S. Zick
2009-05-23 15:52             ` Michael S. Zick
2009-05-23 18:04             ` Michael S. Zick
2009-05-23 23:44               ` H. Peter Anvin
2009-05-24  6:49                 ` Harald Welte
2009-05-24 12:38                   ` Michael S. Zick
2009-05-24 17:31                     ` Harald Welte
2009-05-30 15:48                   ` Michael S. Zick
2009-05-24 12:27                 ` Michael S. Zick
2009-05-24 17:22                   ` Harald Welte
2009-05-24 18:00                   ` H. Peter Anvin
2009-05-24 18:32                     ` Michael S. Zick
2009-05-24 18:46                       ` H. Peter Anvin
2009-05-24 19:09                         ` Michael S. Zick
2009-05-25 19:03                         ` Michael S. Zick
2009-05-25 19:18                           ` Michael S. Zick
2009-05-25 19:46                             ` Michael S. Zick
2009-05-25 21:10                               ` Michael S. Zick
2009-05-25 21:17                                 ` H. Peter Anvin
2009-05-25 23:03                                   ` Michael S. Zick
2009-05-25 23:35                                     ` Michael S. Zick
2009-05-26  0:05                                     ` H. Peter Anvin
2009-05-26 12:37                                       ` Michael S. Zick
2009-05-26 17:13                                         ` H. Peter Anvin
2009-05-25 16:05                       ` Michael S. Zick
2009-05-28 20:30                     ` Pavel Machek
2009-05-28 20:54                       ` Michael S. Zick
2009-05-23 20:51             ` Michael S. Zick
2009-05-28 12:48       ` Pavel Machek
2009-05-28 13:29         ` Michael S. Zick
2009-05-28 20:50           ` Pavel Machek
2009-05-28 20:58             ` Michael S. Zick
2009-05-28 21:16               ` Pavel Machek
2009-05-28 21:21                 ` Michael S. Zick
2009-05-22 19:17   ` Michael S. Zick
     [not found] ` <200905221343.30638.lkml@morethan.org>
     [not found]   ` <20090522192329.GF846@one.firstfloor.org>
2009-05-22 19:53     ` Michael S. Zick
2009-05-22 20:05       ` Samuel Thibault
2009-05-22 20:32         ` Michael S. Zick
2009-05-22 20:42           ` Andi Kleen
2009-05-22 20:57             ` Michael S. Zick
2009-05-22 20:43           ` Samuel Thibault
2009-05-22 21:59             ` Andi Kleen
2009-05-22 22:00               ` Samuel Thibault
2009-05-22 22:14                 ` Andi Kleen
2009-05-22 22:14                   ` Samuel Thibault
2009-05-22 20:45           ` Roland Dreier
2009-05-24 18:59           ` Robert Hancock

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=adak5499c0b.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszick@morethan.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