2017-11-13 9:03 GMT+08:00 Wanpeng Li <kernellwp@xxxxxxxxx>: > 2017-11-13 8:55 GMT+08:00 Liran Alon <LIRAN.ALON@xxxxxxxxxx>: >> >> >> On 13/11/17 02:52, Wanpeng Li wrote: >>> >>> 2017-11-13 8:44 GMT+08:00 Liran Alon <LIRAN.ALON@xxxxxxxxxx>: >>>> >>>> >>>> >>>> On 13/11/17 02:40, Wanpeng Li wrote: >>>>> >>>>> >>>>> 2017-11-05 22:11 GMT+08:00 Liran Alon <liran.alon@xxxxxxxxxx>: >>>>>> >>>>>> >>>>>> When guest passes KVM it's pvclock-page GPA via WRMSR to >>>>>> MSR_KVM_SYSTEM_TIME / MSR_KVM_SYSTEM_TIME_NEW, KVM don't initialize >>>>>> pvclock-page to some start-values. It just requests a clock-update >>>>>> which >>>>> >>>>> >>>>> >>>>> KVM does, please refer to memset(hv_clock, 0, size) in kvmclock_init(). >>>> >>>> >>>> >>>> kvmclock_init() is the code that runs in KVM-guest. I was talking here >>>> about >>>> the code that handles the WRMSR in KVM hypervisor code. >>>> >>>> The issue happens when the guest doesn't init pvclock-page as done in >>>> kvmclock_init(). Not all guests behave nicely :) >>> >>> >>> But the codes which you modify just works for kvm guest I think. >> >> No, it's the code that runs in KVM hypervisor for any guest that knows how >> to work with KVM pv-clock PV interface. >> Linux guest is just one of the possible guests which can use this interface. >> kvmclock_init() you mentioned is part of the linux-guest. But there are >> other guests which use KVM pv-clock PV interface. > > Good to know it, could you point one? In addition, there is a BUG_ON(if version != 0) just before the codes which you added. I will move these avoid random junk logics into msr setup in order that it can avoid '& operation' each time update the pv stuff. I will send a patch later. Regards, Wanpeng Li