lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 07 Dec 2010 11:31:17 +0200
From:	Avi Kivity <avi@...hat.com>
To:	Christoph Lameter <cl@...ux.com>
CC:	akpm@...ux-foundation.org, Pekka Enberg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org,
	Eric Dumazet <eric.dumazet@...il.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Tejun Heo <tj@...nel.org>
Subject: Re: [rfc: cpuops adv V1 3/8] x86: this_cpu_cmpxchg and this_cpu_cmpxchg_double
 operations

On 12/06/2010 07:35 PM, Christoph Lameter wrote:
> On Mon, 6 Dec 2010, Avi Kivity wrote:
>
> >  On 12/02/2010 11:53 PM, Christoph Lameter wrote:
> >  >  Provide support as far as the hardware capabilities of the x86 cpus
> >  >  allow.
> >  >
> >  >
> >  >
> >  >  +/*
> >  >  + * Beware: xchg on x86 has an implied lock prefix. There will be the cost
> >  >  of
> >  >  + * full lock semantics even though they are not needed.
> >  >  + */
> >
> >  Perhaps we can use cmpxchg instead of xchg to avoid this? costs one more
> >  instruction but may be worth it.
>
> Hmmm... Maybe good since I also need a xchg_double. And xchg_double can
> only be realized with cmpxchg16b. Using cmpxchg would make it consistent.

I don't think we need to worry about consistency, this is an 
implementation not an interface.

We have three choices:

   xchg %1, %0

atomic, one instruction

   1: cmpxchg %2, %0
   jnz 1b

two non-atomic instructions, potential mispredicted jump, extra clobber 
(%1 == "=a")

   mov %0, %1
   1: cmpxchg %2, %0
   jnz 1b

three non-atomic instructions, no mispredict, extra clobber

-- 
error compiling committee.c: too many arguments to function

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