DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Matan Azrad <matan@nvidia.com>
Cc: dev <dev@dpdk.org>, dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] vdpa/mlx5: fix configuration mutex cleanup
Date: Fri, 8 Jan 2021 09:48:31 +0100
Message-ID: <CAJFAV8zi8aYPryqA2W4XUH9O-wxP=8RKGB3F=6+7dVyjmrRa9Q@mail.gmail.com> (raw)
In-Reply-To: <746e905a-c394-44df-2c49-2afd59c05d9f@redhat.com>

On Thu, Jan 7, 2021 at 7:09 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
> On 1/6/21 7:43 AM, Matan Azrad wrote:
> > When the vDPA device is closed, the driver polling thread is canceled.
> > The polling thread locks the configuration mutex while it polls the CQs.
> >
> > When the cancellation happens, it may terminate the thread inside the
> > critical section what remains the configuration mutex locked.
> >
> > After device close, the driver may be configured again, in this case,
> > for example, when the first queue state is updated, the driver tries to
> > lock the mutex again and deadlock appears.
> >
> > Initialize the mutex after the polling thread cancellation.
> >
> > Fixes: 99abbd62c272 ("vdpa/mlx5: fix queue update synchronization")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Matan Azrad <matan@nvidia.com>
> > Acked-by: Xueming Li <xuemingl@nvidia.com>
> > ---
> >  drivers/vdpa/mlx5/mlx5_vdpa.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
> > index b64f364..0b2f1ab 100644
> > --- a/drivers/vdpa/mlx5/mlx5_vdpa.c
> > +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
> > @@ -295,6 +295,8 @@
> >       }
> >       priv->configured = 0;
> >       priv->vid = 0;
> > +     /* The mutex may stay locked after event thread cancel - initiate it. */
> > +     pthread_mutex_init(&priv->vq_config_lock, NULL);
> >       DRV_LOG(INFO, "vDPA device %d was closed.", vid);
> >       return ret;
> >  }
> >
>
> I wonder if it would be possible and cleaner to disable cancellation on
> the thread while the mutex is held?

+1

-- 
David Marchand


  reply	other threads:[~2021-01-08  8:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06  6:43 [dpdk-dev] " Matan Azrad
2021-01-07 18:09 ` Maxime Coquelin
2021-01-08  8:48   ` David Marchand [this message]
2021-01-14  8:34     ` [dpdk-dev] [dpdk-stable] " David Marchand
2021-01-14 11:49       ` Matan Azrad
2021-01-14 12:38         ` Maxime Coquelin
2021-01-14 13:09           ` Matan Azrad
2021-01-14 14:27             ` Maxime Coquelin
2021-01-14 15:23               ` Matan Azrad
2021-01-21 10:46                 ` Maxime Coquelin
2021-01-21 20:13                   ` Matan Azrad
2021-01-26 10:22                     ` Maxime Coquelin
2021-01-26 10:45                       ` Matan Azrad
2021-01-26 13:00                         ` Maxime Coquelin
2021-01-26 18:23                           ` Matan Azrad
2021-01-27 10:45 ` [dpdk-dev] " Maxime Coquelin
2021-01-27 12:01 ` 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='CAJFAV8zi8aYPryqA2W4XUH9O-wxP=8RKGB3F=6+7dVyjmrRa9Q@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git