qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Paul Brook <paul@codesourcery.com>,
	qemu list <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Re: [PATCH v2 0/5] iohandlers: Add support for enabling/disabling individual handlers
Date: Mon, 17 Jan 2011 12:30:26 -0600	[thread overview]
Message-ID: <4D348AC2.1050902@linux.vnet.ibm.com> (raw)
In-Reply-To: <4D3458CC.1070004@codemonkey.ws>

On 01/17/2011 08:57 AM, Anthony Liguori wrote:
> 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.
>

In case you're interested, to make the fd handler stuff accessible to 
qemu tools I have some code that moves these interfaces into backend 
functions in another file, qemu-ioh.c, where the IOHandlerRecord list is 
supplied by the caller to track state.

This would extend naturally to threads by just having them maintain 
their own IOHandlerRecord lists as well, and stuff that is meant to 
interact with vl.c:io_handlers can be done via wrapper functions for 
backward-compatibility.

If that seems like a reasonable approach maybe you could leverage these 
patches remove some of the scope for your proposed changes:

http://repo.or.cz/w/qemu/mdroth.git/patch/56a391e85124382ddcbdb64dcc05aadfc965f000

http://repo.or.cz/w/qemu/mdroth.git/patch/f4428e2cdf5da231bb30ce1ed9eb5ce567a9dc55

  reply	other threads:[~2011-01-17 18:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 15:00 [Qemu-devel] [PATCH v2 0/5] iohandlers: Add support for enabling/disabling individual handlers Amit Shah
2011-01-13 15:00 ` [Qemu-devel] [PATCH v2 1/5] iohandlers: Avoid code duplication Amit Shah
2011-01-13 15:00 ` [Qemu-devel] [PATCH v2 2/5] iohandlers: Introduce assign_fd_handlers() and remove_fd_handlers Amit Shah
2011-01-13 15:00 ` [Qemu-devel] [PATCH v2 3/5] iohandlers: Allow each iohandler to be enabled/disabled individually Amit Shah
2011-01-13 15:00 ` [Qemu-devel] [PATCH v2 4/5] iohandlers: Enable an iohandler only if the associated handler exists Amit Shah
2011-01-13 15:00 ` [Qemu-devel] [PATCH v2 5/5] iohandlers: Add IOHandlerOps struct Amit Shah
2011-01-13 15:09 ` [Qemu-devel] Re: [PATCH v2 0/5] iohandlers: Add support for enabling/disabling individual handlers Gerd Hoffmann
2011-01-13 19:17 ` Anthony Liguori
2011-01-17 10:18   ` Amit Shah
2011-01-17 14:57     ` Anthony Liguori
2011-01-17 18:30       ` Michael Roth [this message]
2011-01-18 11:56       ` Amit Shah
2011-01-18 14:19         ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D348AC2.1050902@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).