From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4DA93A09E4 for ; Wed, 27 Jan 2021 11:45:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3ED8C140CF2; Wed, 27 Jan 2021 11:45:36 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 25B38140CC3 for ; Wed, 27 Jan 2021 11:45:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611744332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eWiOjVtYkcD3pxHQ3vSekVU0URS8UiTHKfMFgggCmrs=; b=dqeaRBzbMBOnSXsb7Jj6ZCB1ARtPaBCRNq94Aq2/hDaihZ75BVu3ERWSUDGlDXpqOs49zG yQnK1Gce+tcOPK1r1S16Usb8J5gjwH6ygJ/gjIZV300OIS6ptaMjEhjQ1d4nLaO5bsSIvw u21ZT6gnt/rd7dSwyUcjmj6ic35u9xU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-pn5pn1-fOaqFGSPT7krRyw-1; Wed, 27 Jan 2021 05:45:30 -0500 X-MC-Unique: pn5pn1-fOaqFGSPT7krRyw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74A651005504; Wed, 27 Jan 2021 10:45:29 +0000 (UTC) Received: from [10.36.110.31] (unknown [10.36.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9197E10023AB; Wed, 27 Jan 2021 10:45:28 +0000 (UTC) To: Matan Azrad , dev@dpdk.org Cc: stable@dpdk.org References: <1609915409-272126-1-git-send-email-matan@nvidia.com> From: Maxime Coquelin Message-ID: <17ff796f-a3d9-9b23-bb7f-c52ab9f935d6@redhat.com> Date: Wed, 27 Jan 2021 11:45:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <1609915409-272126-1-git-send-email-matan@nvidia.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [PATCH] vdpa/mlx5: fix configuration mutex cleanup X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 > Acked-by: Xueming Li > --- > 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; > } > Acked-by: Maxime Coquelin