[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] kvm: Delete the slot only when KVM_MEM_READONLY
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] kvm: Delete the slot only when KVM_MEM_READONLY flag is changed |
Date: |
Wed, 13 Jun 2018 17:58:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 13/06/2018 04:15, Shannon Zhao wrote:
>
>
> On 2018/6/12 20:17, Paolo Bonzini wrote:
>> On 16/05/2018 11:18, Shannon Zhao wrote:
>>> According to KVM commit 75d61fbc, it needs to delete the slot before
>>> changing the KVM_MEM_READONLY flag. But QEMU commit 235e8982 only check
>>> whether KVM_MEM_READONLY flag is set instead of changing. It doesn't
>>> need to delete the slot if the KVM_MEM_READONLY flag is not changed.
>>>
>>> This fixes a issue that migrating a VM at the OVMF startup stage and
>>> VM is executing the codes in rom. Between the deleting and adding the
>>> slot in kvm_set_user_memory_region, there is a chance that guest access
>>> rom and trap to KVM, then KVM can't find the corresponding memslot.
>>> While KVM (on ARM) injects an abort to guest due to the broken hva, then
>>> guest will get stuck.
>>>
>>> Signed-off-by: Shannon Zhao <address@hidden>
>>
>> I'm a bit worried about old_flags not being set on all paths to
>> kvm_set_user_memory_region. This would lead to extra
>> KVM_SET_USER_MEMORY_REGION calls. It should not be a problem but
>> it is ugly. Does something like the additional changes below work for you?
>>
> I test below patch. It works for our testcase.
> Do I need to fold them into one and resend?
No need to, thanks!
Paolo