From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFtqP-0008PZ-8V for qemu-devel@nongnu.org; Wed, 22 Jun 2016 21:54:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFtqN-0000y6-7k for qemu-devel@nongnu.org; Wed, 22 Jun 2016 21:54:12 -0400 Date: Thu, 23 Jun 2016 09:53:58 +0800 From: Fam Zheng Message-ID: <20160623015358.GF17307@ad.usersys.redhat.com> References: <1466631354-17309-1-git-send-email-clord@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466631354-17309-1-git-send-email-clord@redhat.com> Subject: Re: [Qemu-devel] [PATCH 0/3] Dynamic module loading for block drivers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Colin Lord Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com On Wed, 06/22 17:35, Colin Lord wrote: > This is v2 of the series I sent out last week. These are the changes I > made based on the feedback I got: > - Fixed typo and Marc's email address in the python script > - Moved registration of iscsi_opts into vl.c > > What I didn't do: > - Remove copy-pasted loops > > There was a bit of discussion about how to remove the need for the copy- > paste loops that are in block.c. I attempted to solve it by using > g_module_sym to load the BlockDriver struct directly at the time the > module gets loaded and returning it so that the loops were not > necessary. I accomplished this by adding a field to the struct which, > for a given format/protocol configuration, had the name of the > corresponding BlockDriver struct. Having the name allowed me to load the > symbol right out of the loaded module. However, it turns out that, at > least as far as I can tell, g_module_sym can't load the BlockDriver > structs in this way because they are declared static. > > I tested the attempt to remove the copy-pasted loops by using the > qemu-iotests on it with ssh (which is modularized). The errors I got > were along the lines of: > > can't open device ssh://[address removed]: Unknown protocol 'ssh' > Failed to find driver in module > > To test my theory (I haven't had much luck finding reliable > documentation about this) that it was because they were static, I > changed the definition of the bdrv_ssh BlockDriver to not be static. > Unfortunately I still got errors, but I believe the drivers got loaded. > The errors were not the same, rather these ones were complaining about > the host key not matching the one in known_hosts. I've had this issue > while trying to set up ssh with qemu in the past, so I'm not quite as > worried about it (although I'd love to hear a fix), and more importantly > there aren't any messages about the driver not being found. Maybe it's not a big deal to export the symbols. For testing you can also test with iscsi. Fam > > That hopefully explains some of the issues, and why I'm submitting this > with the duplicated loops still intact. If there are other ideas for > dealing with this my ears are open, but this is what I have for now. > > Colin Lord (1): > blockdev: prepare iSCSI block driver for dynamic loading > > Marc Mari (2): > blockdev: Add dynamic generation of module_block.h > blockdev: Add dynamic module loading for block drivers > > .gitignore | 1 + > Makefile | 11 +++- > block.c | 86 +++++++++++++++++++++++--- > block/iscsi.c | 36 ----------- > include/qemu/module.h | 3 + > scripts/modules/module_block.py | 134 ++++++++++++++++++++++++++++++++++++++++ > util/module.c | 37 +++-------- > vl.c | 36 +++++++++++ > 8 files changed, 269 insertions(+), 75 deletions(-) > create mode 100644 scripts/modules/module_block.py > > -- > 2.5.5 > >