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 1B297A0540;
	Mon,  4 Jul 2022 18:35:54 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id AAD2F40E50;
	Mon,  4 Jul 2022 18:35:53 +0200 (CEST)
Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com
 [209.85.210.173])
 by mails.dpdk.org (Postfix) with ESMTP id 7F47140042
 for <dev@dpdk.org>; Mon,  4 Jul 2022 18:35:52 +0200 (CEST)
Received: by mail-pf1-f173.google.com with SMTP id f85so5551750pfa.3
 for <dev@dpdk.org>; Mon, 04 Jul 2022 09:35:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=zrz9LrV2/bQSODpZY1ZVsu7qRnUWkihCx6irF8ySB1g=;
 b=Fv9aimV5antFr3d7pJaFq1w68oojqPTnBwRE4ACPwK1MT9TUtudZqt/S2aW5IUZKX/
 WfW7d/WIzIdNpJBEW7Lir/yuuajgztvLUCjouUEoLk4xq8Wi5BIJhXpu2g1ZHPt5sIRf
 GxH/oeXzz4zbX1+9F/T+0RuA0Lt/u6MfiQrq8TxWguhIgKjGZiwK7LeVpRbtDe1gLE6m
 kupZoJB0PCUL0DCVppu0flx7Yd8G1sTOcyXkUmjWi8BtE3fV+QB6vG9XoFXzqndjd+ch
 9ZWKsxpA9Mr9GV3PGNvGZZTZ0uwwxMsatsU+7ecotEU2z7JjtNRFChS4x01RmFIRYe/R
 FD9g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=zrz9LrV2/bQSODpZY1ZVsu7qRnUWkihCx6irF8ySB1g=;
 b=v9UvOLtbTeRB6p0S68izyhnWhdrZND2xLhwGkiBJxwGbob05X5osf4qDQgtbPZtPem
 ed1POh7036O43EmlO/Yf0VJ4//Th2DstchCbxbKXrXqt8n213ghuYyAH373bZOd2VDtP
 aB9zGBgbl9+J0gxsaUTgL/DvemqieNqamwms0T4SdXUmQoQYg057IF80uHYARgBAg9i6
 /QyHGjQHGvmM/XEX9Baxjc9+GVEJHI7WfVPl8W0OTdPlmoMC8xd2PZVXGM1oX5FA65kc
 978B0h/s6ugZpgRhJu4RYmup+QcSnRSjHRZ6SF0hfi8XdXRJAXXOMaTlTvhGpg6ydQKk
 gZdw==
X-Gm-Message-State: AJIora/W8Ui4gRtLa0bH/KREfF6Mnz+LspQdkTCggVwXUZmbpPsbokCY
 +Q25fPzqkUNQ28zz0PQCmTsmWA==
X-Google-Smtp-Source: AGRyM1t5EdplPOXYCvuYXzG7yCl/HT29KFAevFzW3/F5KrZM3pRE75qK6WoizkWkagawP/OILTEnMw==
X-Received: by 2002:a63:480b:0:b0:40d:d4d1:7daf with SMTP id
 v11-20020a63480b000000b0040dd4d17dafmr26053627pga.512.1656952551624; 
 Mon, 04 Jul 2022 09:35:51 -0700 (PDT)
Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199])
 by smtp.gmail.com with ESMTPSA id
 c17-20020a170902d49100b0015e8d4eb1dbsm5491732plg.37.2022.07.04.09.35.50
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 04 Jul 2022 09:35:51 -0700 (PDT)
Date: Mon, 4 Jul 2022 09:35:48 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Long Li <longli@microsoft.com>
Cc: "longli@linuxonhyperv.com" <longli@linuxonhyperv.com>, Ferruh Yigit
 <ferruh.yigit@intel.com>, "dev@dpdk.org" <dev@dpdk.org>, Ajay Sharma
 <sharmaajay@microsoft.com>, Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH 01/17] net/mana: add basic driver, build environment and
 doc
Message-ID: <20220704093548.019ebbdf@hermes.local>
In-Reply-To: <PH7PR21MB32633E0C874B43B85C15B5FDCEBF9@PH7PR21MB3263.namprd21.prod.outlook.com>
References: <1656666167-26035-1-git-send-email-longli@linuxonhyperv.com>
 <1656666167-26035-2-git-send-email-longli@linuxonhyperv.com>
 <20220701094736.7d7589b5@hermes.local>
 <PH7PR21MB32633E0C874B43B85C15B5FDCEBF9@PH7PR21MB3263.namprd21.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
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

On Sun, 3 Jul 2022 07:56:18 +0000
Long Li <longli@microsoft.com> wrote:

> > Subject: Re: [PATCH 01/17] net/mana: add basic driver, build environment and
> > doc
> > 
> > On Fri,  1 Jul 2022 02:02:31 -0700
> > longli@linuxonhyperv.com wrote:
> >   
> > > +	uint64_t max_mr_size;
> > > +	rte_rwlock_t	mr_list_lock;
> > > +};  
> > 
> > Reader/Writer locks are slower for the usual uncontended case.
> > Unless you have a reader holding onto the lock for a long time, better to use
> > spin lock.
> > 
> > This is Linux wisdom (thank you paulmck), Windows seems to love reader/writer
> > locks.  
> 
> This lock is used mostly uncontended for readers and allow them concurrently to access the list. It's rare that a writer might want to access it.
> 
> But changing it to spinlock will prevent multiple readers from accessing the list at the same time. In this use case, is it beneficial to use spinlocks?

It all depends on how long the readers and writers hold the lock.
If the window is short a spin lock is faster.