[lkml]   [2011]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [cpuops cmpxchg double V2 1/4] Generic support for this_cpu_cmpxchg_double
    On Fri, 21 Jan 2011, Mathieu Desnoyers wrote:

    > I'm again probably missing something, but what is "clumsy" about defining a
    > structure like the following to ensure proper alignment of the target
    > pointer (instead of adding a runtime test) ?
    > struct cmpxchg_double {
    > unsigned long low, high;
    > #else
    > unsigned long high, low;
    > #endif
    > } __attribute__((packed, aligned(2 * sizeof(unsigned long))));
    > (note: packed here along with "aligned" does _not_ generate ugly bytewise
    > read/write memory ops like "packed" alone. The use of "packed" is to let the
    > compiler down-align the structure to the value requested, instead of uselessly
    > aligning it on 32-byte if it chooses to.)
    > The prototype could then look like:
    > bool __this_cpu_generic_cmpxchg_double(pcp, oval_low, oval_high, nval_low, nval_high);
    > 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. You would be implicitly passing a 128 bit argument although the
    compiler may not need to generate code for that.

    > I think Christoph's point is that he wants to alias this with a pointer. Well,
    > this can be done cleanly with:
    > union {
    > 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?

    > Thoughts ?

    Could you actually try to write a patch instead running through points
    that we have discussed earlier?

     \ /
      Last update: 2011-01-21 18:09    [W:0.021 / U:17.528 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site