From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Matan Azrad <matan@nvidia.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] vdpa/mlx5: fix configuration mutex cleanup
Date: Thu, 7 Jan 2021 19:09:09 +0100 [thread overview]
Message-ID: <746e905a-c394-44df-2c49-2afd59c05d9f@redhat.com> (raw)
In-Reply-To: <1609915409-272126-1-git-send-email-matan@nvidia.com>
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?
Regards,
Maxime
next prev parent reply other threads:[~2021-01-07 18:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-06 6:43 Matan Azrad
2021-01-07 18:09 ` Maxime Coquelin [this message]
2021-01-08 8:48 ` [dpdk-dev] [dpdk-stable] " David Marchand
2021-01-14 8:34 ` 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=746e905a-c394-44df-2c49-2afd59c05d9f@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.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).