From patchwork Wed Feb 6 18:48:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 157663 Delivered-To: patch@linaro.org Received: by 2002:ac9:7558:0:0:0:0:0 with SMTP id r24csp6438196oct; Wed, 6 Feb 2019 10:51:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IYV9vmJlMQgk7pEOB39PbF0F0pl3F5+STjwef0G0JUmOD/lw9sakQdScJVALTrFtUkejfZZ X-Received: by 2002:a17:902:449:: with SMTP id 67mr3495979ple.310.1549479089183; Wed, 06 Feb 2019 10:51:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549479089; cv=none; d=google.com; s=arc-20160816; b=PkYZNBP18/zSXA29Vh6FnvB70KV2ClzRS3XYI7+3eLrdk34DWOtfUYoIgwX5EQtmrG TRM1zMABba0TLVEnolzvAEn8/CCBPIlTv51uJnom09WWoZW/xP65Sp0ML+2kFx0C/89h R+u1xqfu3PxmPGLDNerAfjZwIeMBJcliW61mJ/0K1eXsuc9252nZQlLuURrj+HJpRmHS ju9lb2TVmDy+VH4B1bbxLD5sIKRLryJLZWuSgNezn7jVjGjqY8r4yjzarN2EbtFrXiYd Fi1Zljp1BLHByyPZT6UPMyUpRKbYIo980YvZsOP0VrlPtGdRnil8B8XeiSUrrwDcnQ0X ph8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pHuwx4G78oIJZErJssLq6HPa4xwkghTPGTjC0juKtXQ=; b=Ot18AxeWrh3nWFTyW4uJKcorHt1KC/cepSGgG9c3Cnpg06QW1PgqJnbIrs8l0FRBhI xVAQ8Z1LuyOpCt5QC9ZpZQ7FWwgnlnztbVKOZ+Vbp0LZ+9K9qKy0OZPJ7/YHVT5KmQgc R6qUyigtc4F2+AdUqMMfxIWTFodbS8k5DJVlQqB32CLNT077ttzvZsWES6cyj2FQnSuU ybY4r1jgVetdFQLZxXal6MbCfdaB3CbNpFAYOV43G9/bXnokU1gZ8/rAfLhAcnuqtoIh 1zaPNh0vMrdLRhBh9tBzhne4H2zUUwnmrHJ4pZxJtUJ+pSe75tVCPeXCLjWHvC5UxVz7 Z/fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S5lcBJ4G; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c24si995490plo.434.2019.02.06.10.51.28; Wed, 06 Feb 2019 10:51:29 -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=@kernel.org header.s=default header.b=S5lcBJ4G; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727976AbfBFSv1 (ORCPT + 31 others); Wed, 6 Feb 2019 13:51:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:45696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727957AbfBFSvY (ORCPT ); Wed, 6 Feb 2019 13:51:24 -0500 Received: from quaco.ghostprotocols.net (unknown [179.97.41.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B9BA218D4; Wed, 6 Feb 2019 18:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549479083; bh=V/QoTyU0D3hV2eGwqwNhVwewI96vLjuPLYpJi11GZ5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5lcBJ4Gan88Q3febb9LSSapTZYUvaJxyrYE1i+3CypjXtY8EemCdrH3FjoaANZDY TwNvrRLISplSNH05g1XqerVNSd8Ot4NtQyQjj0FhAuW0ldy2C/5m1joUypFwWKZh2T V4fXLLp90iybHq1XxhpydRgN/JbMxysW3kRQD1Wc= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Mathieu Poirier , Alexander Shishkin , Jiri Olsa , Mike Leach , Robert Walker , Suzuki K Poulouse , coresight ml , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 39/53] perf cs-etm: Add exception number in exception packet Date: Wed, 6 Feb 2019 15:48:49 -0300 Message-Id: <20190206184903.24054-40-acme@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206184903.24054-1-acme@kernel.org> References: <20190206184903.24054-1-acme@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan 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 Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mike Leach Cc: Namhyung Kim Cc: Robert Walker Cc: Suzuki K Poulouse Cc: coresight ml Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20190129122842.32041-5-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- .../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.20.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;