Received: from eggs.gnu.org ([2001:4830:134:3::10]:53375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLoG6-0002mH-J5 for qemu-devel@nongnu.org; Tue, 17 Sep 2013 01:55:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLoG0-0003Qo-Fz for qemu-devel@nongnu.org; Tue, 17 Sep 2013 01:55:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLoG0-0003Qe-7n for qemu-devel@nongnu.org; Tue, 17 Sep 2013 01:55:28 -0400 Date: Tue, 17 Sep 2013 13:55:15 +0800 From: Fam Zheng Message-ID: <20130917055515.GA15955@T430s.nay.redhat.com> References: <1379314227-8855-1-git-send-email-famz@redhat.com> <1379314227-8855-6-git-send-email-famz@redhat.com> <20130916110536.GL6005@redhat.com> <1379334978.28744.8.camel@nilsson.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1379334978.28744.8.camel@nilsson.home.kraxel.org> Subject: Re: [Qemu-devel] [PATCH v10 5/8] module: implement module loading Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: peter.maydell@linaro.org, mjt@tls.msk.ru, qemu-devel@nongnu.org, alex@alex.org.uk, pbonzini@redhat.com, vilanova@ac.upc.edu, rth@twiddle.net On Mon, 09/16 14:36, Gerd Hoffmann wrote: > On Mo, 2013-09-16 at 12:05 +0100, Daniel P. Berrange wrote: > > On Mon, Sep 16, 2013 at 02:50:24PM +0800, Fam Zheng wrote: > > > Added three types of modules: > > > > > > typedef enum { > > > MODULE_LOAD_BLOCK = 0, > > > MODULE_LOAD_UI, > > > MODULE_LOAD_NET, > > > MODULE_LOAD_MAX, > > > } module_load_type; > > > > > > and their loading function: > > > > > > void module_load(module_load_type). > > > > > > which loads whitelisted ".so" files of the given type under ${MODDIR}. > > > > > > Modules of each type should be loaded in respective subsystem > > > initialization code. > > > > Based on Paolo's note that the SPICE .so module could likely > > end up containing functionality that is spread across several > > different sub-systems, this approach of loading per-type > > seems even more flawed. > > spice would need different types indeed (and the list above looks > incomplete). > > > I think I'd just have one flat list > > of modules to load and ditch these MODULE_LOAD_XXXX enums. > > Question is how to deal with qemu vs. qemu-img then. qemu needs > everything and qemu-img needs the block drivers only (and loading > something else probably doesn't work due to unresolved symbols). > With lazy symbol binding (G_MODULE_BIND_LAZY), we can just load all the modules, and wait for subsystem to call module_call_init(MODULE_INIT_*), where the symbols are resolved. As qemu-img.c doesn't init ui, net, it's not a problem to load them ahead. Fam