From patchwork Tue Jan 29 12:28:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 156980 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4603101jaa; Tue, 29 Jan 2019 04:30:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Lzt9YdqpPbmaqvuJG6zm0pMXztUnSu4N2R3YsXzYFhM0IL+uozI6lNwDNU+Xvx7AZrdHh X-Received: by 2002:a17:902:5601:: with SMTP id h1mr26416802pli.160.1548765010364; Tue, 29 Jan 2019 04:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548765010; cv=none; d=google.com; s=arc-20160816; b=qqZ6kYGGIFY+xIQCM6jCS7zqgHXp6zaHQgAhqRv9ded5vWmoRhNs9TCrMGrbNvS3pI oS1qfPhwUBw+9bsNujwIetaNDJeQPrqYZNE4P9NC1LT4YnIbkbYhjDwSdubx2d1QRp5A SaXIJtx8S8fYkiWCmdk2/HffvS3jBoUkUq1SwzQWrtfT/Clue2Gmi+g0/UYr03/QMGuy kcvHwOnIJagg8pu7wUSXcZP5bVdl74VWBbqUXqXBYpnJgQFexFibGAbF7uAOA0zzZCLp bAYGg42M9Og0OvDTStRPM7YGclcxet6BcIngPhQrBufZ3UnmpgjNMqvC8m8b/4EL4qlF FaPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=3vgO5gz1slI+w2/pIHGVojFnCNFu6a/dztrTgaESmOQ=; b=A5trxv9BpcX8OH88CcOO9Wfx/62M5PU4gQWaeEZn0dugHN/0tYD7AV76ja7ricHvJ7 oQgEJcEoMGM5WmGwwg0FiALqdWMdEcw2PK+qrB+378pxK8C2shFRviOGIMPSVxF5puqp 7CYv3m7XzupjJDZiXcLU+2s17FyruZA/CSaJpaxfcRgVifbRH0S5VMDhiqFdv7rhvtcd rxetqxlCE6o0d9uV1WHG9FTQOP3Yj3R6Eh9f7QJIWsuf+h9sHxin40I6ugph8sPm0ywf WUe4fPPhB97rwJB6BIJvidGlekfetCOGtlC3zqgmD0969vfyDHAuEvWw5XUpLEGuHlEd D6xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZHBeadn6; 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 o195si1796038pfg.106.2019.01.29.04.30.10; Tue, 29 Jan 2019 04:30:10 -0800 (PST) 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=ZHBeadn6; 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 S1728849AbfA2MaI (ORCPT + 31 others); Tue, 29 Jan 2019 07:30:08 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37036 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728764AbfA2MaG (ORCPT ); Tue, 29 Jan 2019 07:30:06 -0500 Received: by mail-pf1-f194.google.com with SMTP id y126so9594403pfb.4 for ; Tue, 29 Jan 2019 04:30:05 -0800 (PST) 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=3vgO5gz1slI+w2/pIHGVojFnCNFu6a/dztrTgaESmOQ=; b=ZHBeadn6EB+AZwhwS4obP3N25LhIylyiAzNql7x5WU5QCtUeXFlJHaO+CkZeifZK92 B4jGrbFNVlvSC5Xh+3qBhDrUXe2KkutpVnU5u+aLkTwPvAZyhzXbRYLeFd4Hng7D+Dn1 N0S4vtT1Ls7F8E7eeXL86z9hplzgteqRG/jU4= 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=3vgO5gz1slI+w2/pIHGVojFnCNFu6a/dztrTgaESmOQ=; b=KI4vJoEF/XiQOE1K7RM1qnF5XftdakS83evsle7vcW3ei0rlT+M/OQ/JjhraQQvXnh QZ7otqK/iNUkplCNvKUt5WFV/KDgdqkIAHW5XZ/TAXXKOInsJuOD+UvaBMw/60Ss1S9Q 0GJcpXcCj0X9fm3/De8pM8aSktzPI0PUneSdGBbl4zsU0bXlFuI9gU/9jpHyvpRjXGmg aIZqevp1+IBbsc/mHfR4+XyhfnCMhzmrWgM9K8wyjRc3vt8lo6f/pSElC+oF+wZTnt8l 2Xu+5P9tNr6olsG/OHw4cSWAevhNbqFg6hHR14vwSKKqBjc/q1PSjP8Mqf338SFFX1W5 QbDQ== X-Gm-Message-State: AJcUukc9tfmYEqibBVgNsi1BXYdLNb8MB9V9PTA6OP4+HS4fqxNeKYCz sxq0dsPrx1bELi5cocMkVYxdjQ== X-Received: by 2002:a63:ec4b:: with SMTP id r11mr22995464pgj.44.1548765005530; Tue, 29 Jan 2019 04:30:05 -0800 (PST) Received: from localhost.localdomain (li569-141.members.linode.com. [192.155.82.141]) by smtp.gmail.com with ESMTPSA id h64sm59552502pfc.142.2019.01.29.04.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 04:30:04 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Mike Leach , Robert Walker , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML Cc: Leo Yan Subject: [PATCH v7 4/8] perf cs-etm: Add exception number in exception packet Date: Tue, 29 Jan 2019 20:28:38 +0800 Message-Id: <20190129122842.32041-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190129122842.32041-1-leo.yan@linaro.org> References: <20190129122842.32041-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When an exception packet comes, it contains the information for exception number; the exception number indicates the exception types, so from it we can know if the exception is taken for interrupt, system call or other traps, etc. This patch simply adds a field in cs_etm_packet struct, it records exception number for exception packet that will then be used to properly identify exception types to the perf synthesize mechanic. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier --- .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 20 +++++++++++++++---- .../perf/util/cs-etm-decoder/cs-etm-decoder.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index e98ee49a1527..294efa76c9e3 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -294,6 +294,7 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder) decoder->packet_buffer[i].last_instr_subtype = 0; decoder->packet_buffer[i].last_instr_cond = 0; decoder->packet_buffer[i].flags = 0; + decoder->packet_buffer[i].exception_number = UINT32_MAX; decoder->packet_buffer[i].cpu = INT_MIN; } } @@ -331,6 +332,7 @@ cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder, decoder->packet_buffer[et].last_instr_subtype = 0; decoder->packet_buffer[et].last_instr_cond = 0; decoder->packet_buffer[et].flags = 0; + decoder->packet_buffer[et].exception_number = UINT32_MAX; if (decoder->packet_count == MAX_BUFFER - 1) return OCSD_RESP_WAIT; @@ -406,10 +408,20 @@ cs_etm_decoder__buffer_discontinuity(struct cs_etm_decoder *decoder, static ocsd_datapath_resp_t cs_etm_decoder__buffer_exception(struct cs_etm_decoder *decoder, + const ocsd_generic_trace_elem *elem, const uint8_t trace_chan_id) -{ - return cs_etm_decoder__buffer_packet(decoder, trace_chan_id, - CS_ETM_EXCEPTION); +{ int ret = 0; + struct cs_etm_packet *packet; + + ret = cs_etm_decoder__buffer_packet(decoder, trace_chan_id, + CS_ETM_EXCEPTION); + if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT) + return ret; + + packet = &decoder->packet_buffer[decoder->tail]; + packet->exception_number = elem->exception_number; + + return ret; } static ocsd_datapath_resp_t @@ -443,7 +455,7 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( trace_chan_id); break; case OCSD_GEN_TRC_ELEM_EXCEPTION: - resp = cs_etm_decoder__buffer_exception(decoder, + resp = cs_etm_decoder__buffer_exception(decoder, elem, trace_chan_id); break; case OCSD_GEN_TRC_ELEM_EXCEPTION_RET: diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h index 23600e57a215..012b4728a46f 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h @@ -46,6 +46,7 @@ struct cs_etm_packet { u32 last_instr_type; u32 last_instr_subtype; u32 flags; + u32 exception_number; u8 last_instr_cond; u8 last_instr_taken_branch; u8 last_instr_size;