From patchwork Tue Apr 11 09:10:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 97227 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1716862qgd; Tue, 11 Apr 2017 02:11:08 -0700 (PDT) X-Received: by 10.99.115.75 with SMTP id d11mr6722345pgn.101.1491901868892; Tue, 11 Apr 2017 02:11:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c67si1708104pfl.283.2017.04.11.02.11.08; Tue, 11 Apr 2017 02:11:08 -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; 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 S1754365AbdDKJK6 (ORCPT + 23 others); Tue, 11 Apr 2017 05:10:58 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:33639 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754329AbdDKJKy (ORCPT ); Tue, 11 Apr 2017 05:10:54 -0400 Received: by mail-pg0-f51.google.com with SMTP id x125so119557803pgb.0 for ; Tue, 11 Apr 2017 02:10:54 -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:in-reply-to:references; bh=g51ia10k7kc1PVdEPCusdqi3Y0mXCe2zRylphGG74wg=; b=fZSLdHqvT/n0EdR1MLdgDC3GHqMZbOYjoU2TTcf8p/rappRug/7WQf/n+2FgD21Da+ T3frbu2hoZ4gVnZVIZRYuq4NLIZQcgZJn0Es3KuBxQegn3WBt1II37HmTItDxK2i2mb+ OH8YteIA/u3u8NzKKw9fVGwTupQ4SKxevrsG4= 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:in-reply-to :references; bh=g51ia10k7kc1PVdEPCusdqi3Y0mXCe2zRylphGG74wg=; b=bG9dIQUeoA6yNqBTKjcRXxKBQoJNG+KIaE9iwUZeDZ83VPy9rNmYrMGL7lWR9LBG8y LhXNiZMZCgD96Cn8OIU57Cfg0fXHKFBhM3mmS9lKxB/fcfb8/ZsPgBJPvOmwJnHmb6tj GVjVZDqenBKnhumIqdP+aJ8jVGfvba1lphcZmgptJwpbOZfyjfoH3eCzG2d+2KGqIhbv IIh5/CXiSWUUpVrF3KuF4m+9MHrRvF+/1OVkGqC1y/TYZ8w5R1/1QNpcZZRzIGzQmsa/ tlrsBqAgkFMzE5ARIN5Sbw3UNaE8EVw6EHkEZfmu+65EVi6gFnnHAp7Q9wDE/ZVjDYC6 JmaQ== X-Gm-Message-State: AFeK/H2iKxQE63ZHeHweubq3ep9Vh0mLkO5OrkzPi9BpDM+/QhQK9g9y/QXg8vapmj7I6vlD X-Received: by 10.99.117.8 with SMTP id q8mr54214856pgc.106.1491901853694; Tue, 11 Apr 2017 02:10:53 -0700 (PDT) Received: from localhost.localdomain (li1563-109.members.linode.com. [139.162.83.109]) by smtp.gmail.com with ESMTPSA id r77sm8196394pfe.105.2017.04.11.02.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 02:10:52 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Leo Yan , Mike Leach , Suzuki K Poulose Subject: [PATCH RFC 3/4] coresight: tmc: dump RAM when device is disabled Date: Tue, 11 Apr 2017 17:10:28 +0800 Message-Id: <1491901829-18477-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491901829-18477-1-git-send-email-leo.yan@linaro.org> References: <1491901829-18477-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Coresight framework creates /dev nodes for ETB/ETF devices, these nodes cannot read out data if without enable the coresight path. Finally we lose chance to dump RAM if there have some old data kept in it. So this patch is to add support to dump RAM when device is disabled, with this small change we can easily read out ETB RAM data before there have new data has been sent to it. These dump data may come from the previous system running, so it will be very helpful to analyze some hang issue before system dead. Cc: Mathieu Poirier Cc: Mike Leach Cc: Suzuki K Poulose Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 43cfeaa..5e709af 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -95,7 +95,7 @@ static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata) * When operating in sysFS mode the content of the buffer needs to be * read before the TMC is disabled. */ - if (drvdata->mode == CS_MODE_SYSFS) + if (drvdata->mode != CS_MODE_PERF) tmc_etb_dump_hw(drvdata); tmc_disable_hw(drvdata); @@ -557,6 +557,10 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) goto out; } + /* Try to dump RAM even for disabled state */ + if (drvdata->mode == CS_MODE_DISABLED) + drvdata->buf = kzalloc(drvdata->size, GFP_KERNEL); + /* If drvdata::buf is NULL the trace data has been read already */ if (drvdata->buf == NULL) { ret = -EINVAL; @@ -564,8 +568,7 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) } /* Disable the TMC if need be */ - if (drvdata->mode == CS_MODE_SYSFS) - tmc_etb_disable_hw(drvdata); + tmc_etb_disable_hw(drvdata); drvdata->reading = true; out: