From mboxrd@z Thu Jan 1 00:00:00 1970 From: Waiman Long Subject: [PATCH v9 3/5] qrwlock, x86 - Treat all data type not bigger than long as atomic in x86 Date: Tue, 14 Jan 2014 23:44:05 -0500 Message-ID: <1389761047-47566-4-git-send-email-Waiman.Long@hp.com> References: <1389761047-47566-1-git-send-email-Waiman.Long@hp.com> Return-path: In-Reply-To: <1389761047-47566-1-git-send-email-Waiman.Long@hp.com> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-arch.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. Signed-off-by: Waiman Long --- arch/x86/include/asm/barrier.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h index 04a4890..4d3e30a 100644 --- a/arch/x86/include/asm/barrier.h +++ b/arch/x86/include/asm/barrier.h @@ -24,6 +24,14 @@ #define wmb() asm volatile("sfence" ::: "memory") #endif +/* + * All data types <= long are atomic in x86 + */ +#ifdef __native_word +#undef __native_word +#endif +#define __native_word(t) (sizeof(t) <= sizeof(long)) + /** * read_barrier_depends - Flush all pending reads that subsequents reads * depend on. -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g5t0009.atlanta.hp.com ([15.192.0.46]:12282 "EHLO g5t0009.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbaAOEob (ORCPT ); Tue, 14 Jan 2014 23:44:31 -0500 From: Waiman Long Subject: [PATCH v9 3/5] qrwlock, x86 - Treat all data type not bigger than long as atomic in x86 Date: Tue, 14 Jan 2014 23:44:05 -0500 Message-ID: <1389761047-47566-4-git-send-email-Waiman.Long@hp.com> In-Reply-To: <1389761047-47566-1-git-send-email-Waiman.Long@hp.com> References: <1389761047-47566-1-git-send-email-Waiman.Long@hp.com> Sender: linux-arch-owner@vger.kernel.org List-ID: 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 Message-ID: <20140115044405.CB7tzug0SG_fYHcHnZ_5TV8dP1QuP9oaCWnZiu5lu_k@z> 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. Signed-off-by: Waiman Long --- arch/x86/include/asm/barrier.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h index 04a4890..4d3e30a 100644 --- a/arch/x86/include/asm/barrier.h +++ b/arch/x86/include/asm/barrier.h @@ -24,6 +24,14 @@ #define wmb() asm volatile("sfence" ::: "memory") #endif +/* + * All data types <= long are atomic in x86 + */ +#ifdef __native_word +#undef __native_word +#endif +#define __native_word(t) (sizeof(t) <= sizeof(long)) + /** * read_barrier_depends - Flush all pending reads that subsequents reads * depend on. -- 1.7.1