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: Mon, 21 Jan 2019 09:21:19 +0100	[thread overview]
Message-ID: <20190121082119.sxstti6dt2gbs5f4@mac> (raw)
In-Reply-To: <CACMJ4Ga1SfsX5+Zbfqgi0CuHGyy6pu3NAtfpFXemybCALHiAJg@mail.gmail.com>

On Sun, Jan 20, 2019 at 05:59:36PM -0800, Christopher Clark wrote:
> On Sat, Jan 19, 2019 at 4:06 AM Roger Pau Monné <roger.pau@citrix.com> wrote:
> >
> > On Fri, Jan 18, 2019 at 03:54:14PM -0800, Christopher Clark wrote:
> > > On Fri, Jan 18, 2019 at 1:44 AM Roger Pau Monné <roger.pau@citrix.com> wrote:
> > > >
> > > > 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
> 
> > > > > > 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?
> > > >
> > > > 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.
> > >
> > > Unfortunately, given the new error checking (added for my "ack, done." above),
> > > now there is a fourth condition. Situation 3 is described more fully as:
> > >
> > > 3. Message doesn't fit based on the current available space on the
> > > ring, and a VIRQ is queued for when space is available: set NOTIFY.
> > >
> > > New Situation 4 is:
> > >
> > > 4. Message doesn't fit based on the current available space on the ring,
> > > but Xen can't queue up a VIRQ for later because memory allocation to
> > > add an entry for that failed. Don't set NOTIFY.
> > >
> > > We ought to enable the guest to distinguish Situation 2 from Situation 4
> > > -- which I think points to keeping the separate flags.
> >
> > But situation 4 is going to return an error code from the hypercall
> > (ENOSPC?), at which point you will be able to differentiate it?
> 
> Ack, ok. Since ENOSPC aborts the return of any further data about that ring,
> (or subsequent rings that were queried in the same op) yes, it's distinct.
> 
> > In fact I think XEN_ARGO_RING_EMSGSIZE could be removed also, and the
> > hypercall made return E2BIG?
> 
> This is the query interface for the sender to a ring to discover the
> receiver's ring size, and it's an interface for querying about multiple
> rings in the same operation; it may not know an individual ring size
> beforehand, or that a given payload size will exceed it.
> 
> Returning E2BIG would abort the loop (in notify, that calls fill_ring_data)
> and not actually return the state to the caller indicating the size of the
> maximum acceptable message size that it needs to avoid that error.
> Instead, we're using the bit in the per-ring response to indicate that
> (non-serious) condition and allowing the loop to continue and provide data
> about all the other rings in the request, including maximum message sizes.

Right, I've been thinking about this and since this is a status
request hypercall it might make sense to return some of what would be
errors (if this was a write to the ring) as flags, and leave the
return error code to be used only for errors that actually prevent the
hypervisor from successfully executing the status hypercall. I leave
up to you to decide what's worth putting in the flags field or
returning as an error code.

> > > > 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)
> > > >
> > > >
> > > > 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.
> 
> I've checked both the Linux (prototype Argo) and Windows (v4v) drivers and
> of the original flags, the SUFFICIENT flag is used, while the PENDING one is
> not, which fits with its description of being for profiling only; so given
> that, I'll keep the SUFFICIENT flag, but will drop the PENDING one, leaving
> it to be inferred from the other state returned, as requested.

Ack, as said above, I leave up to you to decide what flags to use. At
the end of day there are clients already for this interface, so I
assume the flags are functional for the needs of the clients.

Thanks, Roger.

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

  reply	other threads:[~2019-01-21  8:22 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é
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é [this message]
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=20190121082119.sxstti6dt2gbs5f4@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.