clock: extract common code between kvmclock and xenclock

A recent commit 34232de90fc982293d9beadab6930b2f013552e9 fixed a bug
in kvmclock. It turns out that xenclock suffers from the same
problems. Both clocks share a lot of logic. This change extracts
common code to pv_based_clock base class which forces xenclock to
inherit the fixes.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: introduce microbenchmark for various locking primitives

Results on my machine:

$ scripts/run.py -e "/tests/misc-lock-perf.so"
OSv v0.09-119-g59c0cec
eth0: 192.168.122.15
dummy      =   0.037 ns/cycle
preempt    =   6.360 ns/cycle
migrate    =   5.297 ns/cycle
mutex      =  25.474 ns/cycle

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
clock: use migration_lock to protect access to per-CPU data

Migration lock is sufficient and a bit faster (20%) than preemption lock.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>