All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Christopher Clark <christopher.w.clark@gmail.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Ross Philipson <ross.philipson@gmail.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jason Andryuk <jandryuk@gmail.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Rich Persaud <persaur@gmail.com>, Tim Deegan <tim@xen.org>,
	Daniel Smith <dpsmith@apertussolutions.com>,
	Julien Grall <julien.grall@arm.com>,
	Paul Durrant <paul.durrant@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	James McKenzie <james@bromium.com>,
	Eric Chanudet <eric.chanudet@gmail.com>
Subject: Re: [PATCH v4 10/14] argo: implement the notify op
Date: Fri, 18 Jan 2019 10:44:28 +0100	[thread overview]
Message-ID: <20190118094428.t3izdbe4izthldp7@mac> (raw)
In-Reply-To: <CACMJ4GasXo2BuGCwVA66kbdsh_SVtkZ86OsdKOTky5UYjnOBag@mail.gmail.com>

On Thu, Jan 17, 2019 at 01:44:32PM -0800, Christopher Clark wrote:
> On Thu, Jan 17, 2019 at 3:12 AM Roger Pau Monné <roger.pau@citrix.com> wrote:
> >
> > On Wed, Jan 16, 2019 at 10:54:48PM -0800, Christopher Clark wrote:
> > > On Tue, Jan 15, 2019 at 8:19 AM Roger Pau Monné <roger.pau@citrix.com> wrote:
> > > >
> > > > On Tue, Jan 15, 2019 at 01:27:42AM -0800, Christopher Clark wrote:
> > > > > diff --git a/xen/include/public/argo.h b/xen/include/public/argo.h
> > > > > index c12a50f..d2cb594 100644
> > > > > --- a/xen/include/public/argo.h
> > > > > +++ b/xen/include/public/argo.h
> > > > > @@ -123,6 +123,42 @@ typedef struct xen_argo_unregister_ring
> > > > >  /* Messages on the ring are padded to a multiple of this size. */
> > > > >  #define XEN_ARGO_MSG_SLOT_SIZE 0x10
> > > > >
> > > > > +/*
> > > > > + * Notify flags
> > > > > + */
> > > > > +/* Ring is empty */
> > > > > +#define XEN_ARGO_RING_DATA_F_EMPTY       (1U << 0)
> > > > > +/* Ring exists */
> > > > > +#define XEN_ARGO_RING_DATA_F_EXISTS      (1U << 1)
> > > > > +/* Pending interrupt exists. Do not rely on this field - for profiling only */
> > > > > +#define XEN_ARGO_RING_DATA_F_PENDING     (1U << 2)
> >
> > Regarding this flag, I've just noticed while looking at the code that
> > it doesn't seem to relate to interrupts?
> 
> It might not seem that way, but I think it does, because it indicates
> that the hypervisor has just queued up a signal (via VIRQ) for later:
> the logic in fill_ring_data has observed that there wasn't enough
> space available in the ring for the requested space_required supplied
> in the notify call, so it has added a new entry to the ring's
> pending_ent list, which will cause a signal to be triggered to the
> domain (ie. a VIRQ) later when enough space has been observed as being
> available.

Oh, I think I was getting confused by the wording of the comment, here
"pending interrupt" means that the caller should expect an interrupt at
some point in the future when there's enough free space on the ring?

To me "pending interrupt" means there's an interrupt set by the
hypervisor which has not yet been serviced by the caller.

> Now, the "len" value stored in that pending_ent can be changed later,
> depending on the size of messages that the domain attempts to send to
> the same ring in the meantime, which I think is why the comment notes
> not to depend upon that flag.
> 
> > From it's usage in fill_ring_data I would write the following
> > description:
> >
> > "Likely not enough space to queue a message of `space_required`
> > size."
> >
> > And then XEN_ARGO_RING_DATA_F_PENDING is completely orthogonal to
> > XEN_ARGO_RING_DATA_F_SUFFICIENT, at which point having only one of
> > those would be enough?
> 
> Given the above, where I do think that the PENDING flag is an
> indicator of queued interrupt, I think there's some merit to keeping
> them separate, rather than committing to the client that it is always
> one or the other. It actually looks like the call to pending_requeue
> is ignoring the potential for an error value (eg ENOSPC or ENOMEM)
> there, where the flag should not be set, and possibly the errno should
> be returned to the caller.

Yes, you should propagate the errors from pending_requeue to the
caller.

> > AFAICT you cannot get a xen_argo_ring_data_ent_t with both
> > XEN_ARGO_RING_DATA_F_PENDING and XEN_ARGO_RING_DATA_F_SUFFICIENT set
> > at the same time?
> 
> right, but there is a case where you can get one with neither bit set.

Yes, that's right. But you would then get the
XEN_ARGO_RING_DATA_F_EMSGSIZE flag set or the ring simply don't
exist.

> It looks a bit clearer for the caller to have the explicit separate
> bits because it can avoid having to check a third flag first to see
> how to interpret a combined one.

There are three possible situations, which are mutually exclusive:

1. Message is bigger than the max message size supported by the ring:
   set EMSGSIZE
