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 2486643C46; Tue, 5 Mar 2024 22:02:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAE0A402AC; Tue, 5 Mar 2024 22:02:28 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A38AB40270 for ; Tue, 5 Mar 2024 22:02:26 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id A362C20B74C0; Tue, 5 Mar 2024 13:02:25 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A362C20B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709672545; bh=qYZzZKY+UOKU60/+iKLDKi669PMzLgzsrfbWsvQZ3qg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bixv1bAHMEBiHsJ+BJ896Ppn69SJ8C9wWJT1FeVoj/vkJuJRQi4v9QYP17sSCNsM9 AeWLFaZWvsjoPPjhBYoJjN9xc8pr5qG83HbUV4N2I6NocI31hEXUHWaw+dSw5hEskd gYkkfWf6dkVpbvzqYNILGcsEGTq+eX/IUk8KIcxc= Date: Tue, 5 Mar 2024 13:02:25 -0800 From: Tyler Retzlaff To: Mattias =?iso-8859-1?Q?R=F6nnblom?= Cc: "dev@dpdk.org" Subject: Re: RTE lock Message-ID: <20240305210225.GA16095@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <0024db51-8b39-4aa7-969a-bde86fe1c764@lysator.liu.se> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0024db51-8b39-4aa7-969a-bde86fe1c764@lysator.liu.se> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Tue, Mar 05, 2024 at 09:18:20PM +0100, Mattias Rönnblom wrote: > Shouldn't we have a DPDK-native mutex API, rather than using direct > POSIX mutex lock calls? David raised this a while back and the consensus is yes. I admit it's been on my radar for a long time for the obvious reasons you list below but with other work hasn't been a priority (yet). > > There are two reasons for this, as I see it > 1) more cleanly support non-POSIX operating system (i.e., Microsoft > Windows). > 2) to discourage mechanical use of spinlocks in places where a > regular mutex lock is more appropriate. > > I think (and hope) DPDK developers will tend to pick DPDK-native > rather than other APIs as their first choice. I spent some time evaluating C11 mutex but it really didn't strike me as being fit for purpose so I think DPDK-native is probably the only way to go. If behind the scenes particular locks relied on something standard for Windows perhaps it could be hidden as an implementation detail. > > For locks, they go for spinlocks, even in control (non-fast > path/non-packet processing) code paths (e.g., calls made by the > typical non-EAL thread). > > Using spinlocks to synchronize threads that may be preempted aren't > great idea. If you're thinking of looking into this i'd be happy to see it solved. ty