Re: [PATCH] x86: Drop RDPID macro to discourage use of RDPID in the kernel

From: Peter Zijlstra
Date: Wed Oct 28 2020 - 17:44:05 EST


On Tue, Oct 27, 2020 at 02:45:32PM -0700, Sean Christopherson wrote:
> Drop the GAS-compatible RDPID macro as RDPID shouldn't be used in the
> kernel, excepting the vDSO, which handcodes RDPID in inline asm. RDPID
> is unsafe in the kernel because KVM loads guest's TSC_AUX on VM-entry
> and may not restore the host's value until the CPU returns to userspace.
>
> See commit 6a3ea3e68b8a ("x86/entry/64: Do not use RDPID in paranoid
> entry to accomodate KVM") for details.

Well, remove it because there is no (current) user, OK. But if there's a
compelling kernel side use for it, KVM can go suck rocks.