Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757899AbYHHSSU (ORCPT ); Fri, 8 Aug 2008 14:18:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752564AbYHHSSI (ORCPT ); Fri, 8 Aug 2008 14:18:08 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:39861 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbYHHSSH (ORCPT ); Fri, 8 Aug 2008 14:18:07 -0400 Subject: Re: [PATCH 0/5] ftrace: to kill a daemon From: Peter Zijlstra To: Steven Rostedt Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Andrew Morton , Linus Torvalds , David Miller , Roland McGrath , Ulrich Drepper , Rusty Russell , Jeremy Fitzhardinge , Gregory Haskins , Arnaldo Carvalho de Melo , "Luis Claudio R. Goncalves" , Clark Williams In-Reply-To: References: <20080807182013.984175558@goodmis.org> <20080807184741.GB18164@Krystal> <20080808172259.GB8244@Krystal> <20080808174607.GG8244@Krystal> Content-Type: text/plain Date: Fri, 08 Aug 2008 20:15:41 +0200 Message-Id: <1218219341.29098.6.camel@lappy.programming.kicks-ass.net> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2333 Lines: 63 On Fri, 2008-08-08 at 14:13 -0400, Steven Rostedt wrote: > On Fri, 8 Aug 2008, Mathieu Desnoyers wrote: > > * Steven Rostedt (rostedt@goodmis.org) wrote: > > > > > > On Fri, 8 Aug 2008, Mathieu Desnoyers wrote: > > > > * Steven Rostedt (rostedt@goodmis.org) wrote: > > > > > > > > > > I originally used jumps instead of nops, but unfortunately, they actually > > > > > hurt performance more than adding nops. Ingo told me it was probably due > > > > > to using up the jump predictions of the CPU. > > > > > > > > > > > > > Hrm, are you sure you use a single 5-bytes nop instruction then, or do > > > > you use a mix of various nop sizes (add_nops) on some architectures ? > > > > > > I use (for x86) what is in include/asm-x86/nops.h depending on what the > > > cpuid gives us. > > > > > > > That's bad : > > > > #define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4 > > > > #define K8_NOP5 K8_NOP3 K8_NOP2 > > > > #define K7_NOP5 K7_NOP4 ASM_NOP1 > > > > So, when you try, later, to replace these instructions with a single > > 5-bytes instruction, a preempted thread could iret in the middle of your > > 5-bytes insn and cause an illegal instruction ? > > That's why I use kstop_machine. > > > > > > > > > > > > > You can consume the branch prediction buffers for conditional branches, > > > > but I doubt static jumps have this impact ? I don't see what "jump > > > > predictions" you are referring to here exactly. > > > > > > I don't know the details, but we definitely saw a drop in preformance > > > between using nops and static jumps. > > > > > > > Generated by replacing all the call by 5-bytes jumps e9 00 00 00 00 > > instead of the 5-bytes add_nops ? On which architectures ? > > > > I ran this on my Dell (intel Xeon), which IIRC did show the performance > degration. I unfortunately don't have the time to redo those tests, but > you are welcome to. > > Just look at arch/x86/kernel/ftrace.c and replace the nop with the jump. > In fact, the comments in that file still say it is a jmp. Remember, my > first go was to use the jmp. 5 single byte nops? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/