When do you copy?When Xen updates the parameters normally. The interface never really
I'd rather have a single copy for guest and host.
needed to share the memory between hypervisor and guest, and I think
avoiding it is a bit more robust.
But for KVM, you already use the MSR to place the pvclock_vcpu_time_info
structure, so you could just place it in the page and use the same
memory for kernel and usermode.
If the hypervisor does a pvclock->version = somethingelse->version++The guest should never get confused by the version being changed by the
then the guest may get confused. But I understand you have a
guest-private ->version?
hypervisor. It's already part of the ABI. Or did you mean something else?
I'm not sure what you mean by "guest-private version"; the versions are
always guest-private: te version is part of the pvclock structure,
which is per-vcpu, which is private to each guest. The guest nevern
maintains a separate long-term copy of the structure, only a transient
snapshot while computing time from the tsc (that's the current pvclock.c
code).
No need to read them atomically.I don't think that's necessary, but I can certainly live with it if it
cpu1 = vgetcpu()
hver1 = pvclock[cpu1].hver
kver1 = pvclock[cpu1].kver
tsc = rdtsc
/* multipication magic with pvclock[cpu1]*/
cpu2 = vgetcpu()
hver2 = pvclock[cpu2].hver
kver2 = pvclock[cpu2].kver
valid = cpu1 == cpu2&& hver1 == hver2&& kver1 == kver2
makes you happier.