Re: [cpuops cmpxchg double V2 1/4] Generic support forthis_cpu_cmpxchg_double

From: Christoph Lameter
Date: Fri Jan 21 2011 - 13:06:52 EST


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.

> > > 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. 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/