From patchwork Mon Dec 10 08:52:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 153243 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3327190ljp; Mon, 10 Dec 2018 00:53:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/U12m7FVzVvghWBaiCkOPGECA1sJ2Sc2+53gXYFZJkXRdG+Xr/u3MZz+yUiLyfTST9c40TE X-Received: by 2002:a63:8c2:: with SMTP id 185mr10371186pgi.26.1544432003811; Mon, 10 Dec 2018 00:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544432003; cv=none; d=google.com; s=arc-20160816; b=u6bMCiTiMeAJCxdDNzOCT0EYusZ40j2/Ayj3Ho1I7aGYb52PUfM/O+E2egHc7NvNaa RyZl2xlpcrGdottgTHe2eLQvfhz8SBKaUSa/jJ9Pg0AS30QQoZ5kV6Bhk4bYGoeSakSh INRhrK6himNVxGvA968ktTDOHpFfyJwGRT6BDEtLLlDaA2qdqvFsyg2cQaDwhIuLsg0/ WqxGM8VfsNjJN1GICxLM0hkOvgIOyqgTIbIpIrWeIohGSMFn+ms+cvG52Wa5dxnIQx7Y 7NG7uE4HJyAa0Bx1NnpgSJhJOO1jdKLnh4Zje6D+THTBCSKRNCXsNfrXJ1GdjhSVbqGW PwWw== 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; bh=RhEccwMmtKbXni8WbCuC9MbU3ATtmsHEMgXp+M5cHn4=; b=iYb3Tj2tf4rkH+H+yr5XCxjyneZ8f2nJZqJI8oyzZ2Gg/SniBjyFXeJ8GhIsioVWci BZ94ERXkrrbD/0y7MvPyC2iggUCX5BvYDzkR4Xwucdx7GG36n00eczPJQCvt8aF77Mo7 Ex10QT7LkGwdkPi3dU7qA8rC6JCXy7MlAe/lkmU0ZlJYaTSGZVWxFkPBjvZWdLsh1lMF l8s2WfvD1ScYwwp0pOW798J42gu+TCs3lrh6ZQp6bNpCXlVKFyZUZ6kehc2hKvjyQVzd 6MRMcaEDDNMqPQRVu5uPMf25b6W42H6gIhmSvjgFYRdXAPAAOMd72fyWQ6CmfNeeMxmz 6wvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k2EfoCCt; 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 h9si9918046plb.180.2018.12.10.00.53.22; Mon, 10 Dec 2018 00:53:23 -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=k2EfoCCt; 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 S1726632AbeLJIxU (ORCPT + 31 others); Mon, 10 Dec 2018 03:53:20 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36135 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726526AbeLJIxU (ORCPT ); Mon, 10 Dec 2018 03:53:20 -0500 Received: by mail-wr1-f65.google.com with SMTP id u3so9576020wrs.3 for ; Mon, 10 Dec 2018 00:53:19 -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; bh=RhEccwMmtKbXni8WbCuC9MbU3ATtmsHEMgXp+M5cHn4=; b=k2EfoCCtoFQYVyLkCyTr/cgGYJ6VG6uJxyLicesF9OiSZTkOpWQ9j/3g7JWAfjgo81 F0vCCvVfUryNVdqFjFquN7AhOKy1eGmrA9uCXlsI7I1NZ0aoDUh0SJORtrtF2NsCpX74 VwCCXZbPEdw/xXZWISF3wyB/Oq/qsJ1/O/MV8= 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=RhEccwMmtKbXni8WbCuC9MbU3ATtmsHEMgXp+M5cHn4=; b=MG+qvvHcTSB3SB5Feq1cISrgwtKgM7bZzvo87H0j/yw3/ZDnWe2F/yyBl81u2pUTEi BaxoaXfbzvGcVHB8oU0Mx0XEl+bEHdKE9dozgp+Prwq7FQ94cNXMcqu6TtEvn9wmzeag 5OXzryMxVGA3uWpI8RWlbZi9c0/3gQRwz9pfa+u61IxsByvIKi+G4bTjTKKHbREI+4hz TCjnaEVLKtTFYTOL/LOKirCdj6j02FndXqtB7VkN2zXu37HZN/98zjpEWKutnBChCmzo gpXQCDr71W0WgRas6mR58adg8+5fN0aV6w/1osPnBzCnhkp4h/kyGQN5Os3zN28OZlPC smyw== X-Gm-Message-State: AA+aEWZS8wasnMiIDTQmymO2RJCjqs0+abneK7Svfdzp5HOjWMsPb7cb 0gt0M1Td6UZmf/jdMC+Muy8gUw== X-Received: by 2002:a05:6000:14f:: with SMTP id r15mr9732610wrx.53.1544431998293; Mon, 10 Dec 2018 00:53:18 -0800 (PST) Received: from localhost.localdomain ([209.250.228.18]) by smtp.gmail.com with ESMTPSA id m4sm9097351wml.2.2018.12.10.00.53.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Dec 2018 00:53:17 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML Cc: Leo Yan Subject: [PATCH v2 0/6] perf cs-etm: Correct packets handling Date: Mon, 10 Dec 2018 16:52:55 +0800 Message-Id: <1544431981-24144-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 perf cs-etm module converts decoder elements to packets and then we have more context crossing packets to generate synthenize samples, finally perf tool can faciliate samples for statistics and report the results. This patch series is to address several issues found related with packets handling and samples generation when worked firstly on branch sample flags support for Arm CoreSight trace data, so this patch series is dependency for sample flags setting, will send another dedicated patch series for sample flags later. In this patch series, the first two patches are mainly to fix issues in cs_etm__flush(): patch 0001 corrects packets swapping in cs_etm__flush() and this can fix the wrong branch sample caused by the missed packets swapping; patch 0002 is to fix the wrong samples generation with stale packets at the end of trace block. Patch 0003 is to rename CS_ETM_TRACE_ON to CS_ETM_DISCONTINUITY, we use a more general packet type to present trace discontinuity, so it can be used by TRACE_ON event, and also can be used by NO_SYNC and EO_TRACE elements. Patch 0004 is used to support NO_SYNC packet, otherwise the trace decoding cannot reflect the tracing discontinuity caused by NO_SYNC packet. Patch 0005 is used to support EO_TRACE packet, which also introduces the tracing discontinuity at the end of trace and we should save last trace data for it. Patch 0006 is used to generate branch sample for exception packets. This patch series is applied on the acme's perf/core branch [1] with latest commit 4085fed6373f ("perf trace: Add ordered processing"); Since Rob's patch 'perf: Support for Arm A32/T32 instruction sets in CoreSight trace' has been merged into perf/core branch, this patch series can directly be applied onto perf/core branch. With applying the dependency patch, this patch series has been tested for branch samples dumping with below command on Juno board: # perf script -F,-time,+ip,+sym,+dso,+addr,+symoff -k vmlinux Changes from v1: * Synced the consistent code in patch 0001 for condition checking. * Introduced new function cs_etm__end_block() for flushing packet at the end of trace block. * Added new patch 0003 to rename CS_ETM_TRACE_ON to CS_ETM_DISCONTINUITY. * Used the same one packet type CS_ETM_DISCONTINUITY for all trace discontinuity (include support TRACE_ON/EO_TRACE/NO_SYNC packets). * Removed tracking exception number patch, which will be added in sample flag patch series. Leo Yan (6): perf cs-etm: Correct packets swapping in cs_etm__flush() perf cs-etm: Avoid stale branch samples when flush packet perf cs-etm: Rename CS_ETM_TRACE_ON to CS_ETM_DISCONTINUITY perf cs-etm: Treat NO_SYNC element as trace discontinuity perf cs-etm: Treat EO_TRACE element as trace discontinuity perf cs-etm: Generate branch sample for exception packet tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 40 +++++++++---- tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 10 ++-- tools/perf/util/cs-etm.c | 77 ++++++++++++++++++++++--- 3 files changed, 102 insertions(+), 25 deletions(-) -- 2.7.4