From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753471AbbC0ULo (ORCPT ); Fri, 27 Mar 2015 16:11:44 -0400 Received: from smtprelay0133.hostedemail.com ([216.40.44.133]:36241 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752198AbbC0ULl (ORCPT ); Fri, 27 Mar 2015 16:11:41 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 40,2.5,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2893:2904:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4362:5007:6119:6261:7875:7903:9040:10004:10400:10848:10967:11026:11232:11658:11914:12043:12109:12296:12438:12517:12519:12740:13161:13229:14096:14097:21080:21088,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: love35_e7557f1d644e X-Filterd-Recvd-Size: 3261 Date: Fri, 27 Mar 2015 16:11:33 -0400 From: Steven Rostedt To: Christoph Lameter 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_*() Message-ID: <20150327161133.505d4074@gandalf.local.home> In-Reply-To: References: <20150325130011.709478161@goodmis.org> <20150325130037.896265791@goodmis.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 27 Mar 2015 14:41:44 -0500 (CDT) Christoph Lameter wrote: > 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. > Where in the patch do you see the comment? Or were you talking about the change log? The original patch did have a comment, an it was dropped, that's what I thought you were talking about. > > 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); Actually, it is equivalent, but I do see a issue with my patch. val &= val & (val - 1); is the same as the more reasonable: val &= val - 1; I think I meant to replace &= with = :-/ > > or more compact > > unsigned int val = __this_cpu_read(current_context); > > __this_cpu_write(current_context, val & (val - 1)); Maybe I'll just use your compact version. Thanks, -- Steve