Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9304853ybl; Wed, 25 Dec 2019 18:47:22 -0800 (PST) X-Google-Smtp-Source: APXvYqy8dwDvP1ZZ0SYgr/fAGb5sjmPigdKXM0xiAvCto3+xwgk8tS3BePRr/gXa5DlyreqdmqE5 X-Received: by 2002:a05:6830:3c3:: with SMTP id p3mr31513949otc.146.1577328442595; Wed, 25 Dec 2019 18:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577328442; cv=none; d=google.com; s=arc-20160816; b=Uud8SEaLeMmF/DM4qroCXuu9Xl5AkXXuQfMSQlXqAOUl9CifJZPdF/erbdJO4EgqIU muqX03Wm6XcqeuGaqbXpg3qecEvp24U5BXkjMTIHD3sBY/DWeCdGVkrkWPdSgam3us1f UE55siU3myMLOZEX2U/HkMvEG00JWb0/HVPtjN3xAstyPr8JSN4jsG3L0kjOdwQXAKYv 7aMykK1jg2QpFL84HTKnGmTVFcweaAW+PZjT65QImB4G0bzv3qJ7aUI54nl87C7zum/a 3IX2tAtrfnCrH38hN7cmYdtqIPlVzjFLH5gGMs3rP9c5mHxShueyg28UldwJm3Nc0hRp YPTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=9V6pyMnbwq6zG0FxWtas9X9bH9ZDOrg8SgMVsALL4lg=; b=ukeDH1ykuCMydBNqebEaEJvjRjlr8w5XLtRZSsjLD1TnMMR2FpEk3IG30D5vzoioqV fFJAzAOLMisfAWRTCjmlaZHYflF6UwOdJzXAaNfFL6k5ZfHSFWurqNnpZo8aDnpRfp+u B2ZbNeFvayzcXs0RdWv68IoBI6hpNpQocFu4tCrcwgNr6v3VkLjqZGcxAbrurJekX8jC sZzAUET0n0mJo6QgYnJRokblHKR1w0zlYBW6arCFAxOODf3HvtEQYNo5r/suYsX17a3z YUiQpaSYZ1v1QncvhwObjL8y7wOvedcyVY6hjKMiA6V8HmhlXN5n+RW1YZThF+dF0T74 gudQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="sw/DrybP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si13380720oig.123.2019.12.25.18.47.09; Wed, 25 Dec 2019 18:47:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="sw/DrybP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbfLZCpx (ORCPT + 99 others); Wed, 25 Dec 2019 21:45:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:50342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbfLZCpx (ORCPT ); Wed, 25 Dec 2019 21:45:53 -0500 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C0B762075B; Thu, 26 Dec 2019 02:45:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577328352; bh=yv/C6ljrIx/+HyZFKoUjNShUUTPWwuzsvZUkhYKmp/U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sw/DrybP2qxeugrbQatqVZwWIem16gtpKDpAM5KEYW+DDcj0+ciN5hUIHYRnqLMG4 a/xVf3l2RMRBwhyIDMOaGzjFMpQ0i0RUWT525uT2XvUNfe8fa5pLiSAQE5t3cFIH2i js6ogOvSBDDeV5fmYqrUHt/HX0INiiU73O+3rGow= Date: Thu, 26 Dec 2019 11:45:47 +0900 From: Masami Hiramatsu To: Jisheng Zhang Cc: Catalin Marinas , Will Deacon , Steven Rostedt , Ingo Molnar , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Mark Rutland , Jonathan Corbet , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-doc@vger.kernel.org" Subject: Re: [PATCH v7 2/3] ftrace: introduce FTRACE_IP_EXTENSION Message-Id: <20191226114547.bb5bc2d5ae5ecf6290a90fa7@kernel.org> In-Reply-To: <20191225172836.7f381759@xhacker.debian> References: <20191225172625.69811b3e@xhacker.debian> <20191225172836.7f381759@xhacker.debian> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Dec 2019 09:42:52 +0000 Jisheng Zhang wrote: > On some architectures, the DYNAMIC_FTRACE_WITH_REGS is implemented by > gcc's -fpatchable-function-entry option. Take arm64 for example, arm64 > makes use of GCC -fpatchable-function-entry=2 option to insert two > nops. When the function is traced, the first nop will be modified to > the LR saver, then the second nop to "bl ". we need to > update ftrace_location() to recognise these two instructions as being > part of ftrace. To do this, we introduce FTRACE_IP_EXTENSION to let > ftrace_location search IP, IP + FTRACE_IP_EXTENSION range. > Looks good to me. Reviewed-by: Masami Hiramatsu Thanks! > Signed-off-by: Jisheng Zhang > Suggested-by: Steven Rostedt (VMware) > --- > include/linux/ftrace.h | 4 ++++ > kernel/trace/ftrace.c | 2 +- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > index 7247d35c3d16..05a03b2a2f39 100644 > --- a/include/linux/ftrace.h > +++ b/include/linux/ftrace.h > @@ -20,6 +20,10 @@ > > #include > > +#ifndef FTRACE_IP_EXTENSION > +#define FTRACE_IP_EXTENSION 0 > +#endif > + > /* > * If the arch supports passing the variable contents of > * function_trace_op as the third parameter back from the > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 74439ab5c2b6..a8cfea502369 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -1590,7 +1590,7 @@ unsigned long ftrace_location_range(unsigned long start, unsigned long end) > */ > unsigned long ftrace_location(unsigned long ip) > { > - return ftrace_location_range(ip, ip); > + return ftrace_location_range(ip, ip + FTRACE_IP_EXTENSION); > } > > /** > -- > 2.24.1 > -- Masami Hiramatsu