yOn Tue, 6 Jan 2009, Rusty Russell wrote: > It was a Richard Henderson thing. It was over six years ago, but I found > one decent reference to it: > > http://lwn.net/2002/0214/a/per-cpu.php3 > > Hope that answers your question? Well thats the patch you sent in to Linus. I see one relevant comment in there: +/* This macro obfuscates arithmetic on a variable address so that gcc + shouldn't recognize it. This prevents optimizations such as the + famous: + strcpy(s, "xxx"+X) => memcpy(s, "xxx"+X, 4-X) */ +#define reloc_hide(var, off) \ + ({ __typeof__(&(var)) __ptr; \ + __asm__ ("" : "=g"(__ptr) : "0"((void *)&(var) + (off))); \ + *__ptr; }) I dont get the point here. strcpy(s, "xxx" + X ) -> memcpy(s, "xxx" + X, strlen("xxx" + X) + 1) -> memcpy(s, "xxx" + X, 4 - X) So far okay. The problem is the adding of an offset to a variable? X is the per cpu offset? Strings are not put into per cpu areas by the compiler so this example here is not clear nor relevant to percpu issues. Andi said a while back that the RELOC_HIDE macro exists because of wrapping issues. http://lists.openwall.net/linux-kernel/2006/08/24/340. That issue does not seem to be apply on x86 since signed and unsigned additions are the same. Moreover zero based per cpu addresses will avoid wrapping entirely. Could we clearly document what the point of RELOC_HIDE is? -- To unsubscribe from this list: send the line "unsubscribe linux-next" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html