From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 357ED1B8F1 for ; Wed, 4 Apr 2018 14:57:12 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F0184040853; Wed, 4 Apr 2018 12:57:11 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-63.ams2.redhat.com [10.36.117.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62264215CDAF; Wed, 4 Apr 2018 12:57:10 +0000 (UTC) To: Maxime Coquelin , stable@dpdk.org, bluca@debian.org, jianfeng.tan@intel.com References: <20180328195135.25692-1-maxime.coquelin@redhat.com> From: Kevin Traynor Organization: Red Hat Message-ID: <1a0753a2-a37c-0ec8-d126-873bba2a277d@redhat.com> Date: Wed, 4 Apr 2018 13:57:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20180328195135.25692-1-maxime.coquelin@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 04 Apr 2018 12:57:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 04 Apr 2018 12:57:11 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ktraynor@redhat.com' RCPT:'' Subject: Re: [dpdk-stable] [PATCH v2 v16.11 LTS] vhost-user: fix deadlock in case of NUMA realloc 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, 04 Apr 2018 12:57:12 -0000 On 03/28/2018 08:51 PM, Maxime Coquelin wrote: > Virtqueue's access lock was recently introduced to protect > the device against async changes. > > One problem with the v16.11 backport is that in case of NUMA > reallocation, the device gets stuck because the old access_lock > gets unlocked instead of its reallocated copy. On the next > vhost-user message received, the thread keeps spinning on the > lock, as it will never be unlocked. > Reviewed-by: Kevin Traynor > Fixes: ce3b23dc9296 ("vhost: protect active rings from async ring changes") > > Cc: stable@dpdk.org > > Tested-by: Kevin Traynor > Signed-off-by: Maxime Coquelin > --- > V2: remove debug changes squashed by mistake... > > lib/librte_vhost/vhost_user.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index 80348dbf6..94a48a4b0 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -327,9 +327,11 @@ qva_to_vva(struct virtio_net *dev, uint64_t qva) > * This function then converts these to our address space. > */ > static int > -vhost_user_set_vring_addr(struct virtio_net *dev, struct vhost_vring_addr *addr) > +vhost_user_set_vring_addr(struct virtio_net **pdev, > + struct vhost_vring_addr *addr) > { > struct vhost_virtqueue *vq; > + struct virtio_net *dev = *pdev; > > if (dev->mem == NULL) > return -1; > @@ -348,6 +350,8 @@ vhost_user_set_vring_addr(struct virtio_net *dev, struct vhost_vring_addr *addr) > } > > dev = numa_realloc(dev, addr->index); > + *pdev = dev; > + > vq = dev->virtqueue[addr->index]; > > vq->avail = (struct vring_avail *)(uintptr_t)qva_to_vva(dev, > @@ -1092,7 +1096,7 @@ vhost_user_msg_handler(int vid, int fd) > vhost_user_set_vring_num(dev, &msg.payload.state); > break; > case VHOST_USER_SET_VRING_ADDR: > - vhost_user_set_vring_addr(dev, &msg.payload.addr); > + vhost_user_set_vring_addr(&dev, &msg.payload.addr); > break; > case VHOST_USER_SET_VRING_BASE: > vhost_user_set_vring_base(dev, &msg.payload.state); >