Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp236795pxb; Tue, 15 Feb 2022 12:09:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVQZxvB463ZZTL5DiWEbHcZhYy6zJ3Mqjk3i79tuMqlz4xrSNzQRm2q/+mraEyUt8FP+Mi X-Received: by 2002:a17:90b:1644:b0:1b9:9986:f740 with SMTP id il4-20020a17090b164400b001b99986f740mr6334886pjb.36.1644955742210; Tue, 15 Feb 2022 12:09:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644955742; cv=none; d=google.com; s=arc-20160816; b=GWhrAFaB/3k3S8xyJbRgBlsBn9TaSGwJNJ/onKV5YqXzGzruv/L9PvC7NHNzR1g2/q lrcQNfci3UMVKib2XRrBM7HMv9qE8SjMBn8Io66zfudcSnIziCg68Sx2ILiSzH5M7aCz MzVvxNgk8uxzIru3hy1BdRLPW84GhHrrbT9L+i3UFGdDB/B+gVmhJtnBGTqMbzdqde5b B1Qg5dZoj2dk6BPCHmVAoqqTKdXgMvRpEOsdnmHhnSB9ok1KRIuMcncEEU/BQdHfEs/h C8m9AWdgr2F1jjp2Z0Z5jsepP9rBCUTjQUzZgedUCnDNduKG4mGQ0iTfQC+0MBFmGPXu h5Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g7ORDp/MmMM2kkJqSV3iRIVI/1LEgeG3EqXuW0xRcxs=; b=o4IBGLdUra4uaCBmha4g8pbXCmHSOM8kIF1ms2ITGgCywy/c6anc3EOdIMT6BzSraJ o0eV97S6OxV+H/YILGs6qCVNBx9RKDqktUPV8J8WDeUe49R+PbT7ZrQoi9iLGWZIdKfY LZ5zZNiVKL37ZR2lKpJnMArB9TMZUZJF/4V9ekWIbRrmttvZfCUm+yb495zL8hn4Uhwr L6FoxN/IsMm59UPhPDScg6sXny2ZkiiB8+pBangxFB4/j8l/ZMs79A7gPuyFeUL6LnCC oE9neTjKPrtnNajAT8xaWH6R3t36SRGg0P/chAHsGvXjmZZdZzfwCR0dsYoB3Co0EU9s fIvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KMhPySvQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11si18794415plg.26.2022.02.15.12.08.30; Tue, 15 Feb 2022 12:09:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KMhPySvQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239624AbiBOPHg (ORCPT + 99 others); Tue, 15 Feb 2022 10:07:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238089AbiBOPHd (ORCPT ); Tue, 15 Feb 2022 10:07:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89877F6; Tue, 15 Feb 2022 07:07:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2621961545; Tue, 15 Feb 2022 15:07:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 531E0C340EB; Tue, 15 Feb 2022 15:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644937641; bh=DnTGqvl5fmkyuT7QiMmF5etuFCDPQuPejculypF4zR8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KMhPySvQsC4weAIAxfHr2zKYI3AGymiL/maKadoaaxofEkJ4D3g1nJH3J8k1uZMB6 H608dLngMLgxtDoN7s/vE7P57fTIF66hwNQrGLoiRECkWj2Jbv9GO2t/zEtc1+owWa qFg9MG40OsJjZlRsClHSSjy0j+5rJXHd52Hr22mHQmfxgKYLIKAMa9peuisx5I/WUf 8IV3dcqBTQx/6q2is2wMG1wEuF+dpsDNUsWe3p0zlGHJ52c0AUQryuZj2sskpQBXAX 6HWXWKEj/Irx6GcylVtLOwWGAt/MIOIA/kwY7zyX9A01hZkTy05dj+QZOSOCA8Z4R1 53cmMliKMxOTw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id DBD7D400FE; Tue, 15 Feb 2022 12:07:18 -0300 (-03) Date: Tue, 15 Feb 2022 12:07:18 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: James Clark , linux-perf-users@vger.kernel.org, mathieu.poirier@linaro.org, coresight@lists.linaro.org, Mike Leach , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] perf: cs-etm: Fix corrupt inject files when only last branch option is enabled Message-ID: References: <20220210200620.1227232-1-james.clark@arm.com> <20220210200620.1227232-2-james.clark@arm.com> <20220211160516.GD475776@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220211160516.GD475776@leoy-ThinkPad-X240s> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Feb 12, 2022 at 12:05:16AM +0800, Leo Yan escreveu: > On Thu, Feb 10, 2022 at 08:06:20PM +0000, James Clark wrote: > > Perf inject with Coresight data generates files that cannot be opened > > when only the last branch option is specified: > > > > perf inject -i perf.data --itrace=l -o inject.data > > perf script -i inject.data > > 0x33faa8 [0x8]: failed to process type: 9 [Bad address] > > > > This is because cs_etm__synth_instruction_sample() is called even when > > the sample type for instructions hasn't been setup. Last branch records > > are attached to instruction samples so it doesn't make sense to generate > > them when --itrace=i isn't specified anyway. > > > > This change disables all calls of cs_etm__synth_instruction_sample() > > unless --itrace=i is specified, resulting in a file with no samples if > > only --itrace=l is provided, rather than a bad file. > > > > Signed-off-by: James Clark > > Reviewed-by: Leo Yan Thanks, applied. - Arnaldo > > --- > > tools/perf/util/cs-etm.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > > index 796a065a500e..8b95fb3c4d7b 100644 > > --- a/tools/perf/util/cs-etm.c > > +++ b/tools/perf/util/cs-etm.c > > @@ -1553,6 +1553,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, > > goto swap_packet; > > > > if (etmq->etm->synth_opts.last_branch && > > + etmq->etm->synth_opts.instructions && > > tidq->prev_packet->sample_type == CS_ETM_RANGE) { > > u64 addr; > > > > @@ -1610,6 +1611,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq, > > * the trace. > > */ > > if (etmq->etm->synth_opts.last_branch && > > + etmq->etm->synth_opts.instructions && > > tidq->prev_packet->sample_type == CS_ETM_RANGE) { > > u64 addr; > > > > -- > > 2.28.0 > > -- - Arnaldo