DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com
Cc: lvyilong.lyl@alibaba-inc.com, yinan.wang@intel.com,
	xnhp0320@icloud.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] vhost: do not realloc device and queues during running
Date: Mon, 19 Aug 2019 19:34:55 +0800	[thread overview]
Message-ID: <20190819113457.15569-2-tiwei.bie@intel.com> (raw)
In-Reply-To: <20190819113457.15569-1-tiwei.bie@intel.com>

When the device has been started, don't do the reallocation anymore.
Otherwise the pointers used in application threads can be invalidated
without proper protection. Instead of introducing a global lock to
protect the change of device pointers which will hurt the performance,
let's just do the reallocation during setup.

Fixes: af295ad4698c ("vhost: realloc device and queues to same numa node as vring desc")
Cc: stable@dpdk.org

Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/vhost_user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 0b72648a5..ea43ab139 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -410,6 +410,9 @@ numa_realloc(struct virtio_net *dev, int index)
 	struct batch_copy_elem *new_batch_copy_elems;
 	int ret;
 
+	if (dev->flags & VIRTIO_DEV_RUNNING)
+		return dev;
+
 	old_dev = dev;
 	vq = old_vq = dev->virtqueue[index];
 
-- 
2.17.1


  reply	other threads:[~2019-08-19 11:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 11:34 [dpdk-dev] [PATCH 0/3] Some fixes for vhost Tiwei Bie
2019-08-19 11:34 ` Tiwei Bie [this message]
2019-09-18 13:30   ` [dpdk-dev] [PATCH 1/3] vhost: do not realloc device and queues during running Maxime Coquelin
2019-08-19 11:34 ` [dpdk-dev] [PATCH 2/3] vhost: fix vring addr handling during live migration Tiwei Bie
2019-09-27  7:54   ` Maxime Coquelin
2019-08-19 11:34 ` [dpdk-dev] [PATCH 3/3] vhost: protect vring access done by application Tiwei Bie
2019-09-27  8:25   ` Maxime Coquelin
2019-09-27  9:48 ` [dpdk-dev] [PATCH 0/3] Some fixes for vhost Maxime Coquelin

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=20190819113457.15569-2-tiwei.bie@intel.com \
    --to=tiwei.bie@intel.com \
    --cc=dev@dpdk.org \
    --cc=lvyilong.lyl@alibaba-inc.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=xnhp0320@icloud.com \
    --cc=yinan.wang@intel.com \
    --cc=zhihong.wang@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).