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: 132577 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp2530544ljb; Thu, 29 Mar 2018 20:15:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+IudYTIg3NPhnmLTulX+90eo5bVQphwbLRknOUMayli0bhpjdCl3hR0KBS07Zj5Qx678Wu X-Received: by 10.98.233.3 with SMTP id j3mr8557989pfh.38.1522379753413; Thu, 29 Mar 2018 20:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522379753; cv=none; d=google.com; s=arc-20160816; b=aTyoS/Ql/WgB9waMX+SVvnvzSg2mQuZz1+wiPQu1srI/yilARnPQlXjt/gNCesZefE L2J2tfeCd6HYdNmx20c8fz78GYTGc3sUuxwShFrDgbqEGq98SPotNniXl1Rkarios515 yCI7HJxZajzi6HQ5MJyp1FSbEvIXi22amCWHJmQlq4aJltz5Kg8ulkYUROizGW7PsjSW 7HdO2ont7b+dFim/pUi0+nKXPh/2sjYTufJY36KrycYJfsAqC7Bp8n79Ch7FJjGgYKgh VVRtlsC7/t9AJhn8IulFG5jB3EnGCJUrfvhNUJs740KEO2ay2Etr5vVGivuX8y/Wr4UI WN/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=g8hRWBH9Ffr8aq1M++fL3sQ9CcLWhWZkFaFf/4I20MQ=; b=dmdRmafhFunygXtD/U6F/GB9DRYqDv7+DBuA4eM932cr+f3aWtCcHnQZVR+0sYrN3Z mMXpF+vAZKaPH2gvHOJHLaxg2f5Ck1GUmAORnE5r5hvdbQEDaK5mca0OGzCfuFzp2YP0 RXigQoiySns6CfxEOSsCmoOiDaPOqcSd+yoZJ674Y8CX0LTx8i/LZ0uJlgoJWet6Ate2 qr7qslJyxwx5UMX5ytuFM7UqLD7Z4CUUwOIHDGxjK5h/fC9vlPNakdxka5/3BZUsalkQ ly8bWj2PXc984wfCDB7CpTgTwm6SWtg5S7fVyJhBzMI+bsd9BlcE2v3YVFefeJzTtOHr MBng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GLWOQTv4; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2-v6si7496411plm.671.2018.03.29.20.15.53; Thu, 29 Mar 2018 20:15:53 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GLWOQTv4; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752720AbeC3DPt (ORCPT + 29 others); Thu, 29 Mar 2018 23:15:49 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53601 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbeC3DPr (ORCPT ); Thu, 29 Mar 2018 23:15:47 -0400 Received: by mail-wm0-f68.google.com with SMTP id p9so13676959wmc.3 for ; Thu, 29 Mar 2018 20:15:46 -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=sIZVrHlHwSgg25dkwoqPj5+gasmzeZxbry880w5z6awiVQCup84fXl8hFXn4Pv17/j kVar/PQwloYpp5hPmZErOoywAsblbHF3GVV+pxW5rZCWCb/2VKDg6CVFfPXRJ5ToxfUi f0I5ZjBxY15Amxt340ctiXsqFl2tYUe4nr6hqOPVYZ2l71u+qiqP9Xt0uWcai4LZYgfD vo20TE5vvuJgKgf/MY1WBbX81+VrEK3wfNlEtIdqLdMs1q5EjZMGyDtHjGEdFDUhxl6H mQs9eDVveRlQvFTQ3S86vnAeHn3gxPLviChSU32qVUu7rPAY9p/NI9tKUN0EwToXbLmh TmfQ== X-Gm-Message-State: ALQs6tD5AWO9GIahWC+iswZhef6uqhUxRUzJn9rjAbmAix0DSlW3szp0 UWaYHGeFXeb6aCKEumQOZz3ptg== 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 Cc: Leo Yan 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.7.4