From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLWHd-00005b-4L for qemu-devel@nongnu.org; Mon, 16 Sep 2013 06:44:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLWHV-00059O-DT for qemu-devel@nongnu.org; Mon, 16 Sep 2013 06:43:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLWHV-00059A-5x for qemu-devel@nongnu.org; Mon, 16 Sep 2013 06:43:49 -0400 Date: Mon, 16 Sep 2013 18:43:37 +0800 From: Fam Zheng Message-ID: <20130916104337.GA19157@T430s.nay.redhat.com> References: <1379314227-8855-1-git-send-email-famz@redhat.com> <1379314227-8855-6-git-send-email-famz@redhat.com> <20130916085902.GA6005@redhat.com> <5236D318.4080206@redhat.com> <20130916095121.GD22783@T430s.nay.redhat.com> <3AD10BC4-9EDC-4FDA-BC0D-D1380C5904C2@alex.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3AD10BC4-9EDC-4FDA-BC0D-D1380C5904C2@alex.org.uk> 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: Alex Bligh Cc: peter.maydell@linaro.org, mjt@tls.msk.ru, qemu-devel@nongnu.org, Paolo Bonzini , vilanova@ac.upc.edu, rth@twiddle.net On Mon, 09/16 11:24, Alex Bligh wrote: > > On 16 Sep 2013, at 10:51, Fam Zheng wrote: > > > On Mon, 09/16 11:44, Paolo Bonzini wrote: > >> Il 16/09/2013 10:59, Daniel P. Berrange ha scritto: > >>>> The init function of dynamic module is no longer with > >>>> __attribute__((constructor)) as static linked version, and need to be > >>>> explicitly called once loaded. The function name is mangled with per > >>>> configure fingerprint as: > >>>> > >>>> init_$(date +%s$$$RANDOM) > >> > >> Does this work for a module that calls module_init multiple times? > >> > > Why should a module calls module_init, instead of the main function? > > > > This name is generated per "./configure", not per object or per make, so it's > > essentially the same with any fixed function name, except for two objects built > > from two different "./configure" (which is the purpose for the mangling here). > > I think I must be missing something here. > > We do not have a stable API/ABI and it seems generally acknowledged at this > stage that we don't need one. Therefore, to avoid API/ABI mismatch between > the executables and the modules, in ./configure you are generating a random > cookie (effectively) that you are calling the fingerprint. > > The executable will then not load the module unless the module has the > right cookie. As far as I can tell, that means the module needs to be > built within the same build harness as the executables, or it won't > know what to call its init function. > > And that's perfectly compatible with the stated objective: > > The main idea behind modules is to isolate dependencies on third party > > libraries from qemu executables, such as libglusterfs or librbd, so that the > > end users can install core qemu package with fewer dependencies. And only for > > those who want to use particular modules, need they install qemu-foo > > sub-package, which in turn requires libbar and libbiz packages. > > ... this being to isolate dependencies, and not to enable third party > modules built outside the tree. > > That's all well and good, but if the modules are all built within the > same build harness, why do we need a whitelist or a readdir() at all? We > know what the modules are, because they were the ones that were built > at the same time. Why not just process the list of modules it was > built with, and if you get EEXIST, move on? > Sounds good to me, I agree that "whitelist" is not necessary for user. We still need a known_modules in the new module_load() code and it'll look very similar to current whitelist. But I'll change the name. Fam