On 07.02.2018 12:46, David Hildenbrand wrote: > It think I found various BUGs in the recently added Multiple-epoch facility > support in KVM. Along with it, two cleanups. > > 1. The clock-comparator sign control is not considered. I sent a patch > with this previously. This now contains fixes and simplifications. > 2. SET CLOCK from the guest does not work reliably if the facility is > enabled (epoch index not set). > 3. Hotplugged CPUs don't inherit the epoch index. > 4. TOD clock syncs don't take care of overflows/underflows in the epoch > value and miss to update the epoch index. > > > This is RFC as I have basically no machine to test. Hopefully somebody > can jump in and verify that we now handle the epoch index in all > scenarios correctly. > > Most importantly, with Multiple-epoch facility, the condition > Guest TOD = Host TOD - 1 > Is represented by both, epoch and epoch_idx containing 0xff. So it is > treated as a 64+8bit signed number - we have to properly take care > of over/underflows when modifying the epoch. > > > David Hildenbrand (6): > KVM: s390: take care of clock-comparator sign control > KVM: s390: provide only a single function for setting the tod > KVM: s390: consider epoch index on hotplugged CPUs > KVM: s390: consider epoch index on TOD clock syncs > KVM: s390: no need to inititalize kvm->arch members to 0 > KVM: s390: generalize kvm_s390_get_tod_clock_ext() > > arch/s390/kvm/interrupt.c | 25 ++++++++--- > arch/s390/kvm/kvm-s390.c | 109 +++++++++++++++++++++++----------------------- > arch/s390/kvm/kvm-s390.h | 5 +-- > arch/s390/kvm/priv.c | 9 ++-- > 4 files changed, 80 insertions(+), 68 deletions(-) > CC'ing Collin (sorry missed you) -- Thanks, David / dhildenb