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 4C44FA0A02 for ; Thu, 14 Jan 2021 13:38:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 259771411F8; Thu, 14 Jan 2021 13:38:56 +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 CBE2F1411F8 for ; Thu, 14 Jan 2021 13:38:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610627934; 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=Ec7QRQlkFgbi6r/EPiiLHrIxv8hzmf7Vpp7rY8gjj3M=; b=Vdtt971qBZnqG4Cn1wPTSAAzCMAVPdeoz8nHNJQVMuwaheeO+6h72p2ZqnYpA3Nf+FT/jf /fLQY2CBm8YXBR3xR4q+UO26ivalnmZy7SZxUN3m5YhkcBqBDpN6NyP+c0grPoGvsCBQcw w3OINZeNjbW7f4x8mSQR4N/GXmG9uz4= 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-103-3NZw9M_8M9Oes-vmOtHgHg-1; Thu, 14 Jan 2021 07:38:52 -0500 X-MC-Unique: 3NZw9M_8M9Oes-vmOtHgHg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70E548066EC; Thu, 14 Jan 2021 12:38:51 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DE9C5E1A4; Thu, 14 Jan 2021 12:38:47 +0000 (UTC) To: Matan Azrad , David Marchand Cc: dev , dpdk stable References: <1609915409-272126-1-git-send-email-matan@nvidia.com> <746e905a-c394-44df-2c49-2afd59c05d9f@redhat.com> From: Maxime Coquelin Message-ID: <1052520c-61e9-2135-bbad-9d009f52ce4b@redhat.com> Date: Thu, 14 Jan 2021 13:38:45 +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: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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" Hi Matan, On 1/14/21 12:49 PM, Matan Azrad wrote: > Hi Maxime and David > > Thank you for Review. > > From: David Marchand >> On Fri, Jan 8, 2021 at 9:48 AM David Marchand >> wrote: >>>> I wonder if it would be possible and cleaner to disable cancellation >>>> on the thread while the mutex is held? > > Yes, we can cause thread to return by some global variable sync. > It is the same logic. No, that was not my suggestion. My suggestion is to block the thread cancellation while in the critical section, using pthread_setcancelstate(). >>> +1 >> >> IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/26 is applied, adding >> pthread_t to the list of types that are not required to be arithmetic types, thus >> allowing pthread_t to be defined as a structure. >> >> It would be better to leave pthread_t alone and not interpret it: >> >> if (priv->timer_tid) { >> pthread_cancel(priv->timer_tid); >> pthread_join(priv->timer_tid, &status); } >> priv->timer_tid = 0; > > > I'm not sure why you think it is better in this specific case. > The cancellation will close the thread in faster way, no need to wait for the thread to close itself. > > >> >> -- >> David Marchand >