From patchwork Tue Jun 11 17:11:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Tsirakis X-Patchwork-Id: 10987911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76C9714BB for ; Tue, 11 Jun 2019 17:17:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 550EE23B24 for ; Tue, 11 Jun 2019 17:17:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 425D92873C; Tue, 11 Jun 2019 17:17:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DF7E323B24 for ; Tue, 11 Jun 2019 17:17:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hakMy-0006YN-1f; Tue, 11 Jun 2019 17:15:36 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hakJ2-0006TS-1C for xen-devel@lists.xenproject.org; Tue, 11 Jun 2019 17:11:32 +0000 X-Inumbo-ID: f4748b25-8c6b-11e9-8980-bc764e045a96 Received: from mail-qk1-x742.google.com (unknown [2607:f8b0:4864:20::742]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id f4748b25-8c6b-11e9-8980-bc764e045a96; Tue, 11 Jun 2019 17:11:30 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id m14so8123460qka.10 for ; Tue, 11 Jun 2019 10:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZWlQYcXiYq4K+TsBHQ76oJw3abz884c7rNhqBJDQvhY=; b=qCKV/+lGBKvkrBjqJsoUyqYeqxfmWelo6UACUr6ry5UV2BtTGHymrtmEGdPMZgKhHF /Z/dPso4GmW4j+5krN6tcSIPD6l5FdrFI5+chZWWQcEVq1yew2ZfDQhY1gUtLtqjMvmw u9n++rSpE+txw9zeMHBXo81Y2SKw6FVRWI2q4su67jMKHP0Jp1dqZsqqf5xYIyxJhDZS f7HhDG6EK3kQmzhyXZPB950bv0cX52RRJMdiUlnFJeQzKFX7aHr3LrjiTjl1ayTr5u+y sT0WVPOkQSp7ls+C4iS400Ks+Wbg7rUv8/m/77N3doxH9Pa0Guuswv9apM53do90OhXK /Nzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZWlQYcXiYq4K+TsBHQ76oJw3abz884c7rNhqBJDQvhY=; b=cARyPFiiBiwZLz2OduleVbM8R6+yUeqW000r8P2aTg5CXINrVgFqIT9Nti4YKf3qVG r5fsU24nzgrnF/tz5Gx+v+8wybe6XOfvE7FBIr1KZgr6nOu95cKUoE3pYZV3LxX2rjIW 0nvRzsdoEErszDQ02CXaEEkjoRK6Vbj9mTC/9wqcgNnLm862yk0HCKmsJqZpZFegVmgf RBBhGLTTD+F5OikMbu6ORPXdzLeGCXDs8PJvamDNj+1eDQYSbOV8TpTXMRZ5rhF6rOyW uF1HyiIXnyl/4eJp1vaDdooP7XDqAT8sIWp76LQLOnXuZdWQ5KaTf4qTulLder9T8NvX 0CUg== X-Gm-Message-State: APjAAAWS7t1AnDu+R7Qs7mJ3b8VwJtmang8BxnHOSvYm9Fv/+E7bthu5 T35kAA66eD6vSsJIMn57YzyoPB75XlLmww== X-Google-Smtp-Source: APXvYqx+hHnpLR27v+s6IikIzaRlfP/H1xdNONaomiuAPaXD4Iw6g7+p5Cn6Sx/XDm4y2QiOn744zw== X-Received: by 2002:ae9:c10c:: with SMTP id z12mr7963437qki.110.1560273089748; Tue, 11 Jun 2019 10:11:29 -0700 (PDT) Received: from niko-Latitude-E7470.fios-router.home (pool-108-54-183-56.nycmny.fios.verizon.net. [108.54.183.56]) by smtp.gmail.com with ESMTPSA id q2sm7072848qkf.44.2019.06.11.10.11.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 10:11:29 -0700 (PDT) From: Nicholas Tsirakis X-Google-Original-From: Nicholas Tsirakis To: xen-devel@lists.xenproject.org Date: Tue, 11 Jun 2019 13:11:24 -0400 Message-Id: X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Tue, 11 Jun 2019 17:15:35 +0000 Subject: [Xen-devel] [PATCH 1/2] argo: warn sendv() caller when ring is full X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Nicholas Tsirakis , Christopher Clark MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Christopher Clark Reviewed-by: Christopher Clark --- 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); From patchwork Tue Jun 11 17:11:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Tsirakis X-Patchwork-Id: 10987913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69B076C5 for ; Tue, 11 Jun 2019 17:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D65023B24 for ; Tue, 11 Jun 2019 17:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E84F28694; Tue, 11 Jun 2019 17:17:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E4FE52873C for ; Tue, 11 Jun 2019 17:17:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hakMy-0006YT-Au; Tue, 11 Jun 2019 17:15:36 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hakJ6-0006Tt-D5 for xen-devel@lists.xenproject.org; Tue, 11 Jun 2019 17:11:36 +0000 X-Inumbo-ID: f76efcdc-8c6b-11e9-8980-bc764e045a96 Received: from mail-qt1-x841.google.com (unknown [2607:f8b0:4864:20::841]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id f76efcdc-8c6b-11e9-8980-bc764e045a96; Tue, 11 Jun 2019 17:11:35 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id y57so15470498qtk.4 for ; Tue, 11 Jun 2019 10:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ziayDw4v7TqaC+TVnep2nFZ1Iu6htXCoSZGt4yUQ1yQ=; b=qvogJPHFOAmq6kcPdhGrvi1r5/HKQywxwG2470t6ecePqm9OF0Gc1ZXUjgtslZjKiw 2M+BiKUKu+AsimnrDelsnDApxUyJKH+X2WCNb+jXn5XuJOmXFNZkaIppQm0qbyL5MB6R TULQm3Eu413c9S8KmFnFMjq9K6rZheaFm0G5TeAwTtXjWujZM2r3om8rhGwcs9Q1rrEh WM9WnNwxMfMGqiUiJU4MA8Z3grxqGg8LuBrjWeHgQ5phwOZUa6Np8FCVW88ftHI+s7oi 7nvxBRSbEXP+CcUrecHVhkHF6vJKAelNvusXFfmv4ZgEYQMuWPQlQy18QtU7YydvEIeC mIKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ziayDw4v7TqaC+TVnep2nFZ1Iu6htXCoSZGt4yUQ1yQ=; b=A8SMJIMCnGAjwgGCxX9yXOqPMCqdE9srSK5DP0qlhlGHrhKtFyPg2OITNZn8USjVP8 Yh6kfpAMP0kxwmvzr4sA/D0YhymEX7lWKTpk5YFrp2JCxo59CX5z6fF4RgajM5FAvgDd OTBXHwxiwx8oxlnqOk2nPNPpT+N+oehQ4PqJWDIIWEhSSDbWjmg1G34eM4eaYZCZTqJG rGynKAieMS/rHc6GE5kDORIJvL66oUTswWX4URp9ZYTFJcoM1VGfQtG3A1lwef5q0r2Z Yol2z4y7GiyGbvAE5RL58N8upfWKSyVM8IjY61/bZ0hnUQTOyHlizzgrlA7DsW6dB2aQ xBEw== X-Gm-Message-State: APjAAAWZbMFM8Y1Uh6Haz0qPoh8yCJTG6JrMK4X/2Od1YTrLkQUSNGlt rNJ34/MNpMiNX/tCLvMPJJnWT9O6pdDW8g== X-Google-Smtp-Source: APXvYqyzO/aAsZE/ZIuyekdXuIpc71vy8N+rUuRp7B4SfmYLbhRuIsOsrZ3hyeGy58xn/GXUIa/LwQ== X-Received: by 2002:ac8:17c8:: with SMTP id r8mr66281608qtk.319.1560273094537; Tue, 11 Jun 2019 10:11:34 -0700 (PDT) Received: from niko-Latitude-E7470.fios-router.home (pool-108-54-183-56.nycmny.fios.verizon.net. [108.54.183.56]) by smtp.gmail.com with ESMTPSA id q2sm7072848qkf.44.2019.06.11.10.11.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 10:11:34 -0700 (PDT) From: Nicholas Tsirakis X-Google-Original-From: Nicholas Tsirakis To: xen-devel@lists.xenproject.org Date: Tue, 11 Jun 2019 13:11:25 -0400 Message-Id: <43766a806049b9556dd73ed8c1d6368ab2b26c4f.1560272437.git.tsirakisn@ainfosec.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Tue, 11 Jun 2019 17:15:35 +0000 Subject: [Xen-devel] [PATCH 2/2] argo: correctly report pending message length X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Nicholas Tsirakis , Christopher Clark MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When a message is requeue'd in Xen's internal queue, the queue entry contains the length of the message so that Xen knows to send a VIRQ to the respective domain when enough space frees up in the ring. Due to a small bug, however, Xen doesn't populate the length of the msg if a given write fails, so this length is always reported as zero. This causes Xen to spurriously wake up a domain even when the ring doesn't have enough space. This patch makes sure that the msg len is properly reported by populating it in the event of a write failure. Signed-off-by: Nicholas Tsirakis --- xen/common/argo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/common/argo.c b/xen/common/argo.c index 2f874a570d..eb541829d6 100644 --- a/xen/common/argo.c +++ b/xen/common/argo.c @@ -2050,6 +2050,12 @@ sendv(struct domain *src_d, xen_argo_addr_t *src_addr, { int rc; + /* + * if ringbuf_insert fails, then len will never be populated. + * make sure to populate it here. + */ + iov_count(iovs, niov, &len); + argo_dprintk("argo_ringbuf_sendv failed, EAGAIN\n"); /* requeue to issue a notification when space is there */ rc = pending_requeue(dst_d, ring_info, src_id.domain_id, len);