From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37661 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PeqWJ-00038V-D1 for qemu-devel@nongnu.org; Mon, 17 Jan 2011 09:57:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PeqWI-0004zd-3b for qemu-devel@nongnu.org; Mon, 17 Jan 2011 09:57:23 -0500 Received: from mail-vw0-f45.google.com ([209.85.212.45]:34564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PeqWI-0004zK-12 for qemu-devel@nongnu.org; Mon, 17 Jan 2011 09:57:22 -0500 Received: by vws12 with SMTP id 12so1945559vws.4 for ; Mon, 17 Jan 2011 06:57:20 -0800 (PST) Message-ID: <4D3458CC.1070004@codemonkey.ws> Date: Mon, 17 Jan 2011 08:57:16 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <4D2F4FC2.1060408@codemonkey.ws> <20110117101806.GA14607@amit-x200.redhat.com> In-Reply-To: <20110117101806.GA14607@amit-x200.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2 0/5] iohandlers: Add support for enabling/disabling individual handlers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: Paul Brook , qemu list , Gerd Hoffmann On 01/17/2011 04:18 AM, Amit Shah wrote: > On (Thu) Jan 13 2011 [13:17:22], Anthony Liguori wrote: > >> On 01/13/2011 09:00 AM, Amit Shah wrote: >> >>> Hi, >>> >>> This patchset adds new interfaces to work with iohandlers. It adds: >>> >>> int assign_fd_handlers(int fd, IOHandlerOps *ops, void *opaque) >>> -- Specify io handlers for an fd >>> int remove_fd_handlers(int fd) >>> -- Remove fd handlers for fd (mark ioh for deletion) >>> int set_read_poll_fd_action(int fd, bool enable) >>> -- Enable or disable the fd_read_poll fd handler >>> int set_read_fd_action(int fd, bool enable) >>> -- Enable or disable the fd_read fd handler >>> int set_write_fd_action(int fd, bool enable) >>> -- Enable or disable the fd_read fd handler >>> >>> A new struct, IOHandlerOps, is added, to collect all the ops together >>> instead of passing individual ones to functions. >>> >> Instead of inventing new interfaces, I think we should steal^Wlearn >> from established interfaces. >> > Agreed. > > I do also think it'll be worthwhile pulling in one of the libraries to > reduce the amount of qemu-specific code we have in the other cases as > well. > > >> Both libevent and glib have interfaces >> that essentially boil down to: >> >> handle add_fd_event(loop, fd, ConditionMask, callback, opaque) >> remove_event(loop, handle) >> > This is quite similar to the Linux polling API. > > I don't know what the 'loop' parameter would do, though. > It's to allow for multiple I/O threads. There's one loop context per thread and you can register events specifically to a thread. >> I think that's what we should move to. All the stuff in our current >> loop around allowing suppressing of read events is terrible as it >> forces the main loop to poll. That makes it impossible to use other >> main loops because it's completely unusual. >> > While setting new APIs possibly requires more discussion if we want to > do it once and right, since it's also an internal API, we can keep > evolving them. > Yeah, but we should avoid unnecessary churn. If we're going to do a major refactoring of an internal API, we should try to make the refactoring make sense as much as possible. Eliminating the polling callbacks has been on the TODO for years now. I don't think it make sense to refactor the API without at least doing this. > So what's the accepted course of action now - take this new API, rework > it to look like that of some other library's and then rework the > main_loop, keep developing something in parallel till it satisfies > everyone, etc.? > > Also -- this patchset was prompted by a bug in qemu chardevs that > freezes guests if they write faster than the chardevs can consume. > What should the strategy on fixing that bug be? > Fix the loop API such that we're not just fixing one bug but that we can address a bunch of other bugs that are out there. Regards, Anthony Liguori > Amit >