All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Tsirakis <niko.tsirakis@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Nicholas Tsirakis <tsirakisn@ainfosec.com>,
	Christopher Clark <christopher.w.clark@gmail.com>
Subject: [Xen-devel] [PATCH v2 1/2] argo: warn sendv() caller when ring is full
Date: Tue, 11 Jun 2019 17:14:26 -0400	[thread overview]
Message-ID: <fb83896f3b399c7ace3292f38506812bc4616f6d.1560286430.git.tsirakisn@ainfosec.com> (raw)

In its current state, if the destination ring is full, sendv()
will requeue the message and return the rc of pending_requeue(),
which will return 0 on success. This prevents the caller from
distinguishing the difference between a successful write and a
message that needs to be resent at a later time.

Instead, capture the -EAGAIN value returned from ringbuf_insert()
and *only* overwrite it if the rc of pending_requeue() is non-zero.
This allows the caller to make intelligent decisions on -EAGAIN and
still be alerted if the pending message fails to requeue.

Signed-off-by: Nicholas Tsirakis <tsirakisn@ainfosec.com>
---
 xen/common/argo.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/common/argo.c b/xen/common/argo.c
index 13052b9239..2f874a570d 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -2048,9 +2048,13 @@ sendv(struct domain *src_d, xen_argo_addr_t *src_addr,
                              message_type, &len);
         if ( ret == -EAGAIN )
         {
+            int rc;
+
             argo_dprintk("argo_ringbuf_sendv failed, EAGAIN\n");
             /* requeue to issue a notification when space is there */
-            ret = pending_requeue(dst_d, ring_info, src_id.domain_id, len);
+            rc = pending_requeue(dst_d, ring_info, src_id.domain_id, len);
+            if ( rc )
+                ret = rc;
         }
 
         spin_unlock(&ring_info->L3_lock);
-- 
2.17.1


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

             reply	other threads:[~2019-06-11 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 21:14 Nicholas Tsirakis [this message]
2019-06-11 21:14 ` [Xen-devel] [PATCH v2 2/2] argo: correctly report pending message length Nicholas Tsirakis
2019-06-11 23:27   ` Christopher Clark
2019-06-11 23:15 ` [Xen-devel] [PATCH v2 1/2] argo: warn sendv() caller when ring is full 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=fb83896f3b399c7ace3292f38506812bc4616f6d.1560286430.git.tsirakisn@ainfosec.com \
    --to=niko.tsirakis@gmail.com \
    --cc=christopher.w.clark@gmail.com \
    --cc=tsirakisn@ainfosec.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.