From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Wd2-0000EL-HH for qemu-devel@nongnu.org; Fri, 11 Jul 2014 04:56:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5Wcs-0006fv-Pc for qemu-devel@nongnu.org; Fri, 11 Jul 2014 04:56:28 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:45438) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Wcs-0006ew-GS for qemu-devel@nongnu.org; Fri, 11 Jul 2014 04:56:18 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Jul 2014 09:56:16 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 788C71B0805F for ; Fri, 11 Jul 2014 09:56:52 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6B8uDNP28967040 for ; Fri, 11 Jul 2014 08:56:13 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6B8uDjA003961 for ; Fri, 11 Jul 2014 02:56:13 -0600 Message-ID: <53BFA6AC.1090204@de.ibm.com> Date: Fri, 11 Jul 2014 10:56:12 +0200 From: Christian Borntraeger MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] block device fd consuption List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Cornelia Huck Cc: "qemu-devel@nongnu.org" , Dominik Dingel Stefan, I traced the creation of eventfds with gdb in the case of virtio-blk. With the following setup qemu-system-s390x -enable-kvm -m 1000 -nographic -kernel /boot/vmlinux-3.15.0+ -initrd ramdisk -smp 2 -append "root=/dev/ram0" -M s390-ccw -drive file=/dev/sdc,if=none,id=d0,format=raw,serial=d0,cache=none,aio=native -device virtio-blk-ccw,drive=d0,x-data-plane=on,config-wce=off,scsi=off In addition to the file descriptor for the device itself I have the following eventfd: Breakpoint 1, event_notifier_init (e=e@entry=0x807e8f24, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #0 event_notifier_init (e=e@entry=0x807e8f24, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #1 0x000000008019e766 in aio_context_new () at /home/cborntra/REPOS/qemu/async.c:274 #2 0x00000000801ae628 in qemu_init_main_loop () at /home/cborntra/REPOS/qemu/main-loop.c:142 #3 0x000000008001598c in main (argc=, argv=0x3fffffff2c8, envp=) at /home/cborntra/REPOS/qemu/vl.c:3972 --> main loop: this is ok and not related to virtio-blk. Breakpoint 1, event_notifier_init (e=e@entry=0x807fed48, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #0 event_notifier_init (e=e@entry=0x807fed48, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #1 0x00000000801ebb58 in laio_init () at /home/cborntra/REPOS/qemu/block/linux-aio.c:289 #2 0x00000000801ea17a in raw_set_aio (aio_ctx=0x807fa0a8, use_aio=0x807fa0a0, bdrv_flags=) at /home/cborntra/REPOS/qemu/block/raw-posix.c:351 #3 0x00000000801ea2a2 in raw_open_common (bs=bs@entry=0x807fd1a0, options=options@entry=0x807fdce0, bdrv_flags=bdrv_flags@entry=24802, open_flags=open_flags@entry=0, errp=errp@entry=0x3ffffffd698) at /home/cborntra/REPOS/qemu/block/raw-posix.c:433 #4 0x00000000801ea6b4 in hdev_open (bs=0x807fd1a0, options=0x807fdce0, flags=, errp=0x3ffffffe830) at /home/cborntra/REPOS/qemu/block/raw-posix.c:1760 #5 0x00000000801aba9e in bdrv_open_common (errp=0x3ffffffe818, drv=0x80316088 , flags=57570, options=0x807fdce0, file=0x0, bs=0x807fd1a0) at /home/cborntra/REPOS/qemu/block.c:967 #6 bdrv_open (pbs=pbs@entry=0x3ffffffe9e0, filename=, filename@entry=0x807fa300 "/dev/disk/by-id/scsi-36005076305ffc1ae", '0' , "2580", reference=reference@entry=0x0, options=0x807fdce0, flags=57570, drv=0x80316088 , errp=0x3ffffffe9e8) at /home/cborntra/REPOS/qemu/block.c:1472 #7 0x00000000801ac460 in bdrv_open_image (pbs=pbs@entry=0x3ffffffe9e0, filename=filename@entry=0x807fa300 "/dev/disk/by-id/scsi-36005076305ffc1ae", '0' , "2580", options=options@entry=0x807fb160, bdref_key=bdref_key@entry=0x8027a526 "file", flags=flags@entry=57570, allow_none=true, errp=0x3ffffffe9e8) at /home/cborntra/REPOS/qemu/block.c:1274 #8 0x00000000801ab74a in bdrv_open (pbs=pbs@entry=0x807fa5b0, filename=filename@entry=0x807fa300 "/dev/disk/by-id/scsi-36005076305ffc1ae", '0' , "2580", reference=reference@entry= 0x0, options=0x807fb160, options@entry=0x807f8ce0, flags=8418, flags@entry=226, drv=0x80312908 , errp=0x3ffffffead8) at /home/cborntra/REPOS/qemu/block.c:1451 #9 0x00000000800ba11e in blockdev_init (file=file@entry=0x807fa300 "/dev/disk/by-id/scsi-36005076305ffc1ae", '0' , "2580", bs_opts=bs_opts@entry=0x807f8ce0, errp=errp@entry= 0x3ffffffec58) at /home/cborntra/REPOS/qemu/blockdev.c:523 #10 0x00000000800bb530 in drive_new (all_opts=0x807e7cf0, block_default_type=) at /home/cborntra/REPOS/qemu/blockdev.c:930 #11 0x00000000800d11d4 in drive_init_func (opts=, opaque=) at /home/cborntra/REPOS/qemu/vl.c:1144 #12 0x00000000802110b0 in qemu_opts_foreach (list=, func=func@entry=0x800d11a8 , opaque=opaque@entry=0x807de6c0, abort_on_failure=abort_on_failure@entry=1) at /home/cborntra/REPOS/qemu/util/qemu-option.c:1072 #13 0x0000000080016438 in main (argc=, argv=, envp=) at /home/cborntra/REPOS/qemu/vl.c:4352 --> No idea Breakpoint 1, event_notifier_init (e=e@entry=0x807f4eb0, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #0 event_notifier_init (e=e@entry=0x807f4eb0, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #1 0x000000008019f04c in thread_pool_init_one (ctx=0x807e8e00, pool=0x807f4eb0) at /home/cborntra/REPOS/qemu/thread-pool.c:296 #2 thread_pool_new (ctx=) at /home/cborntra/REPOS/qemu/thread-pool.c:314 #3 0x000000008019e590 in aio_get_thread_pool (ctx=0x807e8e00) at /home/cborntra/REPOS/qemu/async.c:245 #4 0x00000000801e8f6c in paio_submit (bs=bs@entry=0x807fd1a0, fd=, sector_num=sector_num@entry=0, qiov=qiov@entry=0x3ffffffda98, nb_sectors=nb_sectors@entry=1, cb= 0x801a1a4c , opaque=0x3ffba3fe8d0, type=4097) at /home/cborntra/REPOS/qemu/block/raw-posix.c:1027 #5 0x00000000801e9b5c in raw_aio_submit (bs=0x807fd1a0, sector_num=0, qiov=0x3ffffffda98, nb_sectors=, cb=cb@entry=0x801a1a4c , opaque=0x3ffba3fe8d0, type=4097) at /home/cborntra/REPOS/qemu/block/raw-posix.c:1056 #6 0x00000000801e9c84 in raw_aio_readv (bs=, sector_num=, qiov=, nb_sectors=, cb=0x801a1a4c , opaque=0x3ffba3fe8d0) at /home/cborntra/REPOS/qemu/block/raw-posix.c:1094 #7 0x00000000801a2594 in bdrv_co_io_em (is_write=false, iov=0x3ffffffda98, nb_sectors=, sector_num=0, bs=0x807fd1a0) at /home/cborntra/REPOS/qemu/block.c:4835 #8 bdrv_co_readv_em (bs=bs@entry=0x807fd1a0, sector_num=sector_num@entry=0, nb_sectors=, iov=iov@entry=0x3ffffffda98) at /home/cborntra/REPOS/qemu/block.c:4852 #9 0x00000000801a7d7c in bdrv_aligned_preadv (bs=bs@entry=0x807fd1a0, req=req@entry=0x3ffba3feac8, offset=, bytes=bytes@entry=512, align=, qiov=0x3ffffffda98, flags=0) at /home/cborntra/REPOS/qemu/block.c:3057 #10 0x00000000801a82da in bdrv_co_do_preadv (bs=0x807fd1a0, offset=, bytes=512, qiov=0x3ffffffda98, flags=, flags@entry=(unknown: 0)) at /home/cborntra/REPOS/qemu/block.c:3136 #11 0x00000000801a83e4 in bdrv_co_do_readv (flags=(unknown: 0), qiov=, nb_sectors=, sector_num=, bs=) at /home/cborntra/REPOS/qemu/block.c:3158 #12 bdrv_co_readv (bs=, sector_num=, nb_sectors=, qiov=) at /home/cborntra/REPOS/qemu/block.c:3167 #13 0x00000000801a7ce2 in bdrv_aligned_preadv (bs=bs@entry=0x807fa620, req=req@entry=0x3ffba3fedb0, offset=, bytes=bytes@entry=512, align=512, qiov=0x3ffffffda98, flags=0) at /home/cborntra/REPOS/qemu/block.c:3042 #14 0x00000000801a82da in bdrv_co_do_preadv (bs=0x807fa620, offset=, bytes=512, qiov=0x3ffffffda98, flags=) at /home/cborntra/REPOS/qemu/block.c:3136 #15 0x00000000801a94d8 in bdrv_rw_co_entry (opaque=0x3ffffffd9b8) at /home/cborntra/REPOS/qemu/block.c:2693 #16 bdrv_rw_co_entry (opaque=0x3ffffffd9b8) at /home/cborntra/REPOS/qemu/block.c:2688 #17 0x00000000801ba140 in coroutine_trampoline (i0=, i1=) at /home/cborntra/REPOS/qemu/coroutine-ucontext.c:118 #18 0x000003fffc935892 in __makecontext_ret () from /lib64/libc.so.6 --> No idea Breakpoint 1, event_notifier_init (e=e@entry=0x808b8054, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #0 event_notifier_init (e=e@entry=0x808b8054, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #1 0x000000008019e766 in aio_context_new () at /home/cborntra/REPOS/qemu/async.c:274 #2 0x00000000800be410 in iothread_complete (obj=, errp=) at /home/cborntra/REPOS/qemu/iothread.c:69 #3 0x000000008006d3bc in virtio_blk_data_plane_create (vdev=vdev@entry=0x807f29e0, blk=blk@entry=0x807f2ad0, dataplane=dataplane@entry=0x807f2b48, errp=errp@entry=0x3ffffffe0e8) at /home/cborntra/REPOS/qemu/hw/block/dataplane/virtio-blk.c:172 #4 0x000000008006ba22 in virtio_blk_device_realize (dev=0x807f29e0, errp=0x3ffffffe198) at /home/cborntra/REPOS/qemu/hw/block/virtio-blk.c:751 #5 0x0000000080077ee2 in virtio_device_realize (dev=0x807f29e0, errp=0x3ffffffe250) at /home/cborntra/REPOS/qemu/hw/virtio/virtio.c:1294 #6 0x0000000080131760 in device_set_realized (obj=0x807f29e0, value=, errp=0x3ffffffe5b0) at /home/cborntra/REPOS/qemu/hw/core/qdev.c:834 #7 0x0000000080162dca in property_set_bool (obj=obj@entry=0x807f29e0, v=v@entry=0x808a3a90, opaque=0x807f31f0, name=name@entry=0x8025bdd2 "realized", errp=errp@entry=0x3ffffffe5b0) at /home/cborntra/REPOS/qemu/qom/object.c:1473 #8 0x0000000080164bd6 in object_property_set (obj=obj@entry=0x807f29e0, v=0x808a3a90, name=name@entry=0x8025bdd2 "realized", errp=errp@entry=0x3ffffffe5b0) at /home/cborntra/REPOS/qemu/qom/object.c:824 #9 0x0000000080166a3a in object_property_set_qobject (obj=0x807f29e0, value=, name=0x8025bdd2 "realized", errp=0x3ffffffe5b0) at /home/cborntra/REPOS/qemu/qom/qom-qobject.c:24 #10 0x0000000080164efc in object_property_set_bool (obj=obj@entry=0x807f29e0, value=value@entry=true, name=name@entry=0x8025bdd2 "realized", errp=errp@entry=0x3ffffffe5b0) at /home/cborntra/REPOS/qemu/qom/object.c:888 #11 0x0000000080130312 in qdev_init (dev=dev@entry=0x807f29e0) at /home/cborntra/REPOS/qemu/hw/core/qdev.c:168 #12 0x00000000800893bc in virtio_ccw_blk_init (ccw_dev=0x807f2780) at /home/cborntra/REPOS/qemu/hw/s390x/virtio-ccw.c:804 #13 0x000000008008a6d4 in virtio_ccw_busdev_init (dev=0x807f2780) at /home/cborntra/REPOS/qemu/hw/s390x/virtio-ccw.c:1582 #14 0x000000008012fb2a in device_realize (dev=0x807f2780, errp=0x3ffffffe870) at /home/cborntra/REPOS/qemu/hw/core/qdev.c:183 #15 0x0000000080131760 in device_set_realized (obj=0x807f2780, value=, errp=0x3ffffffebe8) at /home/cborntra/REPOS/qemu/hw/core/qdev.c:834 #16 0x0000000080162dca in property_set_bool (obj=obj@entry=0x807f2780, v=v@entry=0x8089d9c0, opaque=0x807f2bd0, name=name@entry=0x8025bdd2 "realized", errp=errp@entry=0x3ffffffebe8) at /home/cborntra/REPOS/qemu/qom/object.c:1473 #17 0x0000000080164bd6 in object_property_set (obj=obj@entry=0x807f2780, v=0x8089d9c0, name=name@entry=0x8025bdd2 "realized", errp=errp@entry=0x3ffffffebe8) at /home/cborntra/REPOS/qemu/qom/object.c:824 #18 0x0000000080166a3a in object_property_set_qobject (obj=0x807f2780, value=, name=0x8025bdd2 "realized", errp=0x3ffffffebe8) at /home/cborntra/REPOS/qemu/qom/qom-qobject.c:24 #19 0x0000000080164efc in object_property_set_bool (obj=obj@entry=0x807f2780, value=value@entry=true, name=name@entry=0x8025bdd2 "realized", errp=errp@entry=0x3ffffffebe8) at /home/cborntra/REPOS/qemu/qom/object.c:888 #20 0x00000000800bf622 in qdev_device_add (opts=0x807e8080) at /home/cborntra/REPOS/qemu/qdev-monitor.c:560 #21 0x00000000800d1616 in device_init_func (opts=, opaque=) at /home/cborntra/REPOS/qemu/vl.c:2357 #22 0x00000000802110b0 in qemu_opts_foreach (list=, func=func@entry=0x800d15f0 , opaque=opaque@entry=0x0, abort_on_failure=abort_on_failure@entry=1) at /home/cborntra/REPOS/qemu/util/qemu-option.c:1072 #23 0x000000008001673a in main (argc=, argv=, envp=) at /home/cborntra/REPOS/qemu/vl.c:4431 --> data plane create, eventfd for iothread. I guess we need one per iothread? System now boots, and then the first disk access (partition detection): Breakpoint 1, event_notifier_init (e=e@entry=0x808b6848, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #0 event_notifier_init (e=e@entry=0x808b6848, active=active@entry=0) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #1 0x000000008008839a in virtio_ccw_set_guest_notifier (dev=dev@entry=0x807f2780, n=n@entry=0, assign=assign@entry=true, with_irqfd=with_irqfd@entry=true) at /home/cborntra/REPOS/qemu/hw/s390x/virtio-ccw.c:1201 #2 0x000000008008a7bc in virtio_ccw_set_guest_notifiers (d=, nvqs=, assigned=) at /home/cborntra/REPOS/qemu/hw/s390x/virtio-ccw.c:1259 #3 0x000000008006d4fa in virtio_blk_data_plane_start (s=0x808b7e10) at /home/cborntra/REPOS/qemu/hw/block/dataplane/virtio-blk.c:222 #4 0x000000008006cf10 in virtio_blk_handle_output (vdev=, vq=) at /home/cborntra/REPOS/qemu/hw/block/virtio-blk.c:427 #5 0x0000000080086da0 in virtio_ccw_hcall_notify (args=) at /home/cborntra/REPOS/qemu/hw/s390x/s390-virtio-ccw.c:60 #6 0x0000000080082084 in s390_virtio_hypercall (env=env@entry=0x80885398) at /home/cborntra/REPOS/qemu/hw/s390x/s390-virtio-hcall.c:34 #7 0x00000000800b83a4 in handle_hypercall (run=, cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:911 #8 handle_diag (ipb=, run=, cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:963 #9 handle_instruction (run=, cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:1091 #10 handle_intercept (cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:1141 #11 kvm_arch_handle_exit (cs=cs@entry=0x8087d100, run=run@entry=0x3fffdfcf000) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:1259 #12 0x000000008005b4d6 in kvm_cpu_exec (cpu=cpu@entry=0x8087d100) at /home/cborntra/REPOS/qemu/kvm-all.c:1792 #13 0x000000008004733e in qemu_kvm_cpu_thread_fn (arg=0x8087d100) at /home/cborntra/REPOS/qemu/cpus.c:874 #14 0x000003fffdd6b412 in start_thread () from /lib64/libpthread.so.0 #15 0x000003fffc9f10ae in thread_start () from /lib64/libc.so.6 ---> irqfd, ok Breakpoint 1, event_notifier_init (e=e@entry=0x808b6850, active=active@entry=1) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #0 event_notifier_init (e=e@entry=0x808b6850, active=active@entry=1) at /home/cborntra/REPOS/qemu/util/event_notifier-posix.c:29 #1 0x000000008008785a in virtio_ccw_set_guest2host_notifier (dev=, n=, assign=, set_handler=) at /home/cborntra/REPOS/qemu/hw/s390x/virtio-ccw.c:141 #2 0x000000008006d526 in virtio_blk_data_plane_start (s=0x808b7e10) at /home/cborntra/REPOS/qemu/hw/block/dataplane/virtio-blk.c:230 #3 0x000000008006cf10 in virtio_blk_handle_output (vdev=, vq=) at /home/cborntra/REPOS/qemu/hw/block/virtio-blk.c:427 #4 0x0000000080086da0 in virtio_ccw_hcall_notify (args=) at /home/cborntra/REPOS/qemu/hw/s390x/s390-virtio-ccw.c:60 #5 0x0000000080082084 in s390_virtio_hypercall (env=env@entry=0x80885398) at /home/cborntra/REPOS/qemu/hw/s390x/s390-virtio-hcall.c:34 #6 0x00000000800b83a4 in handle_hypercall (run=, cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:911 #7 handle_diag (ipb=, run=, cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:963 #8 handle_instruction (run=, cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:1091 #9 handle_intercept (cpu=0x8087d100) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:1141 #10 kvm_arch_handle_exit (cs=cs@entry=0x8087d100, run=run@entry=0x3fffdfcf000) at /home/cborntra/REPOS/qemu/target-s390x/kvm.c:1259 #11 0x000000008005b4d6 in kvm_cpu_exec (cpu=cpu@entry=0x8087d100) at /home/cborntra/REPOS/qemu/kvm-all.c:1792 #12 0x000000008004733e in qemu_kvm_cpu_thread_fn (arg=0x8087d100) at /home/cborntra/REPOS/qemu/cpus.c:874 #13 0x000003fffdd6b412 in start_thread () from /lib64/libpthread.so.0 #14 0x000003fffc9f10ae in thread_start () from /lib64/libc.so.6 ---> ioeventfd, ok