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 E3192A0562; Wed, 14 Apr 2021 15:10:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9670161AC6; Wed, 14 Apr 2021 15:10:13 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 67FF24013F for ; Wed, 14 Apr 2021 15:10:12 +0200 (CEST) IronPort-SDR: bQOaiAOIQxuY4VvbohrndSSSaTjobEQVf9r0dzeI54rb8EIho3h3m75lQqiO+OSv1GzE/kvBUR qc+w+BJnyadg== X-IronPort-AV: E=McAfee;i="6200,9189,9953"; a="194199606" X-IronPort-AV: E=Sophos;i="5.82,222,1613462400"; d="scan'208";a="194199606" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 06:10:10 -0700 IronPort-SDR: 7J+Cv6Am4qsDmGh0awAoLp6PxPEGC9AIV8wTStr9OdXhsIV8OSo9L4l5C5RBoqso8lP4COlB48 6RBeOciY3Vkw== X-IronPort-AV: E=Sophos;i="5.82,222,1613462400"; d="scan'208";a="461206814" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.205.34]) ([10.213.205.34]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 06:10:08 -0700 To: Gaetan Rivet , matan@mellanox.com Cc: dev@dpdk.org, Stephen Hemminger References: <20210315192722.35490-1-stephen@networkplumber.org> <20210315192722.35490-3-stephen@networkplumber.org> From: Ferruh Yigit X-User: ferruhy Message-ID: <0def4a36-e5e2-1a41-df84-2b237efc7758@intel.com> Date: Wed, 14 Apr 2021 14:10:06 +0100 MIME-Version: 1.0 In-Reply-To: <20210315192722.35490-3-stephen@networkplumber.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH 2/2] net/failsafe: fix primary/secondary mutex X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/15/2021 7:27 PM, Stephen Hemminger wrote: > Set mutex used in failsafe driver to protect when used by > both primary and secondary process. Without this fix, the failsafe > lock is not really locking when there are multiple secondary processes. > > Bugzilla ID: 662 > Signed-off-by: Stephen Hemminger > Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races") > Cc: matan@mellanox.com > --- > drivers/net/failsafe/failsafe.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c > index e3bda0df2bf9..5b7e560dbc08 100644 > --- a/drivers/net/failsafe/failsafe.c > +++ b/drivers/net/failsafe/failsafe.c > @@ -140,6 +140,11 @@ fs_mutex_init(struct fs_priv *priv) > ERROR("Cannot initiate mutex attributes - %s", strerror(ret)); > return ret; > } > + /* Allow mutex to protect primary/secondary */ > + ret = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); > + if (ret) > + ERROR("Cannot set mutex shared - %s", strerror(ret)); > + > /* Allow mutex relocks for the thread holding the mutex. */ > ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); > if (ret) { > Overall looks good to me. Gaetan, Matan, Can you please test the patch? To be sure it is not causing any unexpected functional/performance issues. Thanks, ferruh