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]
Date:	Fri, 21 Jan 2011 13:37:52 -0500
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Christoph Lameter <cl@...ux.com>
Cc:	Tejun Heo <tj@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
	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

* Christoph Lameter (cl@...ux.com) wrote:
> On Fri, 21 Jan 2011, Mathieu Desnoyers wrote:
> 
> > > > With:
> > > >   struct cmpxchg_double *pcp
> > >
> > > That does not conform to the parameter conventions in other this_cpu_ops.
> > > The first parameter is a variable because the notion of a pointer is
> > > problematic given that percpu operations use a segment prefix to relocate
> > > pointers.
> >
> > So the first argument could be along the lines of:
> >
> > struct cmpxchg_double pcp
> >
> > then.
> 
> Ok then you would pass a struct by value? Or use a non-scalar as a
> variable passed to a this_cpu_op? So far per cpu scalars have been the
> only variables allowed to be specified in this_cpu operations.

What I have in mind is that the struct passed would be non-scalar for this
specific operation. I'm not sure about the distinction between "pass a struct by
value" and "use a non-scalar as a variable passed to a this_cpu_op" -- I feel
I'm missing an important detail in what you say, because I see these as being
the same thing.

> 
> > > >         struct cmpxchg_double casdbl;
> > > >         struct {
> > > >                 void *ptr;
> > > >                 unsigned long cpuid_tid;
> > > >         } t;
> > > > }
> > >
> > > There is no need for aliases with the existing implementation.
> > >
> > > How will the macro check the parameters now?
> >
> > Well, my last proposal to check __alignof__ within a __builtin_choose_expr
> > check wouldn't need this union actually, which would be much better I think.
> 
> The existing implementation has a check for alignment. That is not the
> problem.

It's a dynamic check right ? (based on VM_BUG_ON() if I remember well) It adds
code and runtime conditions, which would go away if we let the alignment check
be done at compile-time.

> The typechecking would need to be addressed. I.e. if I pass a
> pointer for old and an ulong for the new value then I'd like to see the
> compiler complain. Or if the first parameter is a long but the type of the
> first word is a pointer etc etc.

Hrm. Then the only solution I see would be to require that the structure
used as percpu_dd parameter have fixed field names (yeah, that's a bit odd, but
could not come up with a more elegant solution at the moment):

struct mycustomdoublestruct {
        sometype word1;
        someothertype word2;
}

So we can access percpu_dd.word1 and percpu_dd.word2 within
this_cpu_cmpxchg_double for the type checking.

Mathieu


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
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