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] [thread-next>] [day] [month] [year] [list]
Message-ID: <8110a580-58bd-4dab-881c-7e69bf75ad96@email.android.com>
Date:	Fri, 21 Jan 2011 10:31:15 -0800
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Christoph Lameter <cl@...ux.com>
CC:	Tejun Heo <tj@...nel.org>, Pekka Enberg <penberg@...helsinki.fi>,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [cpuops cmpxchg double V2 1/4] Generic support for	this_cpu_cmpxchg_double

What is the problem with passing 128-bit structures by value?  I'm quite sure *that* is okay.

"Mathieu Desnoyers" <mathieu.desnoyers@...icios.com> wrote:

>* Christoph Lameter (cl@...ux.com) wrote:
>> On Fri, 21 Jan 2011, H. Peter Anvin wrote:
>> 
>> > We could do cmpxchg with a structure... the problem with a lon int
>type is that Cristoph ran into bugs with __int128 on 64 bits.
>> 
>> We also would need to be pass the structure by value (well its really
>a
>> variable but its like passing by value) in order to be similar to the
>> other this_cpu_ops
>> 
>> You'd want either
>> 
>> DEFINE_PERCPU(struct mycustomdoublestruct, percpu_dd)
>> 
>> this_cpu_cmpxchg_double(percpu_dd, oldword1, oldword2, newword1,
>newword2)
>> 
>> with the problem of type checking
>
>What is the problem with type checking here ?
>
>We could use a gcc builtin like the following to check if the alignment
>of
>"percpu_dd" meets the double-cas requirements:
>
>#define testmacro(a, b) \
>   __builtin_choose_expr(__alignof__(a) >= 2 * sizeof(unsigned long), \
>                              ((a).low) = (b), \    /* success */
>                              ((a).low) = (void) 0) /* compile-error */
>
>> or
>> 
>> this_cpu_cmpxchg_double(percpu_dd, old_dd, new_dd)
>> 
>> with the problem of 128 bit constants/structs passed by value.
>
>Yeah, I guess trying to deal with 128-bit value might be a bit tricky.
>But
>having something sane and with compile-time-checked alignment for the
>percpu_dd
>type is not to be looked over.
>
>Thanks,
>
>Mathieu
>
>-- 
>Mathieu Desnoyers
>Operating System Efficiency R&D Consultant
>EfficiOS Inc.
>http://www.efficios.com

-- 
Sent from my mobile phone.  Please pardon any lack of formatting.
--
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