From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 231CC2A5E for ; Fri, 10 Feb 2017 12:56:31 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 10 Feb 2017 03:56:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,141,1484035200"; d="scan'208";a="42510181" Received: from dhunt5-mobl.ger.corp.intel.com (HELO [10.237.221.69]) ([10.237.221.69]) by orsmga002.jf.intel.com with ESMTP; 10 Feb 2017 03:56:29 -0800 To: Thomas Monjalon References: <1475184293-18298-1-git-send-email-nikhil.rao@intel.com> <1919498.PKpEFfz702@xps13> <2295899.BebvH11edl@xps13> Cc: Nikhil Rao , bruce.richardson@intel.com, Konstantin Ananyev , dev@dpdk.org From: "Hunt, David" Message-ID: Date: Fri, 10 Feb 2017 11:56:27 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <2295899.BebvH11edl@xps13> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Fri, 10 Feb 2017 11:56:32 -0000 On 10/2/2017 10:53 AM, 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. Agreed. It's probably also worth noting that its only on the __PIC__ enabled codepath so would have more of an affect on the distros.