2. Message fits based on the current available space on the ring:
   don't set any flags.
3. Message doesn't fit based on the current available space on the
   ring: set NOTIFY.

So that would leave the following set of flags:

/* Ring is empty. */
#define XEN_ARGO_RING_EMPTY       (1U << 0)
/* Ring exists. */
#define XEN_ARGO_RING_EXISTS      (1U << 1)
/*
 * Not enough ring space available for the requested size, caller set
 * to receive a notification via VIRQ_ARGO when enough free space
 * might be available.
 */
#define XEN_ARGO_RING_NOTIFY      (1U << 2)
/* Requested size exceeds maximum ring message size. */
#define XEN_ARGO_RING_EMSGSIZE    (1U << 3)
/* Ring is shared, not unicast. */
#define XEN_ARGO_RING_SHARED      (1U << 4)

Note that I've also removed the _DATA_F_, I think it's not specially
helpful, and shorter names are easier to read.

I think the above is clearer and should be able to convey the
same set of information using one flag less, which is always better
IMO. That being set I don't know the users of this interface anyway,
so if you think the original proposal is better I'm not going to
oppose.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-01-18  9:44 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15  9:27 [PATCH v4 00/14] Argo: hypervisor-mediated interdomain communication Christopher Clark
2019-01-15  9:27 ` [PATCH v4 01/14] argo: Introduce the Kconfig option to govern inclusion of Argo Christopher Clark
2019-01-15  9:27 ` [PATCH v4 02/14] argo: introduce the argo_op hypercall boilerplate Christopher Clark
2019-01-15  9:27 ` [PATCH v4 03/14] argo: define argo_dprintk for subsystem debugging Christopher Clark
2019-01-15  9:27 ` [PATCH v4 04/14] argo: init, destroy and soft-reset, with enable command line opt Christopher Clark
2019-01-15 12:29   ` Roger Pau Monné
2019-01-15 12:42     ` Jan Beulich
2019-01-15 14:16       ` Roger Pau Monné
2019-01-15 14:15     ` Ian Jackson
2019-01-16  1:07     ` Christopher Clark
2019-01-15  9:27 ` [PATCH v4 05/14] errno: add POSIX error codes EMSGSIZE, ECONNREFUSED to the ABI Christopher Clark
2019-01-15  9:27 ` [PATCH v4 06/14] xen/arm: introduce guest_handle_for_field() Christopher Clark
2019-01-15  9:27 ` [PATCH v4 07/14] argo: implement the register op Christopher Clark
2019-01-15 14:40   ` Roger Pau Monné
2019-01-15 22:37     ` Christopher Clark
2019-01-15  9:27 ` [PATCH v4 08/14] argo: implement the unregister op Christopher Clark
2019-01-15 15:03   ` Roger Pau Monné
2019-01-17  6:40     ` Christopher Clark
2019-01-15  9:27 ` [PATCH v4 09/14] argo: implement the sendv op; evtchn: expose send_guest_global_virq Christopher Clark
2019-01-15 15:49   ` Roger Pau Monné
2019-01-15 16:10     ` Jan Beulich
2019-01-15 16:19       ` Roger Pau Monné
2019-01-17  6:48     ` Christopher Clark
2019-01-17 10:53       ` Roger Pau Monné
2019-01-15  9:27 ` [PATCH v4 10/14] argo: implement the notify op Christopher Clark
2019-01-15 16:17   ` Roger Pau Monné
2019-01-17  6:54     ` Christopher Clark
2019-01-17 11:12       ` Roger Pau Monné
2019-01-17 12:04         ` Jan Beulich
2019-01-17 21:44         ` Christopher Clark
2019-01-18  9:44           ` Roger Pau Monné [this message]
2019-01-18 23:54             ` Christopher Clark
2019-01-18 23:59               ` Christopher Clark
2019-01-19 12:06               ` Roger Pau Monné
2019-01-21  1:59                 ` Christopher Clark
2019-01-21  8:21                   ` Roger Pau Monné
2019-01-15  9:27 ` [PATCH v4 11/14] xsm, argo: XSM control for argo register Christopher Clark
2019-01-15  9:27 ` [PATCH v4 12/14] xsm, argo: XSM control for argo message send operation Christopher Clark
2019-01-15  9:27 ` [PATCH v4 13/14] xsm, argo: XSM control for any access to argo by a domain Christopher Clark
2019-01-15  9:27 ` [PATCH v4 14/14] xsm, argo: notify: don't describe rings that cannot be sent to Christopher Clark
2019-01-15 16:34 ` [PATCH v4 00/14] Argo: hypervisor-mediated interdomain communication Roger Pau Monné
2019-01-15 22:39   ` Christopher Clark

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=20190118094428.t3izdbe4izthldp7@mac \
    --to=roger.pau@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=christopher.w.clark@gmail.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=eric.chanudet@gmail.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=james@bromium.com \
    --cc=jandryuk@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=paul.durrant@citrix.com \
    --cc=persaur@gmail.com \
    --cc=ross.philipson@gmail.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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.