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 4A82BC433EF for ; Fri, 11 Feb 2022 16:06:54 +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=Bd8IkXvGMo6MynWsa4JIQlFlQeyY+15+CcoRCsWMX04=; b=hW9fEVaBMGUNi7 Q5mS0Wuw3jBzozUgPhTzUHM+nkQwl6VHv2jg98oPUWTr99+kBJ0M7F8gKz+fc+799qaaeBkRVUXtc zwD2el+FKS7HgbR+6w3dVFRIbdT8AXCebmI/QATFSnU+DPHWGZ+yUKLAmDv3ie43l6VK+uISn0vi1 mr2md8fdpG1NXRPQwIdjnrE6MrkmOSNbDdkyIOHrFv792IbU1El2en9hpSSqjQTyMLIKF4BhiCgc0 F/hd3jp+n9vnQdzW6TnBseZdAKv4VtR+YArct6TQITIadouEpdh/aPhiHfHxPXkH+pHt233450vf+ PO9bJVIy+9Ua2GMqIIuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIYQK-007ugY-Fq; Fri, 11 Feb 2022 16:05:28 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIYQH-007ufO-ED for linux-arm-kernel@lists.infradead.org; Fri, 11 Feb 2022 16:05:27 +0000 Received: by mail-ej1-x636.google.com with SMTP id ft32so8125651ejc.11 for ; Fri, 11 Feb 2022 08:05:24 -0800 (PST) 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=csB5DuqtfIDJ9EKSK8fiwWzQpRbB0qD6Vp/GW/qS/YQ=; b=grEYtNAoCYLkvBJEJgtJxnsTjxHc/cgpoV/QsJ19fyD5CPUsYizKM6gFegxVCO//Mm D8jAgZaBtnMbVMY7/IWuYayVDI/OH/cpqxeyW2R8ibZpnkkkzEY+zsBlgU1tLjRd8EDb hZlL83Q1UxrbIZHykr0xKJbiqE0qz38TTXFw6xoFzInhDy8Qe3vMx+4nSBQXPhE4oBgl I1hbu0VXWqMnD4IqElhASijRmdRvHCB/ZuhESFpEUu7EYyW6F+cdnY2Axi4+ElKljMSt zEWM6e9mBfNF/9Om96x819gasq0kLF7VNBubi3YnqQI8X+tqzsT9skc1OTJn8lYhWjTR gRgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=csB5DuqtfIDJ9EKSK8fiwWzQpRbB0qD6Vp/GW/qS/YQ=; b=BnQLhn0isHh5fFRHnC0VpRFdaBGnuClXlcIAOA3VjAhNH6GyDDX7NtRzrWeXFuvIaE NxpmFppIqk2pLUSZH/Pu3qX8Z3adFqOOWrfq7PMp6Saphg+bsASedGv5vVy4RqdX2oVu JGX0pvf+JHZ5ZLPw3PqyvIbpSW5LEn4Qb4iupXKSjlkOnC34E5qx7LFq+fiH1joMNwRJ D1IXnFsgKpf5v/SJK4w1pcEqIIUZ510v+XlEjIR/fcTHs6qvPA15YBvEMnUt+zZfzIei JOvdDJmhT6EPkWC3AKvVlz50KcY+gO6WPLpvd9Oz9shwRNxGtoxa6HWrTD43NWaenq92 KpGw== X-Gm-Message-State: AOAM533YmuzLTdWVGPkQhWiA8aujnqpb8p1iVyu0mJLPTrywD7pW/NC3 j20LzOs/o2/IkBM41s6isvOFOA== X-Google-Smtp-Source: ABdhPJw5QT9Y+IdfGntvtWKYXBrXdelCVroLEMdDbamYIFpp+AWguR/K4n0J65D0Y0UuY+gJH2msDg== X-Received: by 2002:a17:906:58cc:: with SMTP id e12mr2008984ejs.162.1644595523236; Fri, 11 Feb 2022 08:05:23 -0800 (PST) Received: from leoy-ThinkPad-X240s ([104.245.96.223]) by smtp.gmail.com with ESMTPSA id p19sm8062729ejc.42.2022.02.11.08.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 08:05:22 -0800 (PST) Date: Sat, 12 Feb 2022 00:05:16 +0800 From: Leo Yan To: James Clark Cc: acme@kernel.org, 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: <20220211160516.GD475776@leoy-ThinkPad-X240s> References: <20220210200620.1227232-1-james.clark@arm.com> <20220210200620.1227232-2-james.clark@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220210200620.1227232-2-james.clark@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220211_080525_521578_33AE6E35 X-CRM114-Status: GOOD ( 21.68 ) 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 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 > --- > 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