Re: [RFC PATCH 1/2] Hyper-H reference counter

Paolo Bonzini
2013-05-16T14:48:11Z

Il 16/05/2013 16:22, Vadim Rozenfeld ha scritto:
>>>>>>>>>>> > >>>>> > > > > + addr = gfn_to_hva(kvm, gfn);
>>>>>>>>>>> > >>>>> > > > > + if (kvm_is_error_hva(addr))
>>>>>>>>>>> > >>>>> > > > > + return 1;
>>>>>>>>>>> > >>>>> > > > > + tsc_ref = 0;
>> >
>> > This should write 0xFFFFFFFF.
> This should write 0

No. You have not writing sensible values to TscScale/TscOffset, hence
the VM should fall back to another time source.

Microsoft docs say "A special value of 0xFFFFFFFF is used to indicate
that this facility is no longer a reliable source of reference time and
the virtual machine must fall back to a different source (for example,
the virtual PM timer)".

So you need to write 0xFFFFFFFF here (though my suggestion would rather
be to remove this part of the patch, and do everything in the next
patch). The next patch should pick 0 if constant TSC is available,
0xFFFFFFFF if it is not.

If the docs are wrong, I stand corrected but then you need a comment
explaining that.

Paolo