patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	stable@dpdk.org, bluca@debian.org, jianfeng.tan@intel.com
Subject: Re: [dpdk-stable] [PATCH v2 v16.11 LTS] vhost-user: fix deadlock in case of NUMA realloc
Date: Wed, 4 Apr 2018 13:57:09 +0100	[thread overview]
Message-ID: <1a0753a2-a37c-0ec8-d126-873bba2a277d@redhat.com> (raw)
In-Reply-To: <20180328195135.25692-1-maxime.coquelin@redhat.com>

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 <ktraynor@redhat.com>

> Fixes: ce3b23dc9296 ("vhost: protect active rings from async ring changes")
> 
> Cc: stable@dpdk.org
> 
> Tested-by: Kevin Traynor <ktraynor@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> 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);
> 

  reply	other threads:[~2018-04-04 12:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 19:51 Maxime Coquelin
2018-04-04 12:57 ` Kevin Traynor [this message]
2018-04-04 19:55   ` Luca Boccassi

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=1a0753a2-a37c-0ec8-d126-873bba2a277d@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=bluca@debian.org \
    --cc=jianfeng.tan@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /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).