From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FEBDA04F0 for ; Thu, 19 Dec 2019 15:41:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 35BDF1BF81; Thu, 19 Dec 2019 15:41:40 +0100 (CET) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 5CD661BF81 for ; Thu, 19 Dec 2019 15:41:39 +0100 (CET) Received: by mail-wm1-f65.google.com with SMTP id d73so5697186wmd.1 for ; Thu, 19 Dec 2019 06:41:39 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=1Bna6nPnguWS+7nKZq2zJ25aZ3q2sIpSXTLyw9VWLxs=; b=Xmx7WQNOw6S7aZNG09bjStpoKbfDYAwGvfFLIlclbMzzzbPl42hM8Ze/1KmRCgTZ9q f2chWZLqKBDLU0UNYYjXSE72uuuk9YCvAvWtLDP8++ZRZJznGKI/MiufrqLSgCB2WcVv UPHYR3Dcd8AvYNghktbYZbcmy9gVFeKasOdkmAS/9h5wHCmP/dTbk7Lf1DarH8mbeLIq dH+Ck9vupqwFe9SPiTLvwMLZqRsLWoQxHdX67mOwD3/Xadop10ySx8oCmRe+HfVHk3J/ 6iTURqTouQIFVXD9NbWX09YWTlBS8pNuCv+EUGXY+K2JeKzuU4lNspoCNokyGAGdyl8l yJyA== 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:mime-version:content-transfer-encoding; bh=1Bna6nPnguWS+7nKZq2zJ25aZ3q2sIpSXTLyw9VWLxs=; b=hOa2A9LE9+HF7kWfAQx2dMbHRR72lo8o2CPQ3PTwNmDtTQiksy51esBJMiq75AeAAV EcXpCR5fRt5UzfH4NZcP8YnoRChD2QcTy62HPatmKu+WTovAZ/cR79+n2BfgIFdZrKNt S3I0VW7dVmBy2IayG4YLVyj5YnvqyZsdpcSckhDoAgd+2QLRAPXfiYYivOTRdAmWZ9Hx QAATDAQDleRzZz4EJ6IYRwToXv5WgnMqEiLoXusjYcJqU1hiscyBNOrKcm/ERkDDbsKB GYJxhGDjUK37+eeejpShGJsRjQgbZ1yorInIP6GS2bEBqRAHq0vgg8Saxk1CS7W9/VUH 7pJw== X-Gm-Message-State: APjAAAVaxdW4EpMBgYz5EMrsY8xyvT1BdUcuvxjhgRkovtZnuV/Qnq2S 9L+QPx0TM4gFg1jieCPfTsDZu1PoJtk= X-Google-Smtp-Source: APXvYqyBg0wwZTJMh0Yr/U2/uhqX0wH2k6ThLp6Wdr5v+ZnSQlQQLUXaXQTA4qaPIcOj4MZdmvsOTQ== X-Received: by 2002:a1c:1fc5:: with SMTP id f188mr11066433wmf.55.1576766499112; Thu, 19 Dec 2019 06:41:39 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id q3sm6155129wmc.47.2019.12.19.06.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:41:38 -0800 (PST) From: luca.boccassi@gmail.com To: Marvin Liu Cc: Adrian Moreno , Maxime Coquelin , dpdk stable Date: Thu, 19 Dec 2019 14:34:21 +0000 Message-Id: <20191219143447.21506-114-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'vhost: fix virtqueue not accessible' has been queued to LTS release 17.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 17.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/21/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From f1c2db80a906572df5dc40cd7d5eccfa94226103 Mon Sep 17 00:00:00 2001 From: Marvin Liu Date: Mon, 4 Nov 2019 18:13:22 +0800 Subject: [PATCH] vhost: fix virtqueue not accessible [ upstream commit bc42ca1787233617e5ce8a848e268784884a8d07 ] Log feature is disabled in vhost user, so that log address was invalid when checking. Check whether log address is valid can work around it. Log address should also be translated in packed ring virtqueue. Fixes: fbda9f145927 ("vhost: translate incoming log address to GPA") Signed-off-by: Marvin Liu Reviewed-by: Adrian Moreno Reviewed-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index f039ce8706..7bb2868011 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -502,6 +502,17 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) struct vhost_vring_addr *addr = &vq->ring_addrs; uint64_t len; + if (addr->flags & (1 << VHOST_VRING_F_LOG)) { + vq->log_guest_addr = + translate_log_addr(dev, vq, addr->log_guest_addr); + if (vq->log_guest_addr == 0) { + RTE_LOG(DEBUG, VHOST_CONFIG, + "(%d) failed to map log_guest_addr.\n", + dev->vid); + return dev; + } + } + /* The addresses are converted from QEMU virtual to Vhost virtual. */ if (vq->desc && vq->avail && vq->used) return dev; @@ -553,14 +564,6 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) vq->last_avail_idx = vq->used->idx; } - vq->log_guest_addr = - translate_log_addr(dev, vq, addr->log_guest_addr); - if (vq->log_guest_addr == 0) { - RTE_LOG(DEBUG, VHOST_CONFIG, - "(%d) failed to map log_guest_addr .\n", - dev->vid); - return dev; - } vq->access_ok = 1; LOG_DEBUG(VHOST_CONFIG, "(%d) mapped address desc: %p\n", -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:30.861378103 +0000 +++ 0114-vhost-fix-virtqueue-not-accessible.patch 2019-12-19 14:32:26.289301474 +0000 @@ -1,29 +1,30 @@ -From bc42ca1787233617e5ce8a848e268784884a8d07 Mon Sep 17 00:00:00 2001 +From f1c2db80a906572df5dc40cd7d5eccfa94226103 Mon Sep 17 00:00:00 2001 From: Marvin Liu Date: Mon, 4 Nov 2019 18:13:22 +0800 Subject: [PATCH] vhost: fix virtqueue not accessible +[ upstream commit bc42ca1787233617e5ce8a848e268784884a8d07 ] + Log feature is disabled in vhost user, so that log address was invalid when checking. Check whether log address is valid can work around it. Log address should also be translated in packed ring virtqueue. Fixes: fbda9f145927 ("vhost: translate incoming log address to GPA") -Cc: stable@dpdk.org Signed-off-by: Marvin Liu Reviewed-by: Adrian Moreno Reviewed-by: Maxime Coquelin --- - lib/librte_vhost/vhost_user.c | 20 +++++++++++--------- - 1 file changed, 11 insertions(+), 9 deletions(-) + lib/librte_vhost/vhost_user.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c -index 3f649c802c..cc660e03a8 100644 +index f039ce8706..7bb2868011 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c -@@ -653,11 +653,21 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) +@@ -502,6 +502,17 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) struct vhost_vring_addr *addr = &vq->ring_addrs; - uint64_t len, expected_len; + uint64_t len; + if (addr->flags & (1 << VHOST_VRING_F_LOG)) { + vq->log_guest_addr = @@ -36,15 +37,10 @@ + } + } + - if (vq_is_packed(dev)) { - len = sizeof(struct vring_packed_desc) * vq->size; - vq->desc_packed = (struct vring_packed_desc *)(uintptr_t) - ring_addr_to_vva(dev, vq, addr->desc_user_addr, &len); -- vq->log_guest_addr = 0; - if (vq->desc_packed == NULL || - len != sizeof(struct vring_packed_desc) * - vq->size) { -@@ -753,14 +763,6 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) + /* The addresses are converted from QEMU virtual to Vhost virtual. */ + if (vq->desc && vq->avail && vq->used) + return dev; +@@ -553,14 +564,6 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) vq->last_avail_idx = vq->used->idx; } @@ -58,7 +54,7 @@ - } vq->access_ok = 1; - VHOST_LOG_DEBUG(VHOST_CONFIG, "(%d) mapped address desc: %p\n", + LOG_DEBUG(VHOST_CONFIG, "(%d) mapped address desc: %p\n", -- 2.20.1