: kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
The culprit is commit:
commit 235e8982ad393e5611cb892df54881c872eea9e1
Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700
kvm: support using KVM_MEM_READONLY flag for regions
I'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to kvm_vm_ioctl().
Paolo Bonzini
maintainerIl 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 11 lines
The culprit is commit:
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().
Reproducer?
Paolo
Quoted 7 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 6 lines
The culprit is commit:
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700
Quoted 7 lines
Quoted 5 lines
kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu) kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().
As noted in the code, the first call is for KVM commit 75d61fbc.
I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
-Jordan
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/
Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)
Is this what you're asking?
Quoted 39 lines · Luiz Capitulino
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
Quoted 8 lines
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)Is this what you're asking?
I guess I was meaning ... if you write to an address such as 0xfffffff0, does it update as RAM, or does it retain the original value?
This is easy to test in OVMF at the EFI shell, but I'm not sure how you could easily test it otherwise.
Does the system actually boot for you after the error message?
-Jordan
Quoted 48 lines · On Thu, 30 May 2013 10:32:36 -0700 Jordan Justen <[email protected]> wrote:
Quoted 46 lines · Luiz Capitulino
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)
Quoted 8 lines
Quoted 1 line
Is this what you're asking?
I guess I was meaning ... if you write to an address such as
0xfffffff0, does it update as RAM, or does it retain the original value?This is easy to test in OVMF at the EFI shell, but I'm not sure how you could easily test it otherwise.
I could try to hack something, but maybe not today.
Quoted 1 line
Does the system actually boot for you after the error message?
No, I get an abort. That's what kvm_set_phys_mem() does when kvm_set_user_memory_region() fails:
(gdb) bt
#0 0x00007f01f8592ba5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:63 #1 0x00007f01f8594358 in __GI_abort () at abort.c:90 #2 0x00007f01fedb57f1 in kvm_set_phys_mem (section=0x7f01ee6975d0, add=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:692 #3 0x00007f01fedb5bfa in kvm_region_del (listener=0x7f01ff2bc360 <kvm_memory_listener>, section=0x7f01ee6975d0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:795 #4 0x00007f01fedbc92d in address_space_update_topology_pass (as=0x7f01ffadfa60 <address_space_memory>, old_view=..., new_view=..., adding=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:689 #5 0x00007f01fedbd125 in address_space_update_topology (as=0x7f01ffadfa60 <address_space_memory>) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:725 #6 0x00007f01fedbd29c in memory_region_transaction_commit () at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:750 #7 0x00007f01fec1b977 in i440fx_update_memory_mappings (d=0x7f0200511940) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:131 #8 0x00007f01fec1bab3 in i440fx_write_config (dev=0x7f0200511940, address=94, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:154 #9 0x00007f01fec29a9a in pci_host_config_write_common (pci_dev=0x7f0200511940, addr=94, limit=256, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:54
#10 0x00007f01fec29ba2 in pci_data_write (s=0x7f0200502a50, addr=2147483742, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:75
#11 0x00007f01fec29d5e in pci_host_data_write (opaque=0x7f02004fa1c0, addr=2, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:128
#12 0x00007f01fedbac6e in memory_region_write_accessor (opaque=0x7f02004fc598, addr=2, value=0x7f01ee697a70, size=1, shift=0, mask=255) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:334 #13 0x00007f01fedbad50 in access_with_adjusted_size (addr=2, value=0x7f01ee697a70, size=1, access_size_min=1, access_size_max=4, access=0x7f01fedbabe9 <memory_region_write_accessor>, opaque=0x7f02004fc598)
at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:364
#14 0x00007f01fedbb1b8 in memory_region_iorange_write (iorange=0x7f0200503550, offset=2, width=1, data=51) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:439 #15 0x00007f01fedb33aa in ioport_writeb_thunk (opaque=0x7f0200503550, addr=3326, data=51) at /home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:212
#16 0x00007f01fedb2d84 in ioport_write (index=0, address=3326, data=51) at /home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:83
#17 0x00007f01fedb3924 in cpu_outb (addr=3326, val=51 '3') at /home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:289
#18 0x00007f01fedb76c5 in kvm_handle_io (port=3326, data=0x7f01fea6e000, direction=1, size=1, count=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1507 #19 0x00007f01fedb7d59 in kvm_cpu_exec (env=0x7f02004e24e0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1659
#20 0x00007f01fed3dc3f in qemu_kvm_cpu_thread_fn (arg=0x7f02004e24e0) at /home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:759
#21 0x00007f01fcf02d15 in start_thread (arg=0x7f01ee698700) at pthread_create.c:308
#22 0x00007f01f864f48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:114
(gdb)
Paolo Bonzini
maintainerIl 30/05/2013 19:56, Luiz Capitulino ha scritto:
Quoted 53 lines
Quoted 50 lines · On Thu, 30 May 2013 10:32:36 -0700 Jordan Justen <[email protected]> wrote:
Quoted 47 lines · Luiz Capitulino
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)Is this what you're asking?
Quoted 8 lines
Quoted 6 lines
I guess I was meaning ... if you write to an address such as
0xfffffff0, does it update as RAM, or does it retain the original value?This is easy to test in OVMF at the EFI shell, but I'm not sure how you could easily test it otherwise.
I could try to hack something, but maybe not today.
Just put a breakpoint on pflash_cfi01_register and see if it is reached.
I cannot reproduce it, but I'm also on 3.8.x. Will look at it tomorrow.
Paolo
Quoted 32 lines
Quoted 1 line
Does the system actually boot for you after the error message?
No, I get an abort. That's what
kvm_set_phys_mem()does whenkvm_set_user_memory_region()fails:(gdb) bt
#0 0x00007f01f8592ba5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:63 #1 0x00007f01f8594358 in __GI_abort () at abort.c:90 #2 0x00007f01fedb57f1 in kvm_set_phys_mem (section=0x7f01ee6975d0, add=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:692 #3 0x00007f01fedb5bfa in kvm_region_del (listener=0x7f01ff2bc360 <kvm_memory_listener>, section=0x7f01ee6975d0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:795 #4 0x00007f01fedbc92d in address_space_update_topology_pass (as=0x7f01ffadfa60 <address_space_memory>, old_view=..., new_view=..., adding=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:689 #5 0x00007f01fedbd125 in address_space_update_topology (as=0x7f01ffadfa60 <address_space_memory>) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:725 #6 0x00007f01fedbd29c in memory_region_transaction_commit () at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:750 #7 0x00007f01fec1b977 in i440fx_update_memory_mappings (d=0x7f0200511940) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:131 #8 0x00007f01fec1bab3 in i440fx_write_config (dev=0x7f0200511940, address=94, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:154 #9 0x00007f01fec29a9a in pci_host_config_write_common (pci_dev=0x7f0200511940, addr=94, limit=256, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:54#10
0x00007f01fec29ba2inpci_data_write(s=0x7f0200502a50, addr=2147483742, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:75
#110x00007f01fec29d5einpci_host_data_write(opaque=0x7f02004fa1c0, addr=2, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:128
#120x00007f01fedbac6einmemory_region_write_accessor(opaque=0x7f02004fc598, addr=2, value=0x7f01ee697a70, size=1, shift=0, mask=255) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:334#130x00007f01fedbad50inaccess_with_adjusted_size(addr=2, value=0x7f01ee697a70, size=1, access_size_min=1, access_size_max=4, access=0x7f01fedbabe9 <memory_region_write_accessor>, opaque=0x7f02004fc598)
at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:364
#140x00007f01fedbb1b8inmemory_region_iorange_write(iorange=0x7f0200503550, offset=2, width=1, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:439#150x00007f01fedb33aainioport_writeb_thunk(opaque=0x7f0200503550, addr=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:212
#160x00007f01fedb2d84inioport_write(index=0, address=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:83
#170x00007f01fedb3924incpu_outb(addr=3326, val=51 '3') at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:289
#180x00007f01fedb76c5inkvm_handle_io(port=3326, data=0x7f01fea6e000, direction=1, size=1, count=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1507#190x00007f01fedb7d59inkvm_cpu_exec(env=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1659
#200x00007f01fed3dc3finqemu_kvm_cpu_thread_fn(arg=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:759
#210x00007f01fcf02d15instart_thread(arg=0x7f01ee698700) at pthread_create.c:308
#220x00007f01f864f48din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:114
(gdb)
Quoted 58 lines · On Thu, 30 May 2013 20:05:29 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 19:56, Luiz Capitulino ha scritto:
Quoted 57 lines
Quoted 54 lines · On Thu, 30 May 2013 10:32:36 -0700 Jordan Justen <[email protected]> wrote:
Quoted 39 lines · Luiz Capitulino
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
Quoted 8 lines
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)Is this what you're asking?
I guess I was meaning ... if you write to an address such as
0xfffffff0, does it update as RAM, or does it retain the original value?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This is easy to test in OVMF at the EFI shell, but I'm not sure how you could easily test it otherwise.
I could try to hack something, but maybe not today.
Just put a breakpoint on
pflash_cfi01_registerand see if it is reached.
Reached on a regular boot right?
It's not reached, with or without the offending commit.
Quoted 38 lines
I cannot reproduce it, but I'm also on 3.8.x. Will look at it tomorrow.
Paolo
Quoted 32 lines
Quoted 1 line
Does the system actually boot for you after the error message?
No, I get an abort. That's what
kvm_set_phys_mem()does whenkvm_set_user_memory_region()fails:(gdb) bt
#0 0x00007f01f8592ba5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:63 #1 0x00007f01f8594358 in __GI_abort () at abort.c:90 #2 0x00007f01fedb57f1 in kvm_set_phys_mem (section=0x7f01ee6975d0, add=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:692 #3 0x00007f01fedb5bfa in kvm_region_del (listener=0x7f01ff2bc360 <kvm_memory_listener>, section=0x7f01ee6975d0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:795 #4 0x00007f01fedbc92d in address_space_update_topology_pass (as=0x7f01ffadfa60 <address_space_memory>, old_view=..., new_view=..., adding=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:689 #5 0x00007f01fedbd125 in address_space_update_topology (as=0x7f01ffadfa60 <address_space_memory>) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:725 #6 0x00007f01fedbd29c in memory_region_transaction_commit () at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:750 #7 0x00007f01fec1b977 in i440fx_update_memory_mappings (d=0x7f0200511940) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:131 #8 0x00007f01fec1bab3 in i440fx_write_config (dev=0x7f0200511940, address=94, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:154 #9 0x00007f01fec29a9a in pci_host_config_write_common (pci_dev=0x7f0200511940, addr=94, limit=256, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:54#10
0x00007f01fec29ba2inpci_data_write(s=0x7f0200502a50, addr=2147483742, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:75
#110x00007f01fec29d5einpci_host_data_write(opaque=0x7f02004fa1c0, addr=2, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:128
#120x00007f01fedbac6einmemory_region_write_accessor(opaque=0x7f02004fc598, addr=2, value=0x7f01ee697a70, size=1, shift=0, mask=255) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:334#130x00007f01fedbad50inaccess_with_adjusted_size(addr=2, value=0x7f01ee697a70, size=1, access_size_min=1, access_size_max=4, access=0x7f01fedbabe9 <memory_region_write_accessor>, opaque=0x7f02004fc598)
at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:364
#140x00007f01fedbb1b8inmemory_region_iorange_write(iorange=0x7f0200503550, offset=2, width=1, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:439#150x00007f01fedb33aainioport_writeb_thunk(opaque=0x7f0200503550, addr=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:212
#160x00007f01fedb2d84inioport_write(index=0, address=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:83
#170x00007f01fedb3924incpu_outb(addr=3326, val=51 '3') at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:289
#180x00007f01fedb76c5inkvm_handle_io(port=3326, data=0x7f01fea6e000, direction=1, size=1, count=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1507#190x00007f01fedb7d59inkvm_cpu_exec(env=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1659
#200x00007f01fed3dc3finqemu_kvm_cpu_thread_fn(arg=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:759
#210x00007f01fcf02d15instart_thread(arg=0x7f01ee698700) at pthread_create.c:308
#220x00007f01f864f48din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:114
(gdb)
Paolo Bonzini
maintainerIl 30/05/2013 22:32, Luiz Capitulino ha scritto:
Quoted 64 lines
Quoted 61 lines · On Thu, 30 May 2013 20:05:29 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 19:56, Luiz Capitulino ha scritto:
Quoted 60 lines
Quoted 56 lines · On Thu, 30 May 2013 10:32:36 -0700 Jordan Justen <[email protected]> wrote:
Quoted 39 lines · Luiz Capitulino
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
Quoted 8 lines
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)Is this what you're asking?
I guess I was meaning ... if you write to an address such as
0xfffffff0, does it update as RAM, or does it retain the original value?This is easy to test in OVMF at the EFI shell, but I'm not sure how you could easily test it otherwise.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
I could try to hack something, but maybe not today.
Just put a breakpoint on
pflash_cfi01_registerand see if it is reached.Reached on a regular boot right?
It's not reached, with or without the offending commit.
Thanks. Reproduced with 3.9.4.
Paolo
Quoted 40 lines
Quoted 37 lines
I cannot reproduce it, but I'm also on 3.8.x. Will look at it tomorrow.
Paolo
Quoted 32 lines
Quoted 1 line
Does the system actually boot for you after the error message?
No, I get an abort. That's what
kvm_set_phys_mem()does whenkvm_set_user_memory_region()fails:(gdb) bt
#0 0x00007f01f8592ba5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:63 #1 0x00007f01f8594358 in __GI_abort () at abort.c:90 #2 0x00007f01fedb57f1 in kvm_set_phys_mem (section=0x7f01ee6975d0, add=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:692 #3 0x00007f01fedb5bfa in kvm_region_del (listener=0x7f01ff2bc360 <kvm_memory_listener>, section=0x7f01ee6975d0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:795 #4 0x00007f01fedbc92d in address_space_update_topology_pass (as=0x7f01ffadfa60 <address_space_memory>, old_view=..., new_view=..., adding=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:689 #5 0x00007f01fedbd125 in address_space_update_topology (as=0x7f01ffadfa60 <address_space_memory>) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:725 #6 0x00007f01fedbd29c in memory_region_transaction_commit () at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:750 #7 0x00007f01fec1b977 in i440fx_update_memory_mappings (d=0x7f0200511940) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:131 #8 0x00007f01fec1bab3 in i440fx_write_config (dev=0x7f0200511940, address=94, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:154 #9 0x00007f01fec29a9a in pci_host_config_write_common (pci_dev=0x7f0200511940, addr=94, limit=256, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:54#10
0x00007f01fec29ba2inpci_data_write(s=0x7f0200502a50, addr=2147483742, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:75
#110x00007f01fec29d5einpci_host_data_write(opaque=0x7f02004fa1c0, addr=2, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:128
#120x00007f01fedbac6einmemory_region_write_accessor(opaque=0x7f02004fc598, addr=2, value=0x7f01ee697a70, size=1, shift=0, mask=255) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:334#130x00007f01fedbad50inaccess_with_adjusted_size(addr=2, value=0x7f01ee697a70, size=1, access_size_min=1, access_size_max=4, access=0x7f01fedbabe9 <memory_region_write_accessor>, opaque=0x7f02004fc598)
at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:364
#140x00007f01fedbb1b8inmemory_region_iorange_write(iorange=0x7f0200503550, offset=2, width=1, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:439#150x00007f01fedb33aainioport_writeb_thunk(opaque=0x7f0200503550, addr=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:212
#160x00007f01fedb2d84inioport_write(index=0, address=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:83
#170x00007f01fedb3924incpu_outb(addr=3326, val=51 '3') at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:289
#180x00007f01fedb76c5inkvm_handle_io(port=3326, data=0x7f01fea6e000, direction=1, size=1, count=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1507#190x00007f01fedb7d59inkvm_cpu_exec(env=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1659
#200x00007f01fed3dc3finqemu_kvm_cpu_thread_fn(arg=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:759
#210x00007f01fcf02d15instart_thread(arg=0x7f01ee698700) at pthread_create.c:308
#220x00007f01f864f48din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:114
(gdb)
Quoted 67 lines · Paolo Bonzini
Il 30/05/2013 22:32, Luiz Capitulino ha scritto:
Quoted 66 lines
Quoted 63 lines · On Thu, 30 May 2013 20:05:29 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 19:56, Luiz Capitulino ha scritto:
Quoted 61 lines
Quoted 48 lines · On Thu, 30 May 2013 10:32:36 -0700 Jordan Justen <[email protected]> wrote:
Quoted 46 lines · Luiz Capitulino
Quoted 32 lines · On Thu, 30 May 2013 09:50:10 -0700 Jordan Justen <[email protected]> wrote:
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
Quoted 8 lines
Quoted 1 line
Reproducer?
I just try to start a VM (HEAD 87d23f7):
~/work/virt/ sudo ./qemu-qmp -drive file=disks/test.img,if=virtio,cache=none,aio=native -enable-kvm -m 1G -monitor stdio -cpu host -snapshot QEMU 1.5.50 monitor - type 'help' for more information
(qemu)kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
~/work/virt/Quoted 4 lines
Sorry. I am working with Linux 3.8.0, and I don't see this. I'll try to update my kernel.
Does the firmware behave as a ROM for you?
I think so:
(qemu) info roms
fw=genroms/kvmvapic.bin size=0x002400 name="kvmvapic.bin" addr=00000000fffe0000 size=0x020000 mem=rom name="bios.bin" (qemu)Quoted 8 lines
Quoted 1 line
Is this what you're asking?
I guess I was meaning ... if you write to an address such as
0xfffffff0, does it update as RAM, or does it retain the original value?This is easy to test in OVMF at the EFI shell, but I'm not sure how you could easily test it otherwise.
I could try to hack something, but maybe not today.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Just put a breakpoint on
pflash_cfi01_registerand see if it is reached.Reached on a regular boot right?
It's not reached, with or without the offending commit.
Thanks. Reproduced with 3.9.4.
I have also reproduced it on 3.9.0. I'll look into it.
Is there a bug filed on this?
-Jordan
Quoted 41 lines
Quoted 40 lines
Quoted 37 lines
I cannot reproduce it, but I'm also on 3.8.x. Will look at it tomorrow.
Paolo
Quoted 32 lines
Quoted 1 line
Does the system actually boot for you after the error message?
No, I get an abort. That's what
kvm_set_phys_mem()does whenkvm_set_user_memory_region()fails:(gdb) bt
#0 0x00007f01f8592ba5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:63 #1 0x00007f01f8594358 in __GI_abort () at abort.c:90 #2 0x00007f01fedb57f1 in kvm_set_phys_mem (section=0x7f01ee6975d0, add=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:692 #3 0x00007f01fedb5bfa in kvm_region_del (listener=0x7f01ff2bc360 <kvm_memory_listener>, section=0x7f01ee6975d0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:795 #4 0x00007f01fedbc92d in address_space_update_topology_pass (as=0x7f01ffadfa60 <address_space_memory>, old_view=..., new_view=..., adding=false) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:689 #5 0x00007f01fedbd125 in address_space_update_topology (as=0x7f01ffadfa60 <address_space_memory>) at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:725 #6 0x00007f01fedbd29c in memory_region_transaction_commit () at /home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:750 #7 0x00007f01fec1b977 in i440fx_update_memory_mappings (d=0x7f0200511940) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:131 #8 0x00007f01fec1bab3 in i440fx_write_config (dev=0x7f0200511940, address=94, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci-host/piix.c:154 #9 0x00007f01fec29a9a in pci_host_config_write_common (pci_dev=0x7f0200511940, addr=94, limit=256, val=51, len=1) at /home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:54#10
0x00007f01fec29ba2inpci_data_write(s=0x7f0200502a50, addr=2147483742, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:75
#110x00007f01fec29d5einpci_host_data_write(opaque=0x7f02004fa1c0, addr=2, val=51, len=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/hw/pci/pci_host.c:128
#120x00007f01fedbac6einmemory_region_write_accessor(opaque=0x7f02004fc598, addr=2, value=0x7f01ee697a70, size=1, shift=0, mask=255) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:334#130x00007f01fedbad50inaccess_with_adjusted_size(addr=2, value=0x7f01ee697a70, size=1, access_size_min=1, access_size_max=4, access=0x7f01fedbabe9 <memory_region_write_accessor>, opaque=0x7f02004fc598)
at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:364
#140x00007f01fedbb1b8inmemory_region_iorange_write(iorange=0x7f0200503550, offset=2, width=1, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/memory.c:439#150x00007f01fedb33aainioport_writeb_thunk(opaque=0x7f0200503550, addr=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:212
#160x00007f01fedb2d84inioport_write(index=0, address=3326, data=51) at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:83
#170x00007f01fedb3924incpu_outb(addr=3326, val=51 '3') at/home/lcapitulino/work/src/upstream/qmp-unstable/ioport.c:289
#180x00007f01fedb76c5inkvm_handle_io(port=3326, data=0x7f01fea6e000, direction=1, size=1, count=1) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1507#190x00007f01fedb7d59inkvm_cpu_exec(env=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:1659
#200x00007f01fed3dc3finqemu_kvm_cpu_thread_fn(arg=0x7f02004e24e0) at/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:759
#210x00007f01fcf02d15instart_thread(arg=0x7f01ee698700) at pthread_create.c:308
#220x00007f01f864f48din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:114
(gdb)
Quoted 16 lines · Jordan Justen
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().
Quoted 6 lines
As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
I have reproduced this bug, it seems that the bug is caused by double free the memslot. After these change, it can boot the guest now.
kvm-all.c +2 -1
@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Quoted 19 lines · Xiao Guangrong
Quoted 18 lines · Jordan Justen
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.
Quoted 7 lines
Quoted 4 lines
I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
I have reproduced this bug, it seems that the bug is caused by double free the memslot. After these change, it can boot the guest now.
I think that I might have found that the flash memory had an issue with transitioning from flash to rom mode with code like this on the 3.8 kernel. I'll test it on 3.8 & 3.9.
-Jordan
Quoted 16 lines
kvm-all.c +2
-1@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Quoted 24 lines · Jordan Justen
Quoted 22 lines · Xiao Guangrong
Quoted 21 lines · Jordan Justen
Quoted 6 lines · Luiz Capitulino
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Xiao, any thoughts?
I have reproduced this bug, it seems that the bug is caused by double free the memslot. After these change, it can boot the guest now.
I think that I might have found that the flash memory had an issue with transitioning from flash to rom mode with code like this on the 3.8 kernel. I'll test it on 3.8 & 3.9.
Yes, the issue still occurs on 3.9, and even the "double free" doesn't work on 3.9 like it did on 3.8.
This issue is a bit of a corner case for flash, but still important. I hope maybe Xiao might have time to help me understand it. (I'll email Xiao off-list about this.)
But, for now, I think Xiao's patch will fix things for the non-flash case, and will not totally break flash support either.
-Jordan
Paolo Bonzini
maintainerIl 31/05/2013 08:51, Xiao Guangrong ha scritto:
Quoted 36 lines · Jordan Justen
Quoted 16 lines · Luiz Capitulino
Quoted 6 lines
Quoted 3 lines · On Thu, 30 May 2013 18:03:04 +0200 Paolo Bonzini <[email protected]> wrote:
Il 30/05/2013 17:46, Luiz Capitulino ha scritto:
Quoted 2 lines
The culprit is commit:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
commit
235e8982ad393e5611cb892df54881c872eea9e1Author: Jordan Justen <[email protected]> Date: Wed May 29 01:27:26 2013 -0700kvm: support using
KVM_MEM_READONLYflag for regionsI'm running 3.9.2-200.fc18, btw. And, error checking is missing on the first call to
kvm_vm_ioctl().Quoted 6 lines
As noted in the code, the first call is for KVM commit
75d61fbc.I'm not sure we want to fail if an error occurs when making that call. (I'm pretty sure we don't want to in fact.)
Xiao, any thoughts?
I have reproduced this bug, it seems that the bug is caused by double free the memslot. After these change, it can boot the guest now.
kvm-all.c +0
-0
kvm-all.c static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot) · line 213
Quoted 9 lines
kvm-all.c +2
-1@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Thanks, can you submit it for uq/master? Please Cc [email protected] too, and use [PATCH uq/master] as the prefix.
Paolo
PATCH 1/1 fix double free the memslot in kvm_set_phys_mem
Luiz Capitulino reported that guest refused to boot and qemu complained with:kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
It is caused by commit 235e8982ad that did double free for the memslot so that the second one raises the -EINVAL error
Fix it by reset memory size only if it is needed
--- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
kvm-all.c +2 -1
@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Signature · 1 line
1.7.7.6
Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
Il 31/05/2013 10:52, Xiao Guangrong ha scritto:
Quoted 21 lines
Luiz Capitulino reported that guest refused to boot and qemu complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argumentIt is caused by commit
235e8982adthat did double free for the memslot so that the second one raises the-EINVALerrorFix it by reset memory size only if it is needed
Reported-by Luiz Capitulino <[email protected]>Signed-off-by Xiao Guangrong <[email protected]>--- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)kvm-all.c +0
-0
kvm-all.c static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot) · line 213
Quoted 9 lines
kvm-all.c +2
-1@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
In reply to Xiao GuangrongQuoted 11 lines · On Fri, 31 May 2013 16:52:18 +0800 Xiao Guangrong…
Luiz Capitulino reported that guest refused to boot and qemu complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argumentIt is caused by commit
235e8982adthat did double free for the memslot so that the second one raises the-EINVALerrorFix it by reset memory size only if it is needed
Reported-by Luiz Capitulino <[email protected]>Signed-off-by Xiao Guangrong <[email protected]>
Thanks Xiao for the fix, and thanks everyone for debugging this issue!
Quoted 18 lines
--- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)kvm-all.c +2
-1@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Re: [Qemu-devel] [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
In reply to Xiao GuangrongQuoted 20 lines · Xiao Guangrong
Luiz Capitulino reported that guest refused to boot and qemu complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argumentIt is caused by commit
235e8982adthat did double free for the memslot so that the second one raises the-EINVALerrorFix it by reset memory size only if it is needed
Reported-by Luiz Capitulino <[email protected]>Signed-off-by Xiao Guangrong <[email protected]>--- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)kvm-all.c +0
-0
kvm-all.c static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot) · line 213
Quoted 9 lines
kvm-all.c +2
-1@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;
Tested and fixes it for me too.
Rich.
Signature · 3 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Re: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
In reply to Xiao GuangrongQuoted 32 lines · Xiao Guangrong
Luiz Capitulino reported that guest refused to boot and qemu complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argumentIt is caused by commit
235e8982adthat did double free for the memslot so that the second one raises the-EINVALerrorFix it by reset memory size only if it is needed
Reported-by Luiz Capitulino <[email protected]>Signed-off-by Xiao Guangrong <[email protected]>--- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)kvm-all.c +2
-2@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ; --1.7.7.6
Gleb Natapov
AppliedRe: [PATCH uq/master] fix double free the memslot in kvm_set_phys_mem
In reply to Xiao GuangrongQuoted 11 lines · Xiao Guangrong
Luiz Capitulino reported that guest refused to boot and qemu complained with:
kvm_set_phys_mem: error unregistering overlapping slot: Invalid argumentIt is caused by commit
235e8982adthat did double free for the memslot so that the second one raises the-EINVALerrorFix it by reset memory size only if it is needed
Reported-by Luiz Capitulino <[email protected]>Signed-off-by Xiao Guangrong <[email protected]>
Thanks, applied.
Quoted 20 lines
--- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)kvm-all.c +2
-1@@ -206,7 +206,8 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)if (s->migration_log) { mem.flags |=KVM_MEM_LOG_DIRTY_PAGES ; } -if (mem.flags &KVM_MEM_READONLY ) { + +if (slot->memory_size && mem.flags &KVM_MEM_READONLY ) {/* Set the slot size to 0 before setting the slot to the desired * value. This is needed based on KVM commit 75d61fbc. */ mem.memory_size =0 ;Signature · 1 line
1.7.7.6
--
Gleb.