From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22C6FA0350 for ; Tue, 1 Mar 2022 11:44:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15CED426E8; Tue, 1 Mar 2022 11:44:57 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 77DD2426E5 for ; Tue, 1 Mar 2022 11:44:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646131496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A0mWWt6lJEt9L+vqm6X3OVfV8FM5NvwImAcY2xTdpZg=; b=Mv8Cx1RwoafjGvbspKbUnjssWfizBSp+kKlwVHu8j/tci/pQbI6rhMvkFebQ8k72BDxVf+ MnmS2xCxc70Fp5jY6AIDC1Nwq8jZgkB0Ap7WPocutv1ET868TYT5bulIcrm1UjAEeksSNM sC5zVGArj5DGuaafidHhdBX9+ulVcGg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-FluCJhYvNFSghnXeDtlyTg-1; Tue, 01 Mar 2022 05:44:52 -0500 X-MC-Unique: FluCJhYvNFSghnXeDtlyTg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 189D8801AB2; Tue, 1 Mar 2022 10:44:52 +0000 (UTC) Received: from rh.Home (unknown [10.39.194.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0234E6FB02; Tue, 1 Mar 2022 10:44:44 +0000 (UTC) From: Kevin Traynor To: Xuan Ding Cc: Maxime Coquelin , dpdk stable Subject: patch 'vhost: fix field naming in guest page struct' has been queued to stable release 21.11.1 Date: Tue, 1 Mar 2022 10:42:04 +0000 Message-Id: <20220301104300.334382-48-ktraynor@redhat.com> In-Reply-To: <20220301104300.334382-1-ktraynor@redhat.com> References: <20220301104300.334382-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/06/22. 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. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/01e3dee29c02e68a2ed395185ca89faab11246d3 Thanks. Kevin --- >From 01e3dee29c02e68a2ed395185ca89faab11246d3 Mon Sep 17 00:00:00 2001 From: Xuan Ding Date: Tue, 15 Feb 2022 15:02:25 +0000 Subject: [PATCH] vhost: fix field naming in guest page struct [ upstream commit 2ec359747e61db15ab18a78fa35f503a4f647463 ] This patch renames the host_phys_addr to host_iova in guest_page struct. The host_phys_addr is iova, it depends on the DPDK IOVA mode. Fixes: e246896178e6 ("vhost: get guest/host physical address mappings") Signed-off-by: Xuan Ding Reviewed-by: Maxime Coquelin --- lib/vhost/vhost.h | 10 +++++----- lib/vhost/vhost_user.c | 20 ++++++++++---------- lib/vhost/virtio_net.c | 11 ++++++----- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h index b3f0c1d07c..c5d8b84320 100644 --- a/lib/vhost/vhost.h +++ b/lib/vhost/vhost.h @@ -355,5 +355,5 @@ struct vring_packed_desc_event { struct guest_page { uint64_t guest_phys_addr; - uint64_t host_phys_addr; + uint64_t host_iova; uint64_t size; }; @@ -619,5 +619,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, page->guest_phys_addr + page->size) { return gpa - page->guest_phys_addr + - page->host_phys_addr; + page->host_iova; } else if (gpa < page->guest_phys_addr + page->size) { @@ -625,5 +625,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, page->size - gpa; return gpa - page->guest_phys_addr + - page->host_phys_addr; + page->host_iova; } } @@ -636,5 +636,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, page->guest_phys_addr + page->size) { return gpa - page->guest_phys_addr + - page->host_phys_addr; + page->host_iova; } else if (gpa < page->guest_phys_addr + page->size) { @@ -642,5 +642,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, page->size - gpa; return gpa - page->guest_phys_addr + - page->host_phys_addr; + page->host_iova; } } diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 5eb1dd6812..14ba3365c7 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -979,5 +979,5 @@ vhost_user_set_vring_base(struct virtio_net **pdev, static int add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, - uint64_t host_phys_addr, uint64_t size) + uint64_t host_iova, uint64_t size) { struct guest_page *page, *last_page; @@ -1000,5 +1000,5 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, last_page = &dev->guest_pages[dev->nr_guest_pages - 1]; /* merge if the two pages are continuous */ - if (host_phys_addr == last_page->host_phys_addr + + if (host_iova == last_page->host_iova + last_page->size) { last_page->size += size; @@ -1009,5 +1009,5 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, page = &dev->guest_pages[dev->nr_guest_pages++]; page->guest_phys_addr = guest_phys_addr; - page->host_phys_addr = host_phys_addr; + page->host_iova = host_iova; page->size = size; @@ -1022,12 +1022,12 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg, uint64_t host_user_addr = reg->host_user_addr; uint64_t guest_phys_addr = reg->guest_phys_addr; - uint64_t host_phys_addr; + uint64_t host_iova; uint64_t size; - host_phys_addr = rte_mem_virt2iova((void *)(uintptr_t)host_user_addr); + host_iova = rte_mem_virt2iova((void *)(uintptr_t)host_user_addr); size = page_size - (guest_phys_addr & (page_size - 1)); size = RTE_MIN(size, reg_size); - if (add_one_guest_page(dev, guest_phys_addr, host_phys_addr, size) < 0) + if (add_one_guest_page(dev, guest_phys_addr, host_iova, size) < 0) return -1; @@ -1038,7 +1038,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg, while (reg_size > 0) { size = RTE_MIN(reg_size, page_size); - host_phys_addr = rte_mem_virt2iova((void *)(uintptr_t) + host_iova = rte_mem_virt2iova((void *)(uintptr_t) host_user_addr); - if (add_one_guest_page(dev, guest_phys_addr, host_phys_addr, + if (add_one_guest_page(dev, guest_phys_addr, host_iova, size) < 0) return -1; @@ -1072,9 +1072,9 @@ dump_guest_pages(struct virtio_net *dev) "guest physical page region %u\n" "\t guest_phys_addr: %" PRIx64 "\n" - "\t host_phys_addr : %" PRIx64 "\n" + "\t host_iova : %" PRIx64 "\n" "\t size : %" PRIx64 "\n", i, page->guest_phys_addr, - page->host_phys_addr, + page->host_iova, page->size); } diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index b3d954aab4..568d6538ed 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -871,11 +871,12 @@ async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq, uint64_t mapped_len; uint32_t buf_offset = 0; - void *hpa; + void *host_iova; while (cpy_len) { - hpa = (void *)(uintptr_t)gpa_to_first_hpa(dev, + host_iova = (void *)(uintptr_t)gpa_to_first_hpa(dev, buf_iova + buf_offset, cpy_len, &mapped_len); - if (unlikely(!hpa)) { - VHOST_LOG_DATA(ERR, "(%d) %s: failed to get hpa.\n", dev->vid, __func__); + if (unlikely(!host_iova)) { + VHOST_LOG_DATA(ERR, "(%d) %s: failed to get host_iova.\n", + dev->vid, __func__); return -1; } @@ -884,5 +885,5 @@ async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq, (void *)(uintptr_t)rte_pktmbuf_iova_offset(m, mbuf_offset), - hpa, (size_t)mapped_len))) + host_iova, (size_t)mapped_len))) return -1; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-01 10:41:02.660612129 +0000 +++ 0048-vhost-fix-field-naming-in-guest-page-struct.patch 2022-03-01 10:41:01.331244103 +0000 @@ -1 +1 @@ -From 2ec359747e61db15ab18a78fa35f503a4f647463 Mon Sep 17 00:00:00 2001 +From 01e3dee29c02e68a2ed395185ca89faab11246d3 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2ec359747e61db15ab18a78fa35f503a4f647463 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 64ec76b80e..5606360414 100644 +index b3f0c1d07c..c5d8b84320 100644 @@ -25 +26 @@ -@@ -425,5 +425,5 @@ struct vring_packed_desc_event { +@@ -355,5 +355,5 @@ struct vring_packed_desc_event { @@ -32 +33 @@ -@@ -688,5 +688,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, +@@ -619,5 +619,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, @@ -39 +40 @@ -@@ -694,5 +694,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, +@@ -625,5 +625,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, @@ -46 +47 @@ -@@ -705,5 +705,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, +@@ -636,5 +636,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, @@ -53 +54 @@ -@@ -711,5 +711,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, +@@ -642,5 +642,5 @@ gpa_to_first_hpa(struct virtio_net *dev, uint64_t gpa, @@ -61 +62 @@ -index 4f135f1f72..8257a92e12 100644 +index 5eb1dd6812..14ba3365c7 100644 @@ -64 +65 @@ -@@ -987,5 +987,5 @@ vhost_user_set_vring_base(struct virtio_net **pdev, +@@ -979,5 +979,5 @@ vhost_user_set_vring_base(struct virtio_net **pdev, @@ -71 +72 @@ -@@ -1008,5 +1008,5 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, +@@ -1000,5 +1000,5 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, @@ -78 +79 @@ -@@ -1017,5 +1017,5 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, +@@ -1009,5 +1009,5 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, @@ -85 +86 @@ -@@ -1030,12 +1030,12 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg, +@@ -1022,12 +1022,12 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg, @@ -101 +102 @@ -@@ -1046,7 +1046,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg, +@@ -1038,7 +1038,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg, @@ -111,9 +112,12 @@ -@@ -1081,6 +1081,6 @@ dump_guest_pages(struct virtio_net *dev) - VHOST_LOG_CONFIG(INFO, "(%s)\tguest_phys_addr: %" PRIx64 "\n", - dev->ifname, page->guest_phys_addr); -- VHOST_LOG_CONFIG(INFO, "(%s)\thost_phys_addr : %" PRIx64 "\n", -- dev->ifname, page->host_phys_addr); -+ VHOST_LOG_CONFIG(INFO, "(%s)\thost_iova : %" PRIx64 "\n", -+ dev->ifname, page->host_iova); - VHOST_LOG_CONFIG(INFO, "(%s)\tsize : %" PRIx64 "\n", - dev->ifname, page->size); +@@ -1072,9 +1072,9 @@ dump_guest_pages(struct virtio_net *dev) + "guest physical page region %u\n" + "\t guest_phys_addr: %" PRIx64 "\n" +- "\t host_phys_addr : %" PRIx64 "\n" ++ "\t host_iova : %" PRIx64 "\n" + "\t size : %" PRIx64 "\n", + i, + page->guest_phys_addr, +- page->host_phys_addr, ++ page->host_iova, + page->size); + } @@ -121 +125 @@ -index 886e076b28..5f432b0d77 100644 +index b3d954aab4..568d6538ed 100644 @@ -124 +128 @@ -@@ -1005,11 +1005,12 @@ async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq, +@@ -871,11 +871,12 @@ async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq, @@ -135 +139 @@ -- VHOST_LOG_DATA(ERR, "(%s) %s: failed to get hpa.\n", dev->ifname, __func__); +- VHOST_LOG_DATA(ERR, "(%d) %s: failed to get hpa.\n", dev->vid, __func__); @@ -137,2 +141,2 @@ -+ VHOST_LOG_DATA(ERR, "(%s) %s: failed to get host iova.\n", -+ dev->ifname, __func__); ++ VHOST_LOG_DATA(ERR, "(%d) %s: failed to get host_iova.\n", ++ dev->vid, __func__); @@ -141 +145 @@ -@@ -1018,5 +1019,5 @@ async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq, +@@ -884,5 +885,5 @@ async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq,