[dpdk-dev,2/3] vhost: fix long stall of vhost-user negotiation

Message ID 1485074820-8956-3-git-send-email-yuanhan.liu@linux.intel.com (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Yuanhan Liu Jan. 22, 2017, 8:46 a.m. UTC
  Setting up the mapping from GPA (guest physical address) to HPA (guest
physical address) could be very time consuming when the guest memory is
backened with small pages (4K). The bigger the guest memory, the longer
it takes. This could lead a very long vhost-user negotiation.

Since the mapping is only needed in zero copy mode so far, we could
avoid such time consuming settup when zero copy is turned off (which is
the default case).

It's actually a workaround, a right fix might be to start a new thread,
and hide the big latency there.

Fixes: e246896178e6 ("vhost: get guest/host physical address mappings")

Cc: stable@dpdk.org
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 lib/librte_vhost/vhost_user.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Maxime Coquelin Jan. 23, 2017, 8:25 a.m. UTC | #1
On 01/22/2017 09:46 AM, Yuanhan Liu wrote:
> Setting up the mapping from GPA (guest physical address) to HPA (guest
> physical address) could be very time consuming when the guest memory is
> backened with small pages (4K). The bigger the guest memory, the longer
> it takes. This could lead a very long vhost-user negotiation.
>
> Since the mapping is only needed in zero copy mode so far, we could
> avoid such time consuming settup when zero copy is turned off (which is
> the default case).
>
> It's actually a workaround, a right fix might be to start a new thread,
> and hide the big latency there.
>
> Fixes: e246896178e6 ("vhost: get guest/host physical address mappings")
>
> Cc: stable@dpdk.org
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
>  lib/librte_vhost/vhost_user.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 7343a00..ab7f3fc 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -567,7 +567,8 @@ 
 		reg->host_user_addr = (uint64_t)(uintptr_t)mmap_addr +
 				      mmap_offset;
 
-		add_guest_pages(dev, reg, alignment);
+		if (dev->dequeue_zero_copy)
+			add_guest_pages(dev, reg, alignment);
 
 		RTE_LOG(INFO, VHOST_CONFIG,
 			"guest memory region %u, size: 0x%" PRIx64 "\n"