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 <zhaoshenglong@xxxxxxxxxx> >> >> 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