Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp717570pxa; Thu, 27 Aug 2020 13:56:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6DRWGPeJkj4k3MoMZ79j4O111WKN6pCdq7+lnyJhavA9eNeu/NYNksRWjejG5ytmJgUP/ X-Received: by 2002:a17:906:7b83:: with SMTP id s3mr22505480ejo.2.1598561762712; Thu, 27 Aug 2020 13:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598561762; cv=none; d=google.com; s=arc-20160816; b=jV+axHXMN7AEByumLbtU47EC99DdkeRypbPP/oSMYrAwCoGPvUQmPb+8Py34+fL4J4 i+CBSJ5N4w7Rta2CQLzJ3QDfmyt20M/a44LtBfe1CB/gplVn6Y4+w0faW2Ae9n1ibNdD /0bF93V0wBbW1bDTCP9Uivlgj3q662+XbbX6BczUErYKOfXfUk7pnlMUkcKbRcO4gqMy dAR1qrMRlmqTeEa6Bc0TC6hsukCNvAf1Pb2Pn4CetHauoYseJqH3ASdM6Rz5dlAnyPGM Lu6lVb8Wbm+pjNn1ssz9duyjXYcmhfr6u47FIT8R7gyTutWUS7PYPpjt1b4A9SrLQ/QT 8Sig== 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=IcrAzu0/UMhNvU/QrMjkiMrk/PLtQgMkds9y37Yu4qg=; b=yViL4+uLNYdN9LmX+OL+qd3a6CYX55ES++pKUSJpai+bKhi/iH1dW47pZw7sa6mErj QGxJ7FI2jMsAy9Kh4VY4BjpjBmzc4hxjMe3l6dsoSMis4lOUfTYl0xBSWRGGJ7mtwrvg 8d4ffECd9SNUpgVrDQwDNT/u5RJvZedWWx+MB9Cb1xF0tpGgMffvk9/SInvmS14XXLXP 2qV/ZTo6XsQDI6IG+p2mNk600J8whvcRy9HL3/Qz0j2HrdukbEGpuFrjd+/8WZIHNmtJ eI01k7v2IUztOyhVvLN1I2YPslSWN7/qbaUCNNj3QF+XoQj0JHCq9Jf71MdfwrUKNxgW hFDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LLS0EAFF; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si2008141ejh.622.2020.08.27.13.55.38; Thu, 27 Aug 2020 13:56:02 -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=@linaro.org header.s=google header.b=LLS0EAFF; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbgH0Ux7 (ORCPT + 99 others); Thu, 27 Aug 2020 16:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0Ux6 (ORCPT ); Thu, 27 Aug 2020 16:53:58 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CFCAC061264 for ; Thu, 27 Aug 2020 13:53:58 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id m8so4440630pfh.3 for ; Thu, 27 Aug 2020 13:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IcrAzu0/UMhNvU/QrMjkiMrk/PLtQgMkds9y37Yu4qg=; b=LLS0EAFFujy5fRuUgd1HMdou2VPRHvhJHVGPx88qbNkBmrp8bDnDuSu1oY20uM3NSJ bcWQ/aR7gtU9XCl4E3YUN9VnoGmQx4Nm6uZhRMJG+Q1QAglTe0Pq7+MyYf/Sc2Dou9+e KoTNfGLzgMtMu6Ccy560d9o+Duj8HUmhC+LgZd4h/HAREzMeHvjNEKVIkph0WVBmuQOj wHoIAsO97H22BlpOGpNNyHE+EGH6TqOV/CBByLEmJQBPj97d7IE2gxWV5cgn492608TW afz78x54mz01cNmCtK+8EzTn0zHijsHp9dMHFU2zIdGCoke3HU5fh4vkuXKXKNV5n/ab f+HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IcrAzu0/UMhNvU/QrMjkiMrk/PLtQgMkds9y37Yu4qg=; b=Zk6/EFhAtvQNPjJayCy9guRCaEovrjYsXI1upTKQQFx7zvZisoku501/S0JA3AelHE FBF+4cue7XDel6v2ByhXCyXENa/YJ2NxipuBUST6F1SrqkuMKyTnUWDseEliIamFU2O3 gvG7tQeP3XXV0J6LMicJUvg0kk+PoH7pKSXGaieK19fCqx3K0cQXVgDCATkXEG+KsX0W +pKsXv4sxo4HcA1V05Nb9Q6gz8mlq8844NCGryo4gYW7UOH17AF5Ewd+D/CPGo0/CLsp Kb5Vb7sc1S5tQ3ITV8cmqLDwspgX2A29mwUKpGcimEmd8kNpy82bPC7TbwYWMw/AxmaW 5GVg== X-Gm-Message-State: AOAM5339v1eDlC7GqqAxP2ma9x/vJ4m8jV0jX8f3S7wk3JvwsiWTAfSM EjdkH5XaQXJteDc741/qo+elHQ== X-Received: by 2002:a17:902:b28a:: with SMTP id u10mr2912502plr.30.1598561637578; Thu, 27 Aug 2020 13:53:57 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id q11sm3266818pgj.92.2020.08.27.13.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 13:53:57 -0700 (PDT) Date: Thu, 27 Aug 2020 14:53:54 -0600 From: Mathieu Poirier To: Leo Yan Cc: Arnaldo Carvalho de Melo , 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, Al Grant Subject: Re: [PATCH 1/2] perf cs-etm: Fix corrupt data after perf inject from Message-ID: <20200827205354.GE22307@xps15> References: <20200819084751.17686-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819084751.17686-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Leo and Al, On Wed, Aug 19, 2020 at 04:47:50PM +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 CoreSight ETM trace 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 > Reviewed-by: Andrea Brunato > Signed-off-by: Leo Yan > --- > tools/perf/util/cs-etm.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index c283223fb31f..a2a369e2fbb6 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, > attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR; > } > > - if (etm->synth_opts.last_branch) > + if (etm->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; > + } I've see this patch before... I thought it had been merged - what happened? Thanks, Mathieu > > if (etm->synth_opts.instructions) { > attr.config = PERF_COUNT_HW_INSTRUCTIONS; > -- > 2.17.1 >