From patchwork Thu Oct 24 15:13:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 177530 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2330132ill; Thu, 24 Oct 2019 08:15:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMHxM5fjlN9QpTx4mmXdcknFMyz/qT34egB/Xn2AEdcbyR9Y7vCoUQ20JOtomHjHpexo1A X-Received: by 2002:a50:c949:: with SMTP id p9mr43355668edh.25.1571930106930; Thu, 24 Oct 2019 08:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571930106; cv=none; d=google.com; s=arc-20160816; b=ZTckzzSxmYiNvhCkXWC7J4ljknrT6eU78gdbmmwoqyn5IYakzqbn2tx8TwyxHKGlbw jFHCk8ggACz0QHHtxEFyUjrw+z3BUabRAdlU+cOixB9mgLoW4ZPZOMTyjfkDgTn2r88F KiC2zDd+y+iMOrfjKoqq5VQv4Os82cgEO9AmJnfwQW3UzCOEPo0jgF61c1MwY/pSfI02 Xa+oLJENIm1X9E2/weinjE+ExfocREJgHr1RwDI79bvxlF0YGxh++1rH3KWUbaELcod8 M90aA0PNb3lm5xN0aIjdc7cIB3NG+W/+lVoSYCNs3EdTceDgGAKbOHMXmiHf78Qw1a8Y e33w== 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=4Q6XHErtHhX+1mLaNoKaQj0VUhUfS1Bgbues0FuRIG4=; b=pqFk7N+oX2Of1C1jmnUa2g2TKbYJhCCGt4GMRDGXtXSy5TjjyQSc6W/A1dsWTCjJTN F953u6ob5M5xlWCMQd4BR+3XaB4ttQE7mFVdOzvcY1/PW86rv/qEWKDQ/VC7YrqPV31P H9YPOs8hNb9L0bMpPz/T2gJbVoojLgiwPdIIX7X54AxoB+afJfC1mrM+9ZupF19gA3Nt yS1uf0/aQVmWVbEb35rm/HIxTj8S5CGUTWqBmhYn+GsSnXAgEjEoWAtB5OTEthYSu/+F C6HPyBKafs8X76z8e/vNKE+BThe9n4MrPMgl2ZI6RSK/YDObRCRh/IP76BUD0KvJWHwB N4Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kz5po7s2; 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 e48si6537606ede.207.2019.10.24.08.15.06; Thu, 24 Oct 2019 08:15:06 -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=kz5po7s2; 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 S2409634AbfJXPPB (ORCPT + 26 others); Thu, 24 Oct 2019 11:15:01 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:46595 "EHLO mail-qt1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409599AbfJXPPB (ORCPT ); Thu, 24 Oct 2019 11:15:01 -0400 Received: by mail-qt1-f173.google.com with SMTP id u22so38329569qtq.13 for ; Thu, 24 Oct 2019 08:15:00 -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=4Q6XHErtHhX+1mLaNoKaQj0VUhUfS1Bgbues0FuRIG4=; b=kz5po7s2ieKJl5ZCmOJw+6B8XVBPG87kZe4L62Qmh3UejutibGAXbPI4Hp4WYv4UC0 gp1fXCxov4xDtKUqySwOynQjxJJ3vB2B6ABcR8Grzs18UzlgJMUyNgcVciyDH61P61qv hzwCeYTDpP589ZJRK++UiPeWEhzi9Ai1DxYEa4dMr9R4F2bnhGT+B0g4Rup9Wv3S/bBx sqGHcDczx46vWpoym700/p+r/NIzk2LjpjM9pt2HxiT8xnv6tqt+GQiGYHC/EMC24MsL 5Yk9g+mVXWxN4M5xH8qwBKOuRRsJnuWx3tvpBRXe9NA+ZTsHVnQMEvQ26K0ZT+eVAJQK z9HQ== 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=4Q6XHErtHhX+1mLaNoKaQj0VUhUfS1Bgbues0FuRIG4=; b=Xojfd6dFXQVw/S4nnbCKoY/V3wyogN7mFINyWkuxJ/7at1Nhci304TnahBkO3Ut7kv BITcsSa4lKb5YxQ1OsEJcVictpgBDt6c35xowuN5CKzPbFufkNJuP6kNG8HkQXm3ZZ0N Tfv8wpxBCjL/Jys906P9SgGSRhW+PzhsBqiJgA1Vkzt3szECUOoOjEpUofQkUl/L02Mz 92tHPucqwdvxf4sytHLRqMcWLQrIUk7CzZPuzzUBzAaAl6v2sqjah+CiwIoUAWQLG1xt +L6mR7JFl6lju+oCpBmlUkUjbVCKm+3CNQf9uwYNCUh1EV5kV+w1Z3oHCykvQMU0/U2C g58g== X-Gm-Message-State: APjAAAWx7Caj0BLjPPxgoe0Dn0sMHIirCIYPIPkbSY09ma0IKZMQreK4 VXabFCf/w2tLZ5lLNBSzG5S6kw== X-Received: by 2002:ac8:290f:: with SMTP id y15mr4748046qty.181.1571930098546; Thu, 24 Oct 2019 08:14:58 -0700 (PDT) Received: from localhost.localdomain (li937-157.members.linode.com. [45.56.119.157]) by smtp.gmail.com with ESMTPSA id l5sm4346073qtj.52.2019.10.24.08.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 08:14:57 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML , Robert Walker Cc: Leo Yan Subject: [PATCH v1 0/4] perf cs-etm: Fix synthesizing instruction samples Date: Thu, 24 Oct 2019 23:13:21 +0800 Message-Id: <20191024151325.28623-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series is to address the issue for synthesizing instruction samples, especially when the instruction sample period is small enough, the current logic cannot synthesize multiple instruction samples within one instruction range packet. To fix this issue, patch 0001 avoids to reset the last branches for every instruction sample; if reset the last branches when every time generate instruction sample, then the later samples in the same range packet cannot use the last branches anymore. Patch 0002 is the main patch to fix the logic for synthesizing instruction samples; it allows to handle different instruction periods. Patch 0003 is an optimization for copying last branches; it only copies last branches once if the instruction samples share the same last branches. Patch 0004 is a minor fix for unsigned variable comparison to zero. To verify my changing for synthesizing instruction samples, I added some logs in the code, and reviewed the output log manually for instuctions samples. The below commands are tested on DB410c board: # perf script --itrace=i2 # perf script --itrace=i2li16 # perf inject --itrace=i2il16 -i perf.data -o perf.data.new # perf inject --itrace=i100il16 -i perf.data -o perf.data.new Leo Yan (4): perf cs-etm: Continuously record last branches perf cs-etm: Correct synthesizing instruction samples perf cs-etm: Optimize copying last branches perf cs-etm: Fix unsigned variable comparison to zero tools/perf/util/cs-etm.c | 137 ++++++++++++++++++++++++++++++++------- 1 file changed, 115 insertions(+), 22 deletions(-) -- 2.17.1