From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753208AbbC0Tlu (ORCPT ); Fri, 27 Mar 2015 15:41:50 -0400 Received: from resqmta-po-03v.sys.comcast.net ([96.114.154.162]:53999 "EHLO resqmta-po-03v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752974AbbC0Tlr (ORCPT ); Fri, 27 Mar 2015 15:41:47 -0400 Date: Fri, 27 Mar 2015 14:41:44 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: Steven Rostedt cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , stable@vger.kernel.org, Uwe Kleine-Koenig Subject: Re: [for-next][PATCH 1/4] ring-buffer: Replace this_cpu_*() with __this_cpu_*() In-Reply-To: <20150325130037.896265791@goodmis.org> Message-ID: References: <20150325130011.709478161@goodmis.org> <20150325130037.896265791@goodmis.org> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Mar 2015, Steven Rostedt wrote: > It has come to my attention that this_cpu_read/write are horrible on > architectures other than x86. Worse yet, they actually disable > preemption or interrupts! This caused some unexpected tracing results > on ARM. This isnt something new and I thought the comment was dropped from the patch? This is a plain error in using this_cpu_* where __this_cpu_* would have been sufficient. Code was uselessly disabling preemption twice. > Which is unacceptable for locations that know they are within preempt > disabled or interrupt disabled locations. Well yes. Thats why the __this_cpu ops are there to avoid this overhead. > I also changed the recursive_unlock() to use two local variables instead > of accessing the per_cpu variable twice. Ok gotta look at that. > static __always_inline void trace_recursive_unlock(void) > { > - unsigned int val = this_cpu_read(current_context); > + unsigned int val = __this_cpu_read(current_context); > > - val--; > - val &= this_cpu_read(current_context); > - this_cpu_write(current_context, val); > + val &= val & (val - 1); > + __this_cpu_write(current_context, val); > } Ummm... This is does not look like an equivalent thing. Should this not be: unsigned int val = __this_cpu_read(current_context); unsigned int newval = val - 1; newval &= val; __this_cpu_write(current_context, newval); or more compact unsigned int val = __this_cpu_read(current_context); __this_cpu_write(current_context, val & (val - 1));