From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756155Ab0JSWX3 (ORCPT ); Tue, 19 Oct 2010 18:23:29 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:46579 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755903Ab0JSWX1 (ORCPT ); Tue, 19 Oct 2010 18:23:27 -0400 X-Authority-Analysis: v=1.1 cv=6ptpMFIBtxRk0xdOb6IhJTbTLVRlKjWFes7R4SsWCrA= c=1 sm=0 a=wGm5nfgfXM4A:10 a=Q9fys5e9bTEA:10 a=OPBmh+XkhLl+Enan7BmTLg==:17 a=nlXyqv6Ji1_L9UEWfycA:9 a=ivUtSdx0CHJyJC_S2HUA:7 a=rK7F48Nc4A8usy2HFYfu_w5_Sn8A:4 a=PUjeQqilurYA:10 a=OPBmh+XkhLl+Enan7BmTLg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 67.242.120.143 Subject: Re: [PATCH] tracing: Cleanup the convoluted softirq tracepoints From: Steven Rostedt To: "H. Peter Anvin" Cc: Thomas Gleixner , Mathieu Desnoyers , Koki Sanagi , Peter Zijlstra , Ingo Molnar , Frederic Weisbecker , nhorman@tuxdriver.com, scott.a.mcmillan@intel.com, laijs@cn.fujitsu.com, LKML , eric.dumazet@gmail.com, kaneshige.kenji@jp.fujitsu.com, David Miller , izumi.taku@jp.fujitsu.com, kosaki.motohiro@jp.fujitsu.com, Heiko Carstens , "Luck, Tony" In-Reply-To: <4CBE122B.9020807@zytor.com> References: <20100908112529.GA25931@elte.hu> <1287395077.29097.1543.camel@twins> <1287398936.29097.1548.camel@twins> <4CBD79CF.2060706@jp.fujitsu.com> <20101019132236.GA19197@Krystal> <1287496495.16971.372.camel@gandalf.stny.rr.com> <20101019142820.GA14520@Krystal> <1287521757.16971.397.camel@gandalf.stny.rr.com> <1287523439.16971.433.camel@gandalf.stny.rr.com> <4CBE122B.9020807@zytor.com> Content-Type: text/plain; charset="ISO-8859-15" Date: Tue, 19 Oct 2010 18:23:25 -0400 Message-ID: <1287527005.16971.527.camel@gandalf.stny.rr.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2010-10-19 at 14:48 -0700, H. Peter Anvin wrote: > On 10/19/2010 02:23 PM, Steven Rostedt wrote: > > > > But it seemed that gcc for you inlined the code in the wrong spot. > > Perhaps it's not a good idea to have the something like h - softirq_vec > > in the parameter of the tracepoint. Not saying that your change is not > > worth it. It is, because h - softirq_vec is used by others now too. > > > > OK, first of all, there are some serious WTFs here: > > # define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t" > > A jump instruction is one of the worst possible NOPs. Why are we doing > this? Good question. Safety? Jason? This is the initial jumps and are converted on boot up to a better nop. > > The second thing that I found when implementing static_cpu_has() was > that it is actually better to encapsulate the asm goto in a small inline > which returns bool (true/false) -- gcc will happily optimize out the > variable and only see it as a flow of control thing. I would be very > curious if that wouldn't make gcc generate better code in cases like that. > > gcc 4.5.0 has a bug in that there must be a flowthrough case in the asm > goto (you can't have it unconditionally branch one way or the other), so > that should be the likely case and accordingly it should be annotated > likely() so that gcc doesn't reorder. I suspect in the end one ends up > with code like this: > > static __always_inline __pure bool __switch_point(...) > { > asm goto("1: " JUMP_LABEL_INITIAL_NOP > /* ... patching stuff */ > : : : : t_jump); > return false; > t_jump: > return true; > } > > #define SWITCH_POINT(x) unlikely(__switch_point(x)) > > I *suspect* this will resolve the need for hot/cold labels just fine. Interesting, we could try this. Thanks! -- Steve