Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp250507ybx; Thu, 31 Oct 2019 19:46:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHyOv5h44ju1R+7xoWBUgFQ2v3+Kq94w0U/9aXMib5NAFDr61V54z0OqrLdEwoVwSo9nx9 X-Received: by 2002:a17:906:5010:: with SMTP id s16mr7369638ejj.67.1572576399173; Thu, 31 Oct 2019 19:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572576399; cv=none; d=google.com; s=arc-20160816; b=bNOOZFvNNrLtZWPwPuaUaftB4mKeUfUWWgTP/H1ee7a0px1G5Dp65fV2W6xgpe+fj9 JmfpI1uffTh6bEoU3ZL/cIi8R1UfH5ghF5UYKnxmZOlavtskP+45NE8QkfKZcOpc/D2c GW/WqxpCO97QPQ+EZJlzE2iBsiN/TUZi5Slar4DQnKxICNEt9TJ6dkPouEClqu4KxlPi qoNvYpmI3VsfLVE/4Ciz2eSSRGAjb7F1WOO+quCfrsJfnuxlHUzeLvyiauz6yBgm+Xkb CwIQpM6zlLlM+nls3MSS/fKkFIok2XYPhZsRX29V5K5V5QPOCaz/RMUqAot/cKHy4aj4 ir4A== 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=A/ta4o63hQ96fBCgzb5RGLjMhlxTMZ+PcK5dvaw+Anc=; b=HBRfcbH2rrCaDC+qPBe0zZVossYx7PrxVUBlX6TwsFWEppPQiL+qtCSUBZWlDirEsD s4VZfkWWymf0qy1bLIk0H9VyLvL2s6PoV8dDtwlo6m2xbUjytLTfajGBytXjQaPlGgn7 KErmS6HPplm1Bmvj8+nh+pw9Tb/me9CEjkLh6bZK570XjhAESG4in/w2Wid3FStWwbgt MyhUoTEkVIizYyssY4JkVd9GG5EX3VRNFK0QWEWo2mc6aeO4xbRPU/803f796XDJKeYl kIC1vCNX/uSzzphcPp+tyQg+VBmqcgUFiwpmjxshkQgJGQeNs2+ceX7IWx5xwoW0eMoJ v9mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C/NqR3xx"; 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 k10si5512659ede.132.2019.10.31.19.45.40; Thu, 31 Oct 2019 19:46:39 -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="C/NqR3xx"; 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 S1728250AbfKACIH (ORCPT + 99 others); Thu, 31 Oct 2019 22:08:07 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:39731 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbfKACIH (ORCPT ); Thu, 31 Oct 2019 22:08:07 -0400 Received: by mail-yw1-f65.google.com with SMTP id k127so2971372ywc.6 for ; Thu, 31 Oct 2019 19:08:05 -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=A/ta4o63hQ96fBCgzb5RGLjMhlxTMZ+PcK5dvaw+Anc=; b=C/NqR3xxIKG4023ZzRSgbk9XuoVpmk3xyEfEYwHqucSMXZYPUKg00oCcEmNmSjoPdq m6MafLbKbrsEgumWyIYlHPe99C9Hz4w//Rj9WvnYYpaDmEjfeCw2EeTkZPYvKZq5HyoF gHGgl6NLx+bfgPniQGFNrqJtrKZIqzNq4TQfRrf6OvSFO6d8io5xr/dUcjz38TfDWYqE deP9D6rYbVTI7ueuTY2YUeoHJe1++HLc/NMt9EF/YyBG5leyN4w6gL4PMVErIXo/OxJZ 7gRDQNMnBDE2UsqBvZ1y5yY6WeP4514WIK9HOADV1vw9P9IE3XY7fqZYE9TlDcSmLe8d YN3g== 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=A/ta4o63hQ96fBCgzb5RGLjMhlxTMZ+PcK5dvaw+Anc=; b=YigHe1+w86ZFUQzZMPmLm6GkJJYEr8Ama2NudYdAhciXMnnBNpEOx04H2ar8gAw3v9 xSIEOW4IcbS0JWMw+fhHkNkLwobR12NY63wSxuAinWlcpn4FjdEMdzDfioyN7RVcmxpU ALE+V17fGzyibMFeBG0Cj3YlyK0xJbhL1Dr8IZUhcjryEJZ9ATRi9xzYhK/ei5n6Z8QC OCe3w0/ZDhfjQhEg/iv8MXv8eYY3CN+s0kfuzemnrAdQLCUr1k3ZYjEoLEZcJk+j6Ewa 1UwbRsgZvAMYKz20066QT2+uSyQ/2M7Iaco4ZBozWAMVs11892/1bEt4VnVMYVGHv2Xf s8BQ== X-Gm-Message-State: APjAAAX5YKgl1RUuHfdE9Tt5nxyUAJH65A7U4eglKgq5VKIePqzEl5PG JszDKLgLZayFJ2BhWXpmGwxZTg== X-Received: by 2002:a81:5b46:: with SMTP id p67mr6513588ywb.228.1572574084527; Thu, 31 Oct 2019 19:08:04 -0700 (PDT) Received: from localhost.localdomain (li1038-30.members.linode.com. [45.33.96.30]) by smtp.gmail.com with ESMTPSA id m5sm3762076ywj.27.2019.10.31.19.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 19:08:03 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel , Linux Kernel Mailing List , Coresight ML , Robert Walker Cc: Leo Yan Subject: [PATCH v2 0/4] perf cs-etm: Fix synthesizing instruction samples Date: Fri, 1 Nov 2019 10:07:46 +0800 Message-Id: <20191101020750.29063-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=i2il16 # perf inject --itrace=i2il16 -i perf.data -o perf.data.new # perf inject --itrace=i100il16 -i perf.data -o perf.data.new Changes from v1: * Rebased patch set on perf/core branch with latest commit 9fec3cd5fa4a ("perf map: Check if the map still has some refcounts on exit"). 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