From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 0D6061D8E; Wed, 6 Dec 2017 15:11:46 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6EF6420A64; Wed, 6 Dec 2017 09:11:45 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 06 Dec 2017 09:11:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=NEvJZ48d6ekSHWSUZV2g0mZdHxMft3/sJCMp1E/JFaY=; b=cqnGgDXw aS2uqsll16J8I4s5HY+WRxVoi2IIi3EsveqJ+S1Hy9x9om0Hk/OQyIa6p7EU7iBs vfS5GIURTOJVkaLSUPXurOl8QyA0A5gMzMIBVe/JxC54ca/vz7ByX7tJXdxsRFPl 3I6jHs6ag0nfZJ89CJb1KP545V3s20BGGIiUCKf+kpvSBdleL6vbaJryoisZKnRT 8mVz94nRZeoj4WnsLepAKoFZxcu9P58KQZMBf/BgN8yEAhUoF4EOM+xMxF85zJl6 sDFPi6/sXNfyDd3nAIBV9ukUPB7c9r5ryCxruf2oUIv4F8rg4D9vmGNDbz4k2Jz4 6JWGdGJodIT0nQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=NEvJZ48d6ekSHWSUZV2g0mZdHxMft 3/sJCMp1E/JFaY=; b=jGmPf+m//jQjBxAelk0CWnqq0TrzwddTAeWgsUStKt1U/ J/LYrRYLypR7rnjFdXiurH0DVB6xOfa8xfuZm8EfmkCu/S8h+4iJQJ6i/HZf7ayN 0Vej/RlaBO0fdZ17xDdji/heWJ0QCxDBJ3tWv1Yv72SX7OuKGbCzC4GiNdh4PA53 LsWN6Hgk9/MK4PSEBTvRYGDPzu4AUzw1IZO/5FNcLtlg1SGGgPtDd1zw27rccdXV 1CDnkTLtU5/zxuwlOGOF6au+v4q1WaK+qYJ3sP8X5oXy5IRG0AIUPgTUYuDzWHzB 3lOn6ReHd66a24FgDV87vu8mpHI1d5jXqHYHs+4Jg== X-ME-Sender: Received: from yliu-dev (unknown [180.158.55.119]) by mail.messagingengine.com (Postfix) with ESMTPA id D14B224136; Wed, 6 Dec 2017 09:11:43 -0500 (EST) Date: Wed, 6 Dec 2017 22:11:31 +0800 From: Yuanhan Liu To: Victor Kaplansky Cc: dev@dpdk.org, tiwei.bie@intel.com, jianfeng.tan@intel.com, stable@dpdk.org, jfreiman@redhat.com, Maxime Coquelin Message-ID: <20171206141131.GC17112@yliu-dev> References: <20171206135329.652-1-vkaplans@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171206135329.652-1-vkaplans@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-stable] [PATCH] vhost_user: protect active rings from async ring changes 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: , X-List-Received-Date: Wed, 06 Dec 2017 14:11:47 -0000 On Wed, Dec 06, 2017 at 03:55:49PM +0200, Victor Kaplansky wrote: > When performing live migration or memory hot-plugging, > the changes to the device and vrings made by message handler > done independently from vring usage by PMD threads. > > This causes for example segfauls during live-migration > with MQ enable, but in general virtually any request > sent by qemu changing the state of device can cause > problems. > > These patches fixes all above issues by adding a spinlock > to every vring and requiring message handler to start operation > only after ensuring that all PMD threads related to the divece > are out of critical section accessing the vring data. > > Each vring has its own lock in order to not create contention > between PMD threads of different vrings and to prevent > performance degradation by scaling queue pair number. Hi, Thanks for the patch! Firstly, I didn't see your SoB. I'm also more interested to know do you see any performance penalty? > --- > lib/librte_vhost/vhost.h | 1 + > lib/librte_vhost/vhost_user.c | 44 +++++++++++++++++++++++++++++++++++++++++++ > lib/librte_vhost/virtio_net.c | 8 ++++++++ > 3 files changed, 53 insertions(+) > > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index 1cc81c17..812aeccd 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -137,6 +137,7 @@ struct vhost_virtqueue { > TAILQ_HEAD(, vhost_iotlb_entry) iotlb_list; > int iotlb_cache_nr; > TAILQ_HEAD(, vhost_iotlb_entry) iotlb_pending_list; > + rte_spinlock_t active_lock; The indentation is broken. > } __rte_cache_aligned; > @@ -1356,6 +1361,8 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id, > if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) > vhost_user_iotlb_rd_unlock(vq); > > + rte_spinlock_unlock(&vq->active_lock); Ditto. --yliu