Re: linux-next: percpu tree build warning

From: Tejun Heo
Date: Wed Nov 25 2009 - 10:13:24 EST


Hello,

11/25/2009 10:40 PM, Ingo Molnar wrote:
> And look at your own 'cleanup' patch - it changes the percpu name to
> 'cpu_dr7'. That results in nonsensical repetition:
>
> dr7 = &__get_cpu_var(cpu_dr7);

My whole argument can be compressed into "don't name a global symbol
dr7, no matter what it is".

The key problem is the artificial difference between static and
dynamic percpu variable accessors. The old way of prefixing from
accessors only works for symbol literals, so either we need another
identical set for dynamic ones without auto-prefixing or we end up
doing the repetition you mentioned above in much uglier way.

Option 1:

this_cpu_static_OP(dr7, ARG);
this_cpu_dynamic_OP(*allocated_ptr, ARG);
this_cpu_dynamic_OP(per_cpu_var(dr7), ARG);

Options 2:

this_cpu_OP(per_cpu_var(dr7), ARG);

BTW, option 2 is what we've been doing before the change. It's just
ugly and the prefix no longer provides much protection because users
outside of percpu code have to use per_cpu_var() which never was
supposed to go outside of percpu internal code. All it ends up doing
is providing false sense of address space isolation when there is
none.

DEFINE_*(NAME) defines a global symbol NAME in all other definition
macros. DEFINE_PER_CPU() does so too.

Thanks.

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