From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B9EC433DF for ; Mon, 24 Aug 2020 12:43:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A0CAD20706 for ; Mon, 24 Aug 2020 12:43:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0/9UPUnj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0CAD20706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HmnkrM2rFnQHJ+ZBAgGPQRW8eDF7S1d3QhmMCADox0E=; b=0/9UPUnjbSAdVancha2yHIV0Q JKxkybwbtdxGmbFuXmkVGx8MpjCDd+2y17doB3UvWSvlPz8pDE/9ihAlSyjCTVhXKK+vGR5J5bEM1 Dcu6MX3eIrl0WYCKwYLebs5f1gmR1KMEtg6RQ0jnJMlIBehhr3Gzd2fuzIdgWYzVl5l1aG68gkpL9 +CVqiYrcqCOPcYTuGxjPCleoaLwCxfOiY7+bIedCEbCEp99GeIchdvqYVcs8zBCSV5xPqU5T7fTwG RnIZzt8kJXCP9aLnF+LPOca0xPbSUD/A7kVtXOo9d3FFGdXokSKTMJuHy/5YleHj5N7C3GZ0fNWP3 +yMxJlhRg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kABnX-000496-J1; Mon, 24 Aug 2020 12:42:03 +0000 Received: from mga14.intel.com ([192.55.52.115]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kABnT-00048C-RR for linux-arm-kernel@lists.infradead.org; Mon, 24 Aug 2020 12:42:00 +0000 IronPort-SDR: /D37feZlS0nRYQ2G1HA9rtbULD99jJWnNoPLAcU+Hv10LdH1eK0zR7I+hkhtiyD9sed3EiEMQw HnXVxQkJvaKQ== X-IronPort-AV: E=McAfee;i="6000,8403,9722"; a="155146237" X-IronPort-AV: E=Sophos;i="5.76,348,1592895600"; d="scan'208";a="155146237" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 05:41:55 -0700 IronPort-SDR: nHxh7m7iG/L4ELDnjySrE9FkOh8ejEXHx7CCTm18bB1uWzWQyE57N3Nfldf30Gp9NLo2MuJLvu J4r3IvzJavhw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,348,1592895600"; d="scan'208";a="331007620" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.73]) ([10.237.72.73]) by fmsmga002.fm.intel.com with ESMTP; 24 Aug 2020 05:41:47 -0700 Subject: Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from To: Leo Yan , Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , Kan Liang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20200819084751.17686-1-leo.yan@linaro.org> <20200819084751.17686-2-leo.yan@linaro.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Mon, 24 Aug 2020 15:41:13 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200819084751.17686-2-leo.yan@linaro.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200824_084200_058988_15EC1F0B X-CRM114-Status: GOOD ( 28.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Al Grant Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 19/08/20 11:47 am, Leo Yan wrote: > From: Al Grant > > Commit 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack") > changed the format of branch stacks in perf samples. When samples use > this new format, a flag must be set in the corresponding event. > Synthesized branch stacks generated from Intel PT were using the new > format, but not setting the event attribute, leading to consumers > seeing corrupt data. This patch fixes the issue by setting the event > attribute to indicate use of the new format. > > Fixes: 42bbabed09ce ("perf tools: Add hw_idx in struct branch_stack") > Signed-off-by: Al Grant > Signed-off-by: Leo Yan Acked-by: Adrian Hunter > --- > tools/perf/util/intel-pt.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c > index 2a8d245351e7..0af4e81c46e2 100644 > --- a/tools/perf/util/intel-pt.c > +++ b/tools/perf/util/intel-pt.c > @@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt, > > if (pt->synth_opts.callchain) > attr.sample_type |= PERF_SAMPLE_CALLCHAIN; > - if (pt->synth_opts.last_branch) > + if (pt->synth_opts.last_branch) { > attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; > + /* > + * We don't use the hardware index, but the sample generation > + * code uses the new format branch_stack with this field, > + * so the event attributes must indicate that it's present. > + */ > + attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX; > + } > > if (pt->synth_opts.instructions) { > attr.config = PERF_COUNT_HW_INSTRUCTIONS; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel