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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B41AC433EF for ; Tue, 22 Feb 2022 15:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gkwYxa/aXs38B81vPKgajI5QuGxCENTse4eJRshsbNM=; b=z3HhOanSNruqNP UV8jw+aven9t0vc1QhCDaX0vfE1u0y3g1XDfbnqi2Tvzg8zx0/xt9XjSA7vIeCctutJ5WM+yrq6PV XxMFs8R0RTjNOCgqO5UvTOdAoSGYxvc+eD6tWMBetdrkY0QRFD+v2k2R88Cs23KdhvyoPjsTR5DmV MaYP9djhNIbNgsBTAwZ7WO0wZjfcrKzNTBEVD2ctvFqhOHvV4C/Rh2i+1eRnimRp/TzlpxNlpdQBg pyNG2S6BfOJqv0Z3MBVDgyaXRbavKAFDBNc7DuCgNWQIsSEDlmOuI4nNgHt6m7RZuMyC6YNXXk0ck /PFhUH+18s3G6bWhIIHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMXQA-00AOy0-OH; Tue, 22 Feb 2022 15:49:47 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMXQ2-00AOub-3R for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 15:49:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 607211042; Tue, 22 Feb 2022 07:49:35 -0800 (PST) Received: from [10.57.39.208] (unknown [10.57.39.208]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 878FF3F70D; Tue, 22 Feb 2022 07:49:32 -0800 (PST) Message-ID: <8f563870-3410-221d-4464-5c54a0018b55@arm.com> Date: Tue, 22 Feb 2022 15:49:30 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 2/2] perf: cs-etm: Fix corrupt inject files when only last branch option is enabled Content-Language: en-US To: Arnaldo Carvalho de Melo , Leo Yan Cc: 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 References: <20220210200620.1227232-1-james.clark@arm.com> <20220210200620.1227232-2-james.clark@arm.com> <20220211160516.GD475776@leoy-ThinkPad-X240s> From: James Clark In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220222_074938_293683_DB0871D5 X-CRM114-Status: GOOD ( 15.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 15/02/2022 15:07, Arnaldo Carvalho de Melo wrote: > 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 > Thanks Leo and 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 >>> > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel