Subject: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

From: [email-masked] (Marc Zyngier)
Date: Wed, 08 Jul 2015 17:37:25 +0100

On 08/07/15 17:06, Peter Maydell wrote:
> On 8 July 2015 at 16:56, Marc Zyngier <[email-masked]> wrote:
>> On 29/06/15 18:37, Peter Maydell wrote:
>>> On 29 June 2015 at 18:20, Claudio Fontana <[email-masked]> wrote:
>>>> On 26.06.2015 06:49, Jan Kiszka wrote:
>>>>> QEMU has the concept of write-back levels: KVM_PUT_RUNTIME_STATE,
>>>>> KVM_PUT_RESET_STATE and KVM_PUT_FULL_STATE. I suspect this registers is
>>>>> just sorted into the wrong category, thus written as part of the
>>>>> RUNTIME_STATE. We had such bug patterns during the x86 maturing phase as
>>>>> well.
>>>
>>>> It seems that QEMU target-arm ignores the level parameter to
>>>> kvm_arch_put_registers completely.
>>>>
>>>> Is it intended?
>>>
>>> Yes, sort of. We don't in general know anything about the semantics
>>> of most of the system registers. It should always be safe to
>>> read them all out of the kernel and write them back...
>>
>> I'm not sure you can safely assume this for time related things, unless
>> you can guarantee that all vcpus are stopped. Claudio is seeing time
>> jumping in weird ways, and so have I, which would tend to show that QEMU
>> is introducing some jitter.
>>
>> Maybe not easily observable on real hardware, but the FastModel is
>> enough to show the issue.
>>
>> So unless someone has a better solution, I'm seriously considering
>> getting this patch merged.
> 
> I'd prefer it if somebody could investigate to see why QEMU
> is actually doing this -- so far we just have speculation.

I'd prefer that too, but so far people seem to be more comfortable
waiting for the issue to fix itself. In the meantime, VMs are broken in
weird and wonderful ways, and I don't think the current status-quo helps
anyone.

	M.
-- 
Jazz is not dead. It just smells funny...