Unlike KVM, we won't use percpu variables because Xen already lays down statically the shared info structure, that includes the vcpu info pointer for each cpu.
We could in theory use percpu variables to store pointers to the current cpu
vcpu info, but I ended up giving up this route. Since our pcpu implementation have the overhead of computing addresses anyway, we may as well pay the price and compute it directly from the xen shared info.
One of the things that comes with it, is that we can compute precise timings using xenclock very early. Since we don't have *that* much to do early, it is unclear if KVM needs to be improved in this regard (probably not), so this becomes just a slight bonus.
70583a5 xen: implement paravirtual clock driver for xen
arch/x64/xen.cc | 2 +-
arch/x64/xen.hh | 1 +
build.mk | 2 +-
drivers/xenclock.cc | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 64 insertions(+), 2 deletions(-)
Upstream: github.com