From patchwork Fri Mar 30 03:15:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 893096 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iberaUVA"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GLWOQTv4"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40C6Fy0F6sz9s1p for ; Fri, 30 Mar 2018 14:16:06 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=rrEBnIfi8CCILfh/ne5Mv3aiXKA/MNnUubkeQTllyrI=; b=ibe raUVAcp70AAVqPNSz2FZTwzQ2UMJ5H+3FSi61876LhhUcZWSl8jPhVWoURMCWa0kZOOiaosSx3kVj l/9Hc/w/LduakcRtYY3rm2AT8agJV8ziyuFJpqXsiO12t776XrfhgBYMU5rkrT5kaGADiOEYLt+gS 0icGlZxyuS/I5JOWC4BXvMLBInlpnOUgA9x3R3laoSK+vuppyYWm2QCo4ECGq8rTUvHBDo7izMG1F Bfg1L8UPOMMxT32Ax6UQly9wcPLY1KgA5WFmZKwXWxn8Sh20b+UoC8NQb9pZ2Je5BLdH5J84eqTbl bEMlPxJwd7hAsN01u7VjmxY60tU2ijA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1kWI-0008MD-0p; Fri, 30 Mar 2018 03:16:02 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1kWE-0008Ke-Dm for linux-arm-kernel@lists.infradead.org; Fri, 30 Mar 2018 03:16:00 +0000 Received: by mail-wm0-x244.google.com with SMTP id b127so12909493wmf.5 for ; Thu, 29 Mar 2018 20:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=g8hRWBH9Ffr8aq1M++fL3sQ9CcLWhWZkFaFf/4I20MQ=; b=GLWOQTv4s7guwpWgEybMCzCpzUcoUMWdwn5VHNoizQ4jcjehHekaoPOS7tqkghE9yT GD7JAtquFfJ4XqXf3MF9NtvAVk8Kq10PkeCF0DjR6azfsb2tXjSa9ieZp8XPTFY7d21h v1Fm2dw03rJBxdZvIJAY8ggdrxPXUEbgHctso= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g8hRWBH9Ffr8aq1M++fL3sQ9CcLWhWZkFaFf/4I20MQ=; b=mm8pQ1McJMKWUhz6i0GIYn87EhnEtxMn1xDeZ49eIUBfOE6ypDaCEHp/s2RBViBTPv 7c94eeAiLGpnhzJETS0GYX3GDT5WyB7XIOF83ltJPi7kplT5ejwEm+6Ec/gdkTqZuhhC Tze/tAMatKjNc2VdzProafLITbz+PAk+FtpTquyHFwbL2mC7StVUwCqs+D09Lbsx87wS X9EEEFZ+DKuLzAMItP/rTciwP9kpO35CWz9qHt1NtqXeTFdSKkyPAfcfQu1aSqwQx3X8 a4VVrJgO1IEYTiICxrDR5kZfZNoGQ0c5mid2TvYVlFm2t2RLzyrWL7A0YmAs9IJH8tTC qI0g== X-Gm-Message-State: ALQs6tCXENeirqOSNYQ50erait/PE22CmxSmu1MlmwnMSW/SStybmMbp beIM0Y1EpiX67TpkNduz5cUy9A== X-Google-Smtp-Source: AIpwx4/T8uY17IfiY71hFu/7ZK2I9ULoXw2Dm4S5vUsbCd4jBVt8hqpeZOA0t1j0uO1tw/MOAgU9Ow== X-Received: by 10.28.45.204 with SMTP id t195mr970417wmt.20.1522379746232; Thu, 29 Mar 2018 20:15:46 -0700 (PDT) Received: from localhost.localdomain (li622-172.members.linode.com. [212.71.249.172]) by smtp.gmail.com with ESMTPSA id z9sm12798903wrz.4.2018.03.29.20.15.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Mar 2018 20:15:45 -0700 (PDT) From: Leo Yan To: Jonathan Corbet , Mathieu Poirier , Greg Kroah-Hartman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, Kim Phillips , Mike Leach Subject: [PATCH v4 0/6] Coresight: Support panic kdump Date: Fri, 30 Mar 2018 11:15:18 +0800 Message-Id: <1522379724-30648-1-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180329_201558_466032_D265836B X-CRM114-Status: GOOD ( 17.03 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org This patch set is to explore Coresight tracing data for postmortem debugging. When kernel panic happens, the Coresight panic kdump can help to save on-chip tracing data and tracer metadata into DRAM, later relies on kdump and crash/perf tools to recovery tracing data for "offline" analysis. The documentation is important to understand the purpose of Coresight panic kdump, the implementation of framework and usage. Patches 0001 and patch 0002 are used for creating new sub directory for placing Coresight docs and add a new doc for Coresight panic kdump. Patch 0003 introduces the simple panic kdump framework which provides helper functions can be used by Coresight devices, and it registers panic notifier for dump tracing data. Patches 0004/0005 support panic kdump for ETB; Patch 0006 supports the kdump for ETMv4. This patch set has been reworked by following suggestions at Linaro HKG18 connect (mainly suggestions from Mathieu, thanks a lot!), and it's rebased on acme git tree [1] with last commit 109d59b900e7 ('perf vendor events s390: Add JSON files for IBM z14'). Due Coresight kdump data structure has been changed significantly, the corresponding crash extension program also has been updated for this reason [2]; furthermore the crash extension program is updated to dynamically generate kernel buildid according to vmlinux elf info [3], this is a fixing for the old code which uses hard-coded buildid value. This patch set has been verified on 96boards Hikey620 with Coresight enabling by the sysFS interface. Also the updated crash extension program has been verified to cowork with Coresight panic kdump and it successfully extracts tracing data from the vmcore and finally can be decoded by perf tool. [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git [2] https://git.linaro.org/people/leo.yan/crash.git/tree/extensions/csdump.c [3] https://git.linaro.org/people/leo.yan/crash.git/tree/extensions/csdump_buildid.c Changes from v3: * Following Mathieu suggestion, reworked the panic kdump framework, used kdump array to maintain source and sink device handlers; * According to Mathieu suggestion, optimized panic notifier to firstly dump panic CPU tracing data and then dump other CPUs tracing data; * Refined doc to reflect these implementation changes; * Changed ETMv4 driver to add source device handler at probe phase; * Refactored crash extension program to reflect kernel changes. Changes from v2: * Add the two patches for documentation. * Following Mathieu suggestion, reworked the panic kdump framework, removed the useless flag "PRE_PANIC". * According to comment, changed to add and delete kdump node operations in sink enable/disable functions; * According to Mathieu suggestion, handle kdump node addition/deletion/updating separately for sysFS interface and perf method. Changes from v1: * Add support to dump ETMv4 meta data. * Wrote 'crash' extension csdump.so so rely on it to generate 'perf' format compatible file. * Refactored panic dump driver to support pre & post panic dump. Changes from RFC: * Follow Mathieu's suggestion, use general framework to support dump functionality. * Changed to use perf to analyse trace data. Leo Yan (6): doc: Add Coresight documentation directory doc: Add documentation for Coresight panic kdump coresight: Support panic kdump functionality coresight: tmc: Hook callback for panic kdump coresight: Set and clear sink device handler for kdump node coresight: etm4x: Support panic kdump Documentation/trace/coresight-cpu-debug.txt | 187 ---------- Documentation/trace/coresight.txt | 383 --------------------- .../trace/coresight/coresight-cpu-debug.txt | 187 ++++++++++ .../trace/coresight/coresight-panic-kdump.txt | 130 +++++++ Documentation/trace/coresight/coresight.txt | 383 +++++++++++++++++++++ MAINTAINERS | 5 +- drivers/hwtracing/coresight/Kconfig | 9 + drivers/hwtracing/coresight/Makefile | 1 + drivers/hwtracing/coresight/coresight-etm-perf.c | 5 + drivers/hwtracing/coresight/coresight-etm4x.c | 27 ++ drivers/hwtracing/coresight/coresight-etm4x.h | 15 + .../hwtracing/coresight/coresight-panic-kdump.c | 199 +++++++++++ drivers/hwtracing/coresight/coresight-priv.h | 12 + drivers/hwtracing/coresight/coresight-tmc-etf.c | 30 ++ drivers/hwtracing/coresight/coresight.c | 16 +- include/linux/coresight.h | 4 + 16 files changed, 1019 insertions(+), 574 deletions(-) delete mode 100644 Documentation/trace/coresight-cpu-debug.txt delete mode 100644 Documentation/trace/coresight.txt create mode 100644 Documentation/trace/coresight/coresight-cpu-debug.txt create mode 100644 Documentation/trace/coresight/coresight-panic-kdump.txt create mode 100644 Documentation/trace/coresight/coresight.txt create mode 100644 drivers/hwtracing/coresight/coresight-panic-kdump.c