Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752975AbYKZGwo (ORCPT ); Wed, 26 Nov 2008 01:52:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750916AbYKZGwf (ORCPT ); Wed, 26 Nov 2008 01:52:35 -0500 Received: from wf-out-1314.google.com ([209.85.200.175]:24833 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750696AbYKZGwf (ORCPT ); Wed, 26 Nov 2008 01:52:35 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=Bv4ReReDuoX6TzB21KDUb5dhEwrFsMaHoZyZfFijy3krkgQ5nY985dehWJeJDwYS36 GtO1LGHblHpFpMzoEd+2F9MzBACf6gBTu6S4wg+o/P5865alpfc4GbzuPTLQ11o68DUr IEScpH5X/9QSAG0Fof6FxWrTQtve2BIlB/Elk= Subject: Re: [PATCH 2/5] ftrace: use code patching for ftrace graph tracer From: Harvey Harrison To: Andrew Morton Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Ingo Molnar , Frederic Weisbecker , containers@lists.osdl.org, Sukadev Bhattiprolu , "Serge E. Hallyn" , "Eric W. Biederman" , Steven Rostedt In-Reply-To: <20081125213546.ff4eddf4.akpm@linux-foundation.org> References: <20081126051622.134970943@goodmis.org> <20081126051709.774546196@goodmis.org> <20081125213546.ff4eddf4.akpm@linux-foundation.org> Content-Type: text/plain Date: Tue, 25 Nov 2008 22:52:29 -0800 Message-Id: <1227682349.5511.47.camel@brick> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1864 Lines: 57 On Tue, 2008-11-25 at 21:35 -0800, Andrew Morton wrote: > On Wed, 26 Nov 2008 00:16:24 -0500 Steven Rostedt wrote: > > > From: Steven Rostedt > > > > Impact: more efficient code for ftrace graph tracer > > > > This patch uses the dynamic patching, when available, to patch > > the function graph code into the kernel. > > > > This patch will ease the way for letting both function tracing > > and function graph tracing run together. > > > > ... > > > > +static int ftrace_mod_jmp(unsigned long ip, > > + int old_offset, int new_offset) > > +{ > > + unsigned char code[MCOUNT_INSN_SIZE]; > > + > > + if (probe_kernel_read(code, (void *)ip, MCOUNT_INSN_SIZE)) > > + return -EFAULT; > > + > > + if (code[0] != 0xe9 || old_offset != *(int *)(&code[1])) > > erk. I suspect that there's a nicer way of doing this amongst our > forest of get_unaligned_foo() interfaces. Harvey will know. > if (code[0] != 0xe9 || old_offset != get_unaligned((int *)(&code[1]))) > > + return -EINVAL; > > + > > + *(int *)(&code[1]) = new_offset; > > Might be able to use put_unaligned_foo() here. > put_unaligned(new_offset, (int *)(&code[1])); > The problem is that these functions use sizeof(*ptr) to work out what > to do, so a cast is still needed. A get_unaligned32(ptr) would be > nice. One which takes a void* and assumes CPU ordering. I've been thinking similarly, I could investigate something that goes in with the _noalign stuff? I'll finish the documentation patch for the _noalign stuff and then see about doing the host-order bits to fit in as well. Harvey -- 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/