From patchwork Thu Sep 29 21:24:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rao, Nikhil" X-Patchwork-Id: 16227 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7A4F756A1; Thu, 29 Sep 2016 14:54:31 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 958A3568A for ; Thu, 29 Sep 2016 14:54:29 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 29 Sep 2016 05:54:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,415,1470726000"; d="scan'208"; a="1038136311" Received: from unknown (HELO localhost.iind.intel.com) ([10.224.122.216]) by orsmga001.jf.intel.com with ESMTP; 29 Sep 2016 05:54:27 -0700 From: Nikhil Rao To: dev@dpdk.org Cc: Nikhil Rao Date: Fri, 30 Sep 2016 02:54:53 +0530 Message-Id: <1475184293-18298-1-git-send-email-nikhil.rao@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] eal: fix bug in x86 cmpset 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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". Reported-by: Job Abraham Tested-by: Job Abraham Signed-off-by: Nikhil Rao Acked-by: Bruce Richardson --- lib/librte_eal/common/include/arch/x86/rte_atomic_32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/common/include/arch/x86/rte_atomic_32.h b/lib/librte_eal/common/include/arch/x86/rte_atomic_32.h index 2e04c75..fb3abf1 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_atomic_32.h +++ b/lib/librte_eal/common/include/arch/x86/rte_atomic_32.h @@ -81,7 +81,7 @@ rte_atomic64_cmpset(volatile uint64_t *dst, uint64_t exp, uint64_t src) : "memory" ); /* no-clobber list */ #else asm volatile ( - "mov %%ebx, %%edi\n" + "xchgl %%ebx, %%edi;\n" MPLOCKED "cmpxchg8b (%[dst]);" "setz %[res];"