From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by dpdk.org (Postfix) with ESMTP id A0C0F58D6 for ; Fri, 20 Dec 2013 16:38:01 +0100 (CET) Received: by mail-we0-f181.google.com with SMTP id x55so2563277wes.26 for ; Fri, 20 Dec 2013 07:39:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:organization:to:subject:date:user-agent:cc :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=3EpA7kEhMO6JGadfYvL2dZW0P6pheiD1+p1+ChaHu8Q=; b=UvkDIx+oKL2024NLbNy/AO1po5bhTGWnKEhHVfDESKgqUtc9e7BLCBkN/p8usKpdnB qIaRwMTCfsnpSes8MILKA6Be8qAQzpgZ29tziFUIPLIA92xoC0BldbFXm5NF7T/dZKJW TTYarkUdTCE5OFvX3b80yyBrX7Fl/5UfF13SOAreRIXTiDCgjbtvhG2QjJHC3Gw4aX7f 4SjGxdcVUT2FZFnnlFpUQ3sRFrw54dejraoIzgIF6JHQvco5oF5n+vT4MAoJ93Mx1yXI U/nGIYJ4MovcNM9rWc7bZFaAIuRIzzH4WWkr1H07oeUQqeoUNSGJvYuI49VAs5anvuue e69Q== X-Gm-Message-State: ALoCoQlZzfUK5G0rHEGeJxaXLWu7oq6cwqekDz5OqmcvY7IPXrUPjZXACsoO7wLvjfaomSnVakrF X-Received: by 10.194.104.66 with SMTP id gc2mr2681966wjb.75.1387553948281; Fri, 20 Dec 2013 07:39:08 -0800 (PST) Received: from angus.localnet (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id cx3sm18169686wib.0.2013.12.20.07.39.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2013 07:39:07 -0800 (PST) From: Thomas Monjalon Organization: 6WIND To: "=?iso-8859-1?q?Fran=E7ois-Fr=E9d=E9ric?= Ozog" Date: Fri, 20 Dec 2013 16:39:05 +0100 User-Agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; ) References: <6895EAE0CA8DEE40B92D7CA88BB521F332BA572E6B@HQ1-EXCH02.corp.brocade.com> <4656219.tgqzelRNOJ@x220> <01d001cef375$7167e300$5437a900$@com> In-Reply-To: <01d001cef375$7167e300$5437a900$@com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <201312201639.05277.thomas.monjalon@6wind.com> Cc: dev@dpdk.org Subject: Re: [dpdk-dev] Bit spinlocks in DPDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Dec 2013 15:38:03 -0000 Hello, 07/12/2013 18:54, Fran=E7ois-Fr=E9d=E9ric Ozog : > 1) If the critical section deals with weakly ordered loads then explicit > fencing MUST be used: if not, out of order execution will just kill your > idea of critical section. [...] > So use rte_mb() or rte_wmb() or rte_rmb() where appropriate. I recommend > the rte_unlock code and documentation explains the out of order execution > issues and the conditions they have to be mitigated with rte*mb(). I > wonder if having an explicit mfence in rte_sinlock_unlock wouldn't be just > necessary to avoid "hairy" bugs. In addition, we would have > rte_sinlock_unlock_no_mb used internally for performance reasons, and > usable externally by advanced users. Using lock prefix is lighter than using memory barrier and have the same=20 effects. But you're right about the bug in spinlocks. I am going to send a patch for this. =2D-=20 Thomas