From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 4689A2C49 for ; Thu, 9 Mar 2017 16:39:57 +0100 (CET) Received: by mail-wm0-f52.google.com with SMTP id t189so59073698wmt.1 for ; Thu, 09 Mar 2017 07:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=rJSN13xqtvVK97m07MRx5ai8V1Iimw0PNVXwtAGs91E=; b=ojcPht1g0jw9spdimRA/90nRIffgSETmhe/fF627rR3PYnGqDIG8YJF4tmYblFOLRw uY10LVGVxHklYYFewo1cMwjLWu93b3VOiYFGa4tv9RAsabvHVjP02YbusGy4O2CgXSx7 +H3JWRXRFSZhqCACtcsAyLZsZ3S+F/+REfStbXwzBqxp85R/wao1K3tP0AcfkpTSnkSO h7ehCy0eO4+NdQc/1nSSqj5ZlivLorbcCsbzKbn1ZuSEdA6YkaRBl206BaEv2ZwvI4Ei r7CoW5oKFRf+nynWktCTk7PRCjTj0jl6Mf3XdPKjE5S9a0k72qwZtEmFxG4JUjwKQChn DX5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=rJSN13xqtvVK97m07MRx5ai8V1Iimw0PNVXwtAGs91E=; b=t9iNTkUVOFsXfS1J1p65MGfqPYQ+CneRsfOMiNd0VUKSLZaJ2fIZDt3Cw8YBExhozh BJFak4ND6hMy5Yxc6T5dhCHE7UoIkj3HIonkyffEwVv8tPkCZgcrK3SV9KNA63TzPojw bTH0kTbWmt0Kw3qSn27suoeAVPT9qTchRkHz33b1Ev4EGAnpt65eWy2lGTpJnNeWpCqP oyn1jTAKe7hqvlmBRrI5Sx7oH1Y9NpOS/BC5lxTOVn7lyVhC5e1bkmUNDm0ka+heijQo HoFRr7BkGhUCfgaeONw7VvrPjtWZg3xmS4joCSYbasMThr/2kLv1S5KhgG9N5sIDHqfX bMbA== X-Gm-Message-State: AMke39lcYa4xe6aBkfon56sQ0hIXxsXYTkeI0i6S2K6dGYHok1QizDoCvtVYy0Wv+dJmBMpn X-Received: by 10.28.20.148 with SMTP id 142mr11497586wmu.134.1489073996819; Thu, 09 Mar 2017 07:39:56 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id x193sm9229169wme.23.2017.03.09.07.39.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 07:39:56 -0800 (PST) From: Thomas Monjalon To: Stephen Hemminger , "Hunt, David" , Nikhil Rao Cc: bruce.richardson@intel.com, Konstantin Ananyev , dev@dpdk.org Date: Thu, 09 Mar 2017 16:39:55 +0100 Message-ID: <2831675.mzhxhSnzbD@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20170210084644.52651be6@xeon-e3> References: <1475184293-18298-1-git-send-email-nikhil.rao@intel.com> <2295899.BebvH11edl@xps13> <20170210084644.52651be6@xeon-e3> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] eal: fix bug in x86 cmpset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 15:39:57 -0000 2017-02-10 08:46, Stephen Hemminger: > On Fri, 10 Feb 2017 11:53:06 +0100 > Thomas Monjalon wrote: > > > 2017-02-10 10:39, Hunt, David: > > > > > > On 9/2/2017 4:53 PM, Thomas Monjalon wrote: > > > > 2016-11-06 22:09, Thomas Monjalon: > > > >> 2016-09-29 18:34, Thomas Monjalon: > > > >>> 2016-09-30 02:54, Nikhil Rao: > > > >>>> The original code used movl instead of xchgl, this caused > > > >>>> rte_atomic64_cmpset to use ebx as the lower dword of the source > > > >>>> to cmpxchg8b instead of the lower dword of function argument "src". > > > >>> Could you please start the explanation with a statement of > > > >>> what is wrong from an user point of view? > > > >>> It could help to understand how severe it is. > > > >> Please, we need a clear explanation of the bug, and an acknowledgement. > > > > Should we close this bug? > > > > > > I took a few minutes to look at this, and the issue can easily be > > > reproduced with a small snippet of code. > > > With the 'mov', the lower dword of the result is incorrect. This is > > > resolved by using 'xchgl'. > > > > > > void main() > > > { > > > uint64_t a = 0xff000000ff; > > > > > > rte_atomic64_cmpset( &a, 0xff000000ff, 0xfa000000fa); > > > printf("0x%lx\n", a); > > > } > > > > > > When using 'mov', the result is 0xfa00000000 > > > When using 'xchgl', the result is 0xfa000000fa, as expected. > > > > This operation is used a lot in drivers for link status. > > > > I think we need to clearly explain what was the consequence of this bug. > > > A bigger issue is why there are a huge number of copies of the same link code > in drivers. Definitely should be common code. Also why is cmpset used here > when a simple atomic_set would work as well for what was intended. I'm surprised that there is no progress on this issue.