From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 420CCA0C40;
	Tue,  8 Jun 2021 17:42:22 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id BD0C640689;
	Tue,  8 Jun 2021 17:42:21 +0200 (CEST)
Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com
 [209.85.215.174])
 by mails.dpdk.org (Postfix) with ESMTP id 379B14067A
 for <dev@dpdk.org>; Tue,  8 Jun 2021 17:42:20 +0200 (CEST)
Received: by mail-pg1-f174.google.com with SMTP id i34so10397516pgl.9
 for <dev@dpdk.org>; Tue, 08 Jun 2021 08:42:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=l8MWf+dB7NXdJ0BXB5UmaxiEm8PGA1T4CSwFH0Xc/C4=;
 b=IftxJ90RmDmIbGfCCpcpf+k/ku5CsO2sGZJnEx7IsInDTxRkjrl6u8NBtVHShkpB2d
 dxvmCg5xs40TLnTCtAuw/5ilgpEY0LHSJ3HsTG/bbgI7CdZchKLrv9oGRBP082Z85kAg
 hJDEmYpM1RxeTtq6zNaPdq7DQ5GODt/re8w9vyFpsf/fgU6umHznl7UIvhIO70P+PBOg
 JiAs9wWktsxV8t00FCfiS70E3ZqhzNAJherlAVJbHKCwKrMGGvZxTaQQJHDS7/D63ZSJ
 p1D9XY4Wh7T3zcCKY2ENr7ybZL/2eDj2PohdMqTc5KMOQ2zmdNPv8smTsI03sHxUKR26
 Vdig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=l8MWf+dB7NXdJ0BXB5UmaxiEm8PGA1T4CSwFH0Xc/C4=;
 b=lyw1xdCeLTwsH3Rodf6AB/kth4vbxpAvrqgZ7Yf9sLJDaDG71uwD7nJtyv9cpPg/xF
 ik2kgR8Tt2aISuHeo+Ou7McPpPkxdSY14BuWtLdccYamd8O+lvXabS5ICEB9v0/Ik3UP
 SyWPwceUNVzf2kAaPixRwZxQ2c74LNQf+8Pl0dI5uYzRNxiTpXeMVZ6s3WCnRA3Pthau
 9CEdzQhSgrCq5qLlSNH/2T9YHCxy2B3J36LiDYqTzoKsH3jo3l/X9VJqE9ysdXKVawle
 hSdutaZDxB0PjbtktdHrkWRmk7LofL6tN1EGpAb2G1e02An8JvEwpPG3L1+b8Suo9cqC
 M7Ew==
X-Gm-Message-State: AOAM530EHbNZmbOoNNSF/UqTtjZP9OTvzObsQ3SoeS3wjne+WcEk2BTT
 QjSlyrTT2dl3WnLkJyys4b0Ybw==
X-Google-Smtp-Source: ABdhPJxomK3D83F5N59PK9ZNiV+7Z5Tia3bGQjPuA/1Ub8QylZCtT6kjev6BkeC+zhc5ITVVHciSIw==
X-Received: by 2002:a63:3543:: with SMTP id c64mr22875440pga.403.1623166939211; 
 Tue, 08 Jun 2021 08:42:19 -0700 (PDT)
Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44])
 by smtp.gmail.com with ESMTPSA id s13sm6359183pgi.36.2021.06.08.08.42.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 08 Jun 2021 08:42:18 -0700 (PDT)
Date: Tue, 8 Jun 2021 08:42:10 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: Thomas Monjalon <thomas@monjalon.net>, dev@dpdk.org, matan@mellanox.com,
 Gaetan Rivet <grive@u256.net>
Message-ID: <20210608084210.73d05f60@hermes.local>
In-Reply-To: <e20cd33e-f44d-0cc9-67d7-43668c5fd866@oktetlabs.ru>
References: <20210315192722.35490-1-stephen@networkplumber.org>
 <20210315192722.35490-3-stephen@networkplumber.org>
 <6747934.v7ilQdk43l@thomas>
 <e20cd33e-f44d-0cc9-67d7-43668c5fd866@oktetlabs.ru>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Tue, 8 Jun 2021 11:00:37 +0300
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:

> On 4/19/21 8:08 PM, Thomas Monjalon wrote:
> > About the title, better to speak about multi-process,
> > it is less confusing than primary/secondary.
> > 
> > 15/03/2021 20:27, Stephen Hemminger:  
> >> 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 <stephen@networkplumber.org>
> >> Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races")
> >> Cc: matan@mellanox.com  
> > 
> > The correct order for above lines is:
> > 
> > Bugzilla ID: 662
> > Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races")
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> >   
> >> ---
> >> --- 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));  
> > 
> > Why not returning an error here?  
> 
> +1
> 
> I think it would be safer to return an error here.

Ok but it never happens.