From patchwork Mon Jul 13 05:29:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 51059 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45B1522916 for ; Mon, 13 Jul 2015 05:30:40 +0000 (UTC) Received: by wizo10 with SMTP id o10sf17777449wiz.0 for ; Sun, 12 Jul 2015 22:30:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=9qfJw1OlhZ93+uCvu563tOkFKAIj3jibfZGqKwdV5SA=; b=jtPiFp8picoz12Qd6c3TaN033C1Mx19m4EuN8pXenDUYEx8oWkboBvjuTbjLeDhG2F R+77UoDiK0LN0lczqZqKSQWYBvoXAd878pDWJc4bROZ8BHru1WqG/jPUON7d78e5w1Dt UVykW88De53zTiXmNMZUDbTYupOYXCxBXAOSWs9nSA2lTXACJHIA3cWO5ABSIvjXjt+f GypMuSCL3BnHGbHCkfBG3kMMysfUcgOGuCHw3CctalOEA4TZjpqIPkG6sTUyh0D6oXre mE2vpbgOvR3spR23fKn73jr+HeBz2EYl+og3pcHbQRaooNiw8C+4wHyoQv4spk8HBIP8 qANA== X-Gm-Message-State: ALoCoQnM48o8pvaUJ5g6RYe8ZyQDt3nXWSTrUoSVF016xSYPaepZ6Fawxkc6MJToaRs3pQwA9pEr X-Received: by 10.152.2.196 with SMTP id 4mr17646690law.10.1436765439537; Sun, 12 Jul 2015 22:30:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.201 with SMTP id t9ls1388907laa.95.gmail; Sun, 12 Jul 2015 22:30:39 -0700 (PDT) X-Received: by 10.152.22.168 with SMTP id e8mr30659618laf.40.1436765439356; Sun, 12 Jul 2015 22:30:39 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id z3si14273294lbp.168.2015.07.12.22.30.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jul 2015 22:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagw2 with SMTP id w2so7968349lag.3 for ; Sun, 12 Jul 2015 22:30:39 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr30371545lak.117.1436765439152; Sun, 12 Jul 2015 22:30:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1499840lbb; Sun, 12 Jul 2015 22:30:37 -0700 (PDT) X-Received: by 10.68.167.131 with SMTP id zo3mr65359924pbb.123.1436765437210; Sun, 12 Jul 2015 22:30:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fl5si26506401pab.130.2015.07.12.22.30.35; Sun, 12 Jul 2015 22:30:37 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbbGMFad (ORCPT + 28 others); Mon, 13 Jul 2015 01:30:33 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:32987 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947AbbGMFac (ORCPT ); Mon, 13 Jul 2015 01:30:32 -0400 Received: by padck2 with SMTP id ck2so36509298pad.0 for ; Sun, 12 Jul 2015 22:30:31 -0700 (PDT) X-Received: by 10.70.22.235 with SMTP id h11mr66436497pdf.135.1436765431811; Sun, 12 Jul 2015 22:30:31 -0700 (PDT) Received: from localhost.localdomain (61-205-7-98m5.grp1.mineo.jp. [61.205.7.98]) by smtp.googlemail.com with ESMTPSA id cz1sm16903229pbc.84.2015.07.12.22.30.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Jul 2015 22:30:30 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, rostedt@goodmis.org Cc: jungseoklee85@gmail.com, olof@lixom.net, broonie@kernel.org, david.griego@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [RFC 1/3] ftrace: adjust a function's pc to search for in check_stack() for arm64 Date: Mon, 13 Jul 2015 14:29:33 +0900 Message-Id: <1436765375-7119-2-git-send-email-takahiro.akashi@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436765375-7119-1-git-send-email-takahiro.akashi@linaro.org> References: <1436765375-7119-1-git-send-email-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: takahiro.akashi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Ftace's stack tracer on arm64 returns wrong information about call stacks: Depth Size Location (50 entries) ----- ---- -------- 0) 5256 0 notifier_call_chain+0x30/0x94 1) 5256 0 ftrace_call+0x0/0x4 2) 5256 0 notifier_call_chain+0x2c/0x94 3) 5256 0 raw_notifier_call_chain+0x34/0x44 4) 5256 0 timekeeping_update.constprop.9+0xb8/0x114 5) 5256 0 update_wall_time+0x408/0x6dc Most of 'Size' fields are unexpectedly zero. This is because stack tracer fails to recognize each function's stack frame in check_stack(). Stack tracer searches for a function's pc in the stack based on the list returned by save_stack_trace(), but save_stack_trace() on arm64 does not return the exact return address saved in a stack frame, but a value decrmented by 4 (which means a branch instruction's address). This behavior was introduced by commit e306dfd06fcb ("ARM64: unwind: Fix PC calculation") So the matching doesn't succeed in most cases. This problem can be fixed either by a) reverting the commit above b) adding an arm64-specific hack to check_patch() This patch does b). Signed-off-by: AKASHI Takahiro --- kernel/trace/trace_stack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 3f34496..7086fc3 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c @@ -143,7 +143,11 @@ check_stack(unsigned long ip, unsigned long *stack) p = start; for (; p < top && i < max_stack_trace.nr_entries; p++) { +#ifdef CONFIG_ARM64 + if (*p == (stack_dump_trace[i] + 4)) { +#else if (*p == stack_dump_trace[i]) { +#endif this_size = stack_dump_index[i++] = (top - p) * sizeof(unsigned long); found = 1;