From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiAKH-0005bj-1Y for qemu-devel@nongnu.org; Thu, 30 May 2013 17:24:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiAKB-0000UE-U6 for qemu-devel@nongnu.org; Thu, 30 May 2013 17:24:00 -0400 Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]:58465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiAKB-0000U7-HI for qemu-devel@nongnu.org; Thu, 30 May 2013 17:23:55 -0400 Received: by mail-ea0-f174.google.com with SMTP id z7so842828eaf.19 for ; Thu, 30 May 2013 14:23:54 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51A7C35E.6040001@redhat.com> Date: Thu, 30 May 2013 23:23:42 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20130530114604.4b12cb22@redhat.com> <51A77838.4060707@redhat.com> <20130530120832.5abe1c65@redhat.com> <20130530130333.30ae2a21@redhat.com> <20130530135642.15040dde@redhat.com> <51A794E9.6090709@redhat.com> <20130530163243.42aef6fe@redhat.com> In-Reply-To: <20130530163243.42aef6fe@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [BUG]: kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: "Justen, Jordan L" , Jordan Justen , qemu-devel , Xiao Guangrong Il 30/05/2013 22:32, Luiz Capitulino ha scritto: > On Thu, 30 May 2013 20:05:29 +0200 > Paolo Bonzini wrote: > >> Il 30/05/2013 19:56, Luiz Capitulino ha scritto: >>> On Thu, 30 May 2013 10:32:36 -0700 >>> Jordan Justen wrote: >>> >>>> On Thu, May 30, 2013 at 10:03 AM, Luiz Capitulino >>>> wrote: >>>>> On Thu, 30 May 2013 09:50:10 -0700 >>>>> Jordan Justen wrote: >>>>>> On Thu, May 30, 2013 at 9:08 AM, Luiz Capitulino wrote: >>>>>>> On Thu, 30 May 2013 18:03:04 +0200 >>>>>>> Paolo Bonzini wrote: >>>>>>> >>>>>>>> Il 30/05/2013 17:46, Luiz Capitulino ha scritto: >>>>>>>>> The culprit is commit: >>>>>>>>> >>>>>>>>> commit 235e8982ad393e5611cb892df54881c872eea9e1 >>>>>>>>> Author: Jordan Justen >>>>>>>>> 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(). >>>>>> >>>>>> 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? >>>>>> >>>>>>>> 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? >>>>> >>>>> 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. >>> >>> I could try to hack something, but maybe not today. >> >> Just put a breakpoint on pflash_cfi01_register and 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 >> I cannot reproduce it, but I'm also on 3.8.x. Will look at it tomorrow. >> >> Paolo >> >>>> 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 , section=0x7f01ee6975d0) at /home/lcapitulino/work/src/upstream/qmp-unstable/kvm-all.c:795 >>> #4 0x00007f01fedbc92d in address_space_update_topology_pass (as=0x7f01ffadfa60 , 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 ) 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 , 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) >>> >> > > >