[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200905221503.08586.mszick@morethan.org>
Date: Fri, 22 May 2009 15:03:06 -0500
From: "Michael S. Zick" <mszick@...ethan.org>
To: Roland Dreier <rdreier@...co.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic
On Fri May 22 2009, Roland Dreier wrote:
>
> > 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.
>
Not prior to P-4, and since then only "may" be done atomically,
see reference post in my earlier reply.
PS: And yes, that was where I spotted the usage first. ;)
Mike
> - R.
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists