|
@@ -89,8 +89,13 @@ static inline unsigned int __getcpu(void)
|
|
|
* works on all CPUs. This is volatile so that it orders
|
|
|
* correctly wrt barrier() and to keep gcc from cleverly
|
|
|
* hoisting it out of the calling function.
|
|
|
+ *
|
|
|
+ * If RDPID is available, use it.
|
|
|
*/
|
|
|
- asm volatile ("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
|
|
|
+ alternative_io ("lsl %[p],%[seg]",
|
|
|
+ ".byte 0xf3,0x0f,0xc7,0xf8", /* RDPID %eax/rax */
|
|
|
+ X86_FEATURE_RDPID,
|
|
|
+ [p] "=a" (p), [seg] "r" (__PER_CPU_SEG));
|
|
|
|
|
|
return p;
|
|
|
}
|