Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1793977rdh; Tue, 26 Sep 2023 03:59:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu+Y6gEC+44WGG1GLuisGvVCO41kBhaCs1Yl+iWhUsdEpVcGdh5BB0WX92L4Jz/w/cfzzP X-Received: by 2002:a05:6358:618c:b0:141:162:b0cd with SMTP id w12-20020a056358618c00b001410162b0cdmr12366777rww.19.1695725986884; Tue, 26 Sep 2023 03:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695725986; cv=none; d=google.com; s=arc-20160816; b=VGDr8fXhUT/phZD/HffRf6wgLd7Nw33Z2la8N6G2KdSK013UfPwWhv+2LHYTT3XdFv 9UnAWpmO7UmHYhDjcGG75anNxKDPxdHmbev4lmByiuaRp1IbJD9knoOClLAU3vb/gr9h iWa8/EO1g88pOMIflh1ohkmuKU0QplxkIyt/qaORz49MtkkiHWmPMl9t1R7KUgWeS3Kr 2/FUi46mZgLVb9rUV2WSlfJEuo4eKF7eC+KpV7XDYYK8YnZ087GYfaIdpVdLbxMdagrv xB/y+X0KE2r2zEEE4932vwPMaD2ERL2bmM6I8TA50REPEXlJuXkCeTXyvrjlQLFN222c E7fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=dKJryWcn9CRZAiispx0zUtDkXS+Ej6Q/znd5t3Dyzjo=; fh=ngMXrwVVkYErAo73taPBGJMGAbx+EqTFmsLY4wVooDI=; b=zufyVDGrQ3tNDNeT/7q2Cd9yE9HrvfKAzEks+hLbk8TKYM+kC4gzq/8z0QZOQZcxx8 Lqm/X3AU4/5IHib11Hf2P0fytMUUyymFOaQDSLdDNkNo2cCiNrRYHmybXyKrAvDjFls7 t4BqnbatYz8nEoBb1XJLMy5fA+MCdRqNU2HHVztA/3b3KsuRcCrgX+SouUWzfaFODhq6 8n6Ul0q8UfZ/L3w/XTh+ho9BuCig8LpXwrwuQn7siFV/iebEgotJOFQuygD0nSVuZgGW 1/B0L+mrVkLCRYre1L/6I5IigIpdGe/4ofOxG02twDUIblRHRaAjgrM02aSVkVY6hv6C MwgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q22-20020a056a00151600b0068a5877bfaesi12940156pfu.382.2023.09.26.03.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 03:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6DE178227786; Tue, 26 Sep 2023 03:56:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234473AbjIZK4v (ORCPT + 99 others); Tue, 26 Sep 2023 06:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbjIZK4u (ORCPT ); Tue, 26 Sep 2023 06:56:50 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 23C8495; Tue, 26 Sep 2023 03:56:44 -0700 (PDT) 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 1AD1E1FB; Tue, 26 Sep 2023 03:57:22 -0700 (PDT) Received: from [10.57.95.200] (unknown [10.57.95.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54FD33F6C4; Tue, 26 Sep 2023 03:56:42 -0700 (PDT) Message-ID: <71403f39-5894-154d-022a-f42fb344e488@arm.com> Date: Tue, 26 Sep 2023 11:56:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] perf cs-etm: Fix missing decoder for per-process trace Content-Language: en-US To: Besar Wicaksono , mike.leach@linaro.org, suzuki.poulose@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-tegra@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com, vsethi@nvidia.com, rwiley@nvidia.com, ywan@nvidia.com References: <20230919224553.1658-1-bwicaksono@nvidia.com> From: James Clark In-Reply-To: <20230919224553.1658-1-bwicaksono@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 03:56:51 -0700 (PDT) On 19/09/2023 23:45, Besar Wicaksono wrote: > The decoder creation for raw trace uses metadata from the first CPU. > On per-process/per-thread traces, the first CPU is CPU0. If CPU0 trace > is not enabled, its metadata will be marked unused and the decoder is > not created. Perf report dump skips the decoding part because the > decoder is missing. > Hi Besar, It's not just per-process trace, the bug is also in per-cpu mode but it means that the metadata from CPU 0 is used for every decoder which is wrong. Although your change also fixes this issue. > To fix this, use metadata of the CPU associated with sample object. > > Signed-off-by: Besar Wicaksono > --- > tools/perf/util/cs-etm.c | 130 +++++++++++++++++++++++---------------- > 1 file changed, 77 insertions(+), 53 deletions(-) > [...] > + if (!formatted) { > + /* > + * There is only one decoder when unformatted. Use metadata of > + * sample AUX cpu. > + */ > + t_param = t_params; > + metadata = get_cpu_data(etm, sample_cpu); > + if (!metadata) { > + pr_err("CS_ETM: invalid sample CPU: %d\n", sample_cpu); > return -EINVAL; > } Apart from Mike's comments, this looks ok. Thanks for fixing this it has been on our list for a while. One issue with calling get_cpu_data() with the sample CPU ID is that it won't work with old files that don't have the CPU sample flag set. Mike added the sample flag fairly recently, and I don't think that was a breaking change for old files at that time. It should be easy to avoid that by still returning the metadata from CPU 0 when CPU = -1 (Which isn't correct but is 99% likely to work). I checked the Coresight tests and they're all passing, at least on a system without ETE. If you could make sure they're all passing for you as well that would be great: sudo ./perf test coresight I think they currently only work from an in source build, if you get stuck there. Thanks James