From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ze1Xl-0007ns-U7 for qemu-devel@nongnu.org; Mon, 21 Sep 2015 09:54:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ze1Xh-0008Gb-SG for qemu-devel@nongnu.org; Mon, 21 Sep 2015 09:54:09 -0400 Received: from mx2.parallels.com ([199.115.105.18]:42866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ze1Xh-0008G2-N7 for qemu-devel@nongnu.org; Mon, 21 Sep 2015 09:54:05 -0400 References: <1441720402-1778-1-git-send-email-markmb@redhat.com> From: "Denis V. Lunev" Message-ID: <5600097F.5040208@parallels.com> Date: Mon, 21 Sep 2015 16:43:27 +0300 MIME-Version: 1.0 In-Reply-To: <1441720402-1778-1-git-send-email-markmb@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 0/2] Dynamic module support for block drivers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc_Mar=c3=ad?= , qemu-devel@nongnu.org Cc: Peter Maydell , Michael Tokarev , Fam Zheng , Stefan Hajnoczi On 09/08/2015 04:53 PM, Marc MarĂ­ wrote: > The current module infrastructure has been improved to enable dynamic module > loading. > > This reduces the load time for very simple guests. For the following > configuration (very loaded) > > ./configure --enable-sdl --enable-gtk --enable-vte --enable-curses \ > --enable-vnc --enable-vnc-{jpeg,tls,sasl,png} --enable-virtfs \ > --enable-brlapi --enable-curl --enable-fdt --enable-bluez \ > --enable-kvm --enable-rdma --enable-uuid --enable-vde \ > --enable-linux-aio --enable-cap-ng --enable-attr --enable-vhost-net \ > --enable-vhost-scsi --enable-spice --enable-rbd --enable-libiscsi \ > --enable-smartcard-nss --enable-guest-agent --enable-libusb \ > --enable-usb-redir --enable-lzo --enable-snappy --enable-bzip2 \ > --enable-seccomp --enable-coroutine-pool --enable-glusterfs \ > --enable-tpm --enable-libssh2 --enable-vhdx --enable-numa \ > --enable-tcmalloc --target-list=x86_64-softmmu > > With modules disabled, there are 142 libraries loaded at startup. Time is > the following: > LD time: 0.065 seconds > QEMU time: 0.02 seconds > Total time: 0.085 seconds > > With this patch series and modules enabled, there are 128 libraries loaded > at startup. Time is the following: > LD time: 0.02 seconds > QEMU time: 0.02 seconds > Total time: 0.04 seconds > > Where LD time is the time between the program startup and the jump to main, > and QEMU time is the time between the start of main and the first kvm_entry. > > These results are just with a few block drivers, that were already a module. > Adding more modules (block or not block) should be easy, and will reduce > the load time even more. > > Marc MarĂ­ (2): > Add dynamic module loading for block drivers > Add dynamic generation of module_block.h > > .gitignore | 1 + > Makefile | 10 ++- > block.c | 70 +++++++++++++++++++++ > configure | 2 +- > include/qemu/module.h | 3 + > scripts/modules/module_block.py | 134 ++++++++++++++++++++++++++++++++++++++++ > util/module.c | 38 ++++-------- > 7 files changed, 227 insertions(+), 31 deletions(-) > create mode 100755 scripts/modules/module_block.py > From my point of view the design looks a bit complex. The approach should be quite similar to one used in Linux kernel. If the block driver is configured as a module, block_init should register proper hooks and create generic lists. C code parsing does not look like a good approach to me. If block_init is a bad name, we could use something like module_init.