All of lore.kernel.org
 help / color / mirror / Atom feed
From: ramsdell@mitre.org (John D. Ramsdell)
To: Steven Smith <sos22@cam.ac.uk>
Cc: ramsdell@mitre.org, xen-devel@lists.xensource.com,
	Grzegorz Milos <gm281@cam.ac.uk>,
	sos22@srcf.ucam.org
Subject: Re: [PATCH] Mini-OS to use evtchn_port_t for ports and other improvements
Date: 25 Jul 2006 20:14:32 -0400	[thread overview]
Message-ID: <ogtejw99q8n.fsf@divan.mitre.org> (raw)
In-Reply-To: <20060725102715.GA4351@cam.ac.uk>

Steven Smith <sos22@cam.ac.uk> writes:

> This mostly looks like a pretty reasonable bit of cleanup, with just
> a few minor niggles.

Steven,

Thank you for your considered opinions.  For most of your comments, I
plan to implement your suggestions precisely.  I'd like to discuss
just two of them.

> Why maybe_bind?  Do you ever expect to need to allocate an unbound
> event channel before you know what handler to use for it?

I wanted to capture the usual pattern of immediately binding a port
after it's allocated, without forcing programmers to follow that
pattern.  In the case of evtchn_bind_interdomain, you wondered why I
added the call to clear_event.  Should it be decided it should be
eliminated, the use of maybe_bind allows a programmer to still use the
function, but delay the binding until after the programmer calls
clear_event.

> > +    evtchn_port_t port = op.u.bind_interdomain.local_port;
> > +    clear_evtchn(port);	      /* Without, handler gets invoked now! */
> Invoking the handler as soon as you bind the interdomain channel is
> a mostly-deliberate part of the interface.  If the other end makes
> notifications before you get around to binding they can get lost,
> and forcing the channel to fire as soon as you bind to it avoids
> some potential lost wakeups.

If the handler is invoke whenever the port is bound, there is no
information to be gained as a result of the first invocation of the
handler--as the programmer already knows when it will happen.  If it
is important to invoke the handler upon binding, why can't the
programmer simply follow the call the to evtchn_bind_interdomain with
a call to the evt_handler of type evt_handler_t with:

    (*evt_handler)(port, NULL, data);

where both port and data are already known for the call to the
function evtchn_bind_interdomain?  It's easy to simulate the case of a
handler call on binding with clear_evtchn included, but a pain to
handle the case in which one wants the handler to be invoked only when
a notification arrives, when it is omitted.

John

  reply	other threads:[~2006-07-26  0:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-23 12:33 [PATCH] Mini-OS to use evtchn_port_t for ports and other improvements John D. Ramsdell
2006-07-25 10:27 ` Steven Smith
2006-07-26  0:14   ` John D. Ramsdell [this message]
2006-07-27  9:49     ` Steven Smith
2006-07-27 12:56       ` John D. Ramsdell
2006-07-26 10:00   ` John D. Ramsdell

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=ogtejw99q8n.fsf@divan.mitre.org \
    --to=ramsdell@mitre.org \
    --cc=gm281@cam.ac.uk \
    --cc=sos22@cam.ac.uk \
    --cc=sos22@srcf.ucam.org \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.