From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XON2j-0002wT-HG for qemu-devel@nongnu.org; Mon, 01 Sep 2014 04:32:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XON2e-0001gr-43 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 04:32:53 -0400 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:64745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XON2e-0001gn-02 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 04:32:48 -0400 Received: by mail-qg0-f45.google.com with SMTP id e89so4892421qgf.32 for ; Mon, 01 Sep 2014 01:32:47 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54042F29.6030102@redhat.com> Date: Mon, 01 Sep 2014 10:32:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140829172218.GD16755@irqsave.net> <20140830144641.GM14001@redhat.com> <20140830155343.GA2212@irqsave.net> <20140830160212.GH1302@redhat.com> <54037F82.9050209@redhat.com> <20140831203828.GA23970@irqsave.net> In-Reply-To: <20140831203828.GA23970@irqsave.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] tcmu-runner and QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?windows-1252?Q?Beno=EEt_Canet?= , Andy Grover Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, "Richard W.M. Jones" Il 31/08/2014 22:38, Benoît Canet ha scritto: > The problem with QEMU block drivers is that they are using either coroutines > or QEMU custom AIO callbacks so reusing them without the block layer is > not doable. Not really true. The QEMU block layer can be wrapped relatively easily in a GSource. This is how QEMU uses it, in fact. As to global state, each .so is only loaded once in an executable, so if TCMU loaded two QEMU plugins the .so would point to the block devices from each plugin. The problem is more the QMP interface, I think. > For the QEMU block layer as a whole it maintains some linked lists of block devices > states or similar stuff as static global variables. > (See https://github.com/qemu/qemu/blob/master/block.c#L96) > > So having more than one instance of the block layer running is not doable. > > I am not aware of anyone successfull in turning it into a proper .so. There was libqemublock. I think it stopped just because the author turned to something else, not because there were particular problems with the design. Paolo > Extracting into a binary acting as an nbd target was done with qemu-nbd though.