From patchwork Fri Jul 17 15:34:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jungseok Lee X-Patchwork-Id: 6816851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5EA849F2E8 for ; Fri, 17 Jul 2015 15:36:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C534207BF for ; Fri, 17 Jul 2015 15:36:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A53E207BD for ; Fri, 17 Jul 2015 15:36:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZG7f1-0004RH-AF; Fri, 17 Jul 2015 15:34:51 +0000 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZG7ey-0004II-3E for linux-arm-kernel@lists.infradead.org; Fri, 17 Jul 2015 15:34:48 +0000 Received: by pdbqm3 with SMTP id qm3so63553539pdb.0 for ; Fri, 17 Jul 2015 08:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/lXSVlGVhoyX8WHDPbuP+WiDiYsnY6Kgj+mPoD2NPOU=; b=dy4cDHWD+mUUgIcPJB4jdf5cUqXs2v0VONtxGqsdkkw8UqlITEYXCU+QkS5lgDiXsW qiQEOlBxc5UwOf6G9xRDhqrhugaoXX+wBGL6BNcL4w97/Wn9zSF3/gHv8gWtP1yt5T4r jWjc48AdqKNVMmHKJvy7CjBK/2BPJfsWlnDVI1po4qpzZmLOoGcPRK3G4gScyHLuDNvn lgUx3vjV2L6nN8Exl40LEVcyPmFftB+p6KJY1SzcKWrlbkXDwpjDKH95fuJsIkMzv36m jFAzu+qkaJcWVWDVM8++AocnOlPCrF+GSk6qcGRfNFBT8PzR2k2IderdI43JnexAy+Wh aZvw== X-Received: by 10.70.137.39 with SMTP id qf7mr31312000pdb.39.1437147267356; Fri, 17 Jul 2015 08:34:27 -0700 (PDT) Received: from [192.168.123.119] ([116.121.77.221]) by smtp.gmail.com with ESMTPSA id pz5sm11625429pdb.27.2015.07.17.08.34.24 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jul 2015 08:34:26 -0700 (PDT) Subject: Re: [RFC 2/3] arm64: refactor save_stack_trace() Mime-Version: 1.0 (Apple Message framework v1283) From: Jungseok Lee In-Reply-To: <0886A996-40E1-49E9-823C-85E55A858716@gmail.com> Date: Sat, 18 Jul 2015 00:34:21 +0900 Message-Id: <1357EA74-B972-4B99-ADB0-BC7E8F06DDB5@gmail.com> References: <55A646EE.6030402@linaro.org> <20150715105536.42949ea9@gandalf.local.home> <20150715121337.3b31aa84@gandalf.local.home> <55A6FA82.9000901@linaro.org> <55A703F3.8050203@linaro.org> <20150716102405.2cc8c406@gandalf.local.home> <12F47692-3010-4886-B87D-3D7820609177@gmail.com> <20150716113115.45a17f17@gandalf.local.home> <20150716121658.7982fdf5@gandalf.local.home> <20150717124054.GE26091@leverpostej> <20150717090009.720f6bd0@gandalf.local.home> <77EA0F10-D5F6-48BD-8652-3B979A978659@gmail.com> <20150717104144.6588b2f7@gandalf.local.home> <0886A996-40E1-49E9-823C-85E55A858716@gmail.com> To: Steven Rostedt X-Mailer: Apple Mail (2.1283) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150717_083448_171262_2E8EADEE X-CRM114-Status: GOOD ( 17.59 ) X-Spam-Score: -1.8 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , Will Deacon , "linux-kernel@vger.kernel.org" , AKASHI Takahiro , "broonie@kernel.org" , "david.griego@linaro.org" , "olof@lixom.net" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Jul 17, 2015, at 11:59 PM, Jungseok Lee wrote: > On Jul 17, 2015, at 11:41 PM, Steven Rostedt wrote: >> On Fri, 17 Jul 2015 23:28:13 +0900 >> Jungseok Lee wrote: >> >> >>> >>> I have reviewed and tested the kernel including this patch and only [RFC 1/3]. >> >> Thanks! Can you repost patch 1 with the changes I recommended, so that >> I can get an Acked-by from the arm64 maintainers and pull all the >> changes in together. This is fine for a 4.3 release, right? That is, it >> doesn't need to go into 4.2-rcs. >> > > Welcome! > > It's not hard to repost a patch, but I feel like we have to wait for Akashi's response. > Also, it might be needed to consider Mark's comment on arch part. > > If they are okay, I will proceed. Akashi and Mark, The [RFC 1/3] patch used in my environment is shaped as follows. I leave the hunk for *only* clear synchronization. This is why I choose this format instead of reposting a patch. I hope it would help to track down this thread. Steve, I think this is my best at this point. Best Regards Jungseok Lee ----8<---- ----8<---- diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index c5534fa..2b43e20 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -13,8 +13,9 @@ #include -#define MCOUNT_ADDR ((unsigned long)_mcount) -#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE +#define MCOUNT_ADDR ((unsigned long)_mcount) +#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE +#define FTRACE_STACK_FRAME_OFFSET AARCH64_INSN_SIZE #ifndef __ASSEMBLY__ #include diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 407991b..9ab67af 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -20,6 +20,7 @@ #include #include +#include #include /* @@ -52,7 +53,7 @@ int notrace unwind_frame(struct stackframe *frame) * -4 here because we care about the PC at time of bl, * not where the return will go. */ - frame->pc = *(unsigned long *)(fp + 8) - 4; + frame->pc = *(unsigned long *)(fp + 8) - AARCH64_INSN_SIZE; return 0; } diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 1da6029..6566201 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -260,6 +260,9 @@ static inline void ftrace_kill(void) { } #endif /* CONFIG_FUNCTION_TRACER */ #ifdef CONFIG_STACK_TRACER +#ifndef FTRACE_STACK_FRAME_OFFSET +#define FTRACE_STACK_FRAME_OFFSET 0 +#endif extern int stack_tracer_enabled; int stack_trace_sysctl(struct ctl_table *table, int write, diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index b746399..30521ea 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c @@ -105,7 +105,7 @@ check_stack(unsigned long ip, unsigned long *stack) /* Skip over the overhead of the stack tracer itself */ for (i = 0; i < max_stack_trace.nr_entries; i++) { - if (stack_dump_trace[i] == ip) + if ((stack_dump_trace[i] + FTRACE_STACK_FRAME_OFFSET) == ip) break; } @@ -133,7 +133,8 @@ check_stack(unsigned long ip, unsigned long *stack) for (; p < top && i < max_stack_trace.nr_entries; p++) { if (stack_dump_trace[i] == ULONG_MAX) break; - if (*p == stack_dump_trace[i]) { + if (*p == (stack_dump_trace[i] + + FTRACE_STACK_FRAME_OFFSET)) { stack_dump_trace[x] = stack_dump_trace[i++]; this_size = stack_dump_index[x++] = (top - p) * sizeof(unsigned long);