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 35B6AC433EF for ; Tue, 15 Feb 2022 15:08:35 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oUfKfwJJbpDgUJs9uJlOMNq5ioBoMd+DTywysTaKrFo=; b=wKErOm7lVyZWm/ cpIbESKbn0aithd+ceRGowK1Z3it+YaCGS3fTn4U+5q20F9XRyKG+44rbw6/KLUa7hzQuP0x8iRkl 0PXB+4TCZ0xuqSp6NokRqFXI+phC4dwY+G/6XqBuaJ/WLOQH+/6qt5XULPm4fxc5qldkSJCjZHcAI MWLVKq1HF8UTYkqnjK+0ibRROk62LzLKDS6EMxb4JBKO72OihK+dKBYupPZEQefVgbnPmYtS75+vN Ja/kgI78vLFC9+0xlqA8LnNJF+Wl5PPjqzPdZm5RwP1ovb/8qM3uZXHOs0xTb9k6o6LwiifszlWCD yZq2MCPPX8qRwCZUs2Tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJzQL-003Azg-90; Tue, 15 Feb 2022 15:07:25 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJzQJ-003AzU-Fy for linux-arm-kernel@bombadil.infradead.org; Tue, 15 Feb 2022 15:07:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=g7ORDp/MmMM2kkJqSV3iRIVI/1LEgeG3EqXuW0xRcxs=; b=hjcAYTq7OvDuaHlX/TFvGJbSct 2/6VhD0gc6jvb/zVi921wl32juXpSNX/tmPvgFJn38a4/HS5pWlCTUnKuDi2RGuvLq9S3d6zxkj9y wG0yrT5dXCuMULJwKvg1BhXrUQZIXncuKdx0vyJGdDcGz70PBvHk/zxJqA1sPi04ZtdmYrIJNhkpi DArYwssWNDrPZf2040K8pZPZiC/qM1et2A6l0UcknjGfrNRHBtfXG1WamPSSbGfeuZ5oVtsUqBG4V VL5KEpJ0I6EFyiZ76OBIowtqdT++1FdJ8Vb5eRXxlthn+VlxXP9ttgc/r4tOGTly9A0/KpMzAFL/w A8lLeUuA==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJzQH-00Dw68-UN for linux-arm-kernel@lists.infradead.org; Tue, 15 Feb 2022 15:07:22 +0000 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-Disposition: inline In-Reply-To: <20220211160516.GD475776@leoy-ThinkPad-X240s> X-Url: http://acmel.wordpress.com 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel