Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1792354pxk; Tue, 1 Sep 2020 07:57:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHyPcZ3trre1H+heB85eNA8fTq+p0XmCZnUmmCoXsEDEc4hTjJSd7PuU5Ell07TIdiVEn1 X-Received: by 2002:a17:906:b156:: with SMTP id bt22mr1748654ejb.481.1598972266304; Tue, 01 Sep 2020 07:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972266; cv=none; d=google.com; s=arc-20160816; b=vhz5g2gdc4xhS6UDRgJC9XKxnwUzh7i8NRXxLPFXjKUMY7pDU0mrXzNY56jVcYMxN/ S/XjrDqLwt8HQXfzSOMNNg4Vjyr01S90wS0k+mNppMIvWsiFjJoiwx5yQCGbdjC/TzhD IOsfaaEaqAx6noWQAfY4U0Ra7yYMvN4+T09FMHKAZu4Zr9MXtPo6AchFAMbqmydHpjbf eGKUgj2ckTrEFPTE0OVyQWix63EWz0fVzPMeuhJBcI7c0DRRmBYC2hcBXAuZgCKUKBvD DFYU2qUkaAMw+QfmQBuO67iq/MbwLQbxnAUYXZ9PnchzcoVLpsSpQdgETN8R+JrJ6b3j +HRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DnM3CPP6gaaCXAhsrBCrOBhEOkbxQp49XhwQECesUMM=; b=gA/q/Xkiwtd2hvzpcZGqNked4ZQyBRw4tk/maDJIj9snoSkPdUoMhyPCOZJK/3mqyZ GalIJVwVMsERIkPFohNKfDgRKMMT4RVW3DR8lXb4GxXC32cOZ7VtoIcA+11wDo8zhA4L mNMFVqlXx6oAq8rwiPLZcYn2UkBtEsVe6/FaJrgN7luRA4X9uiYR2QMrlMDUbgGg/aem hhlFsFHU1U43rv+RqeDwNEmQp84ouLue1ylHlnXLwdSiGVaYpu8Bm3SqJEUYld3RlHy9 xnQYOfIHm4SZtJU7G87IFEO4YU8wP0e3XJxqf6Pq2fioP2nIb5sgycyv5F+1rGpJTORF jOjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s2M6tw5X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l11si758976ejx.11.2020.09.01.07.57.23; Tue, 01 Sep 2020 07:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s2M6tw5X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728853AbgIAOxm (ORCPT + 99 others); Tue, 1 Sep 2020 10:53:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:40204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728386AbgIAOxf (ORCPT ); Tue, 1 Sep 2020 10:53:35 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (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 BF05B206FA; Tue, 1 Sep 2020 14:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598972014; bh=HpWZik1j9+sfkS0/wxDG2E/McFvOr29VTlfELilXyDk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s2M6tw5X2FLoO+ZaIl4ZPFNPkHUGNWOZL/zyWY1eneiNGh28OmxjMRbVMiAcof+Vu soAAVcPhNf9jBLHjBnIkLm7/FpfSyEQbLb5MSfeXD1GZDCA9LOU6C50kbyo4bVmRds gUQavtUt0yb/rahYnLHiF2bYNhddSHACmA+oW5A4= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 4446840D3D; Tue, 1 Sep 2020 11:53:31 -0300 (-03) Date: Tue, 1 Sep 2020 11:53:31 -0300 From: Arnaldo Carvalho de Melo To: Mathieu Poirier Cc: Leo Yan , Suzuki K Poulose , Mike Leach , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Andi Kleen , Kan Liang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AAl Grant Subject: Re: [PATCH 2/2] perf intel-pt: Fix corrupt data after perf inject from Message-ID: <20200901145331.GA1422817@kernel.org> References: <20200819084751.17686-1-leo.yan@linaro.org> <20200819084751.17686-2-leo.yan@linaro.org> <20200831203832.GA120995@xps15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200831203832.GA120995@xps15> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Aug 31, 2020 at 02:38:32PM -0600, Mathieu Poirier escreveu: > On Wed, Aug 19, 2020 at 04:47:51PM +0800, 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 > > Arnaldo, please consider. > > Reviewed-by: Mathieu Poirier Thanks, applied, and 1/2 too. - Arnaldo > > --- > > 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; > > -- > > 2.17.1 > > -- - Arnaldo