From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752658AbaAXE3y (ORCPT ); Thu, 23 Jan 2014 23:29:54 -0500 Received: from g5t0009.atlanta.hp.com ([15.192.0.46]:6851 "EHLO g5t0009.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752253AbaAXE3f (ORCPT ); Thu, 23 Jan 2014 23:29:35 -0500 From: Waiman Long To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Arnd Bergmann Cc: linux-arch@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Steven Rostedt , Andrew Morton , Michel Lespinasse , Andi Kleen , Rik van Riel , "Paul E. McKenney" , Linus Torvalds , Raghavendra K T , George Spelvin , Tim Chen , "Aswin Chandramouleeswaran\"" , Scott J Norton , Waiman Long Subject: [PATCH v11 3/4] qrwlock, x86: Add char and short as atomic data type in x86 Date: Thu, 23 Jan 2014 23:28:50 -0500 Message-Id: <1390537731-45996-4-git-send-email-Waiman.Long@hp.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1390537731-45996-1-git-send-email-Waiman.Long@hp.com> References: <1390537731-45996-1-git-send-email-Waiman.Long@hp.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generic __native_word() macro defined in include/linux/compiler.h only allows "int" and "long" data types to be treated as native and atomic. The x86 architecture, however, allow the use of char and short data types as atomic as well. This patch extends the data type allowed in the __native_word() macro to allow the use of char and short for the x86 architecture. Signed-off-by: Waiman Long --- arch/x86/include/asm/barrier.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h index 04a4890..0149a66 100644 --- a/arch/x86/include/asm/barrier.h +++ b/arch/x86/include/asm/barrier.h @@ -24,6 +24,24 @@ #define wmb() asm volatile("sfence" ::: "memory") #endif +/* + * Define x86 specific atomic types that can be used in read_acquire + * and store_release barriers. + */ +#define __arch_native_word(t) (sizeof(t) == sizeof(char) || \ + sizeof(t) == sizeof(short) || \ + sizeof(t) == sizeof(int) || \ + sizeof(t) == sizeof(long)) +/* + * Due to cyclic header file dependency problem, the only way to modify + * the behavior of __native_word() macro within + * compiletime_assert_atomic_type() is to redefine it. + */ +#ifdef __native_word +#undef __native_word +#endif +#define __native_word(t) __arch_native_word(t) + /** * read_barrier_depends - Flush all pending reads that subsequents reads * depend on. -- 1.7.1