Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2409757lqt; Mon, 22 Apr 2024 09:52:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUG8xtvYdXP4z1VT509GzNAGHIveNGMYfo4jczCNxjF/qgOBq0fgx0eUUHgSa8dZDdxEmiIK6IOa7VD1HpCzVv3tRRqf4gJdQipf22etA== X-Google-Smtp-Source: AGHT+IHs4Edf4VN364H2qiAYDqxP8Rv90x80kWtCko51p0WNRyNb4kSNbBL5HhRs0r2fUFWPHnNP X-Received: by 2002:a05:6214:1c8f:b0:69b:5fef:119d with SMTP id ib15-20020a0562141c8f00b0069b5fef119dmr7668307qvb.51.1713804752535; Mon, 22 Apr 2024 09:52:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713804752; cv=pass; d=google.com; s=arc-20160816; b=IbIoJKoZoyfITjXgqWaJIAER6AQrj4bTVrCTCeIdSWsWUL+dF9yyO+Itt3IzqXfr6S JQM+dlrYCCmB5ENXXlVvCIQSS/dFoU8/D19JxNRWySm3y2CD6w/0JUBEKMRY/BjWP9NW mklcG+7O9Fnkv7o19qfMX6hikVfhRECE7Qim4mEgIraKMyx7UjUYrx448ailqoZ523jM d2d+hjNJC8A58FgyeRSd4NIsYb5fL46Q+qncCJMhEpdvjAHbOad0sGWLV6cS/4hg9g/4 3QO7EniI0eheeFZlpAL6dkKs617n6Rk5REpNpEMYvGjCR6u9iLrcY9bOxtYxUwml4W/j 7s8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=5r4wLIlnmCiFKzvBxP33QBl42mA9j1su47SPzLIzzN4=; fh=Wp5wr5RoZxp7MFSRObIWel9fnK+21LHDM1pymfu44wo=; b=hALbd4j10se4BwPGeRwANu8/ZEXs8at0VR+hIIsFPUsWPaN03uLeHJXxOQyTY0FLNE FBan1L2P+9+oGxOK6eiG4ETICMD3WovwRIT8ukyyMzfe53PKE6bn6CmH6PjgT3foM0de sxhtYv5u2MhxQzFL3lkLupBM8bNycrLnBQr20E/17pHwiVhJGmyG6l2SPgJWW00Xyh3j 9IB+ZVXeiIs1Skj8xWUtgxxacA83E2q0cDe0OLgye39tJx3aUOyzX8/TXC4gB9JuI5US NUULyrr3HLYca0SGW54SYz2sHSaZ2cud8nmaGmY6DIsz81tjWgQdVmc/0akpax7EeG9D Ugkw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T4I54mjy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-153754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r12-20020a056214124c00b0069935d75206si11039770qvv.496.2024.04.22.09.52.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T4I54mjy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-153754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CD59D1C21B38 for ; Mon, 22 Apr 2024 16:52:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56EDB15383F; Mon, 22 Apr 2024 16:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T4I54mjy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ACFD15380C; Mon, 22 Apr 2024 16:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713804721; cv=none; b=HpAMKeiLiZd6sNgA70W4aoQ9WfdYvphbjcVoGc6TS+0fWx9kvWFXjmCCspJU2DHc8iox6MbAebhOZWwww/Sh+SqU5Pa9cUb90RGMPXFKmWr6qSc8BoSW/prX618dVFv2r/wTiKmFE6uilfR3IjxG4mbVmm42To/Sll6o47/bnmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713804721; c=relaxed/simple; bh=h8F8EuYbd7584tEXjUGiNOmKoWLUFleWwMYlcYorZjc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sfAMShxZp1zM7BfR5al+YNDJWbwKfZmR1oQo7NGE31+ZohQNTM6wOVD6qa+30anDD+CRe2cnMK5KFiV3dVMM/1BD9vVHMYRiLfWVeaolUYel8I80qIl6cW097EPXkNBeejhIwgUcZrPvScjHeiUPRCspmC56u4RIJdz5ApaJMU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T4I54mjy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3279C113CC; Mon, 22 Apr 2024 16:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713804721; bh=h8F8EuYbd7584tEXjUGiNOmKoWLUFleWwMYlcYorZjc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T4I54mjy3CF/KJobgFwnl6Tz3ZPF2zTZrMBkZQYDrK5PAFniIBGn9Z7mypad214pG hkc5jwBf/5LcpMsPJQ9eqm08syVLqsmLLZLvm5N5lVcdBcRrRktO2AD7521w7wFaOH wmqZnqdNoBFc8D2AQCuApqk8/+rFBFciuxJUMaR+L90ccOUcNG+DpdD3+O1S0WpZfI x9o5Y46czy4qAGmwnvz/YNMcSplOWrh8YfKb7KfUdTFJZBEO2ef/ffjZlPqkFGgu2w mturPN2laKyBDHwoMZcv5qsBwisfxJBVQ2kvq8zAlYo7mMD5j1x/N1Y5vqyulo5xwB y8PCwIDI4mSHw== Date: Mon, 22 Apr 2024 17:51:53 +0100 From: Will Deacon To: Frank Li Cc: Xu Yang , mark.rutland@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, john.g.garry@oracle.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, mike.leach@linaro.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, adrian.hunter@intel.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, imx@lists.linux.dev Subject: Re: [PATCH v10 3/8] perf: imx_perf: let the driver manage the counter usage rather the user Message-ID: <20240422165153.GA6223@willie-the-truck> References: <20240415061320.3948707-1-xu.yang_2@nxp.com> <20240415061320.3948707-3-xu.yang_2@nxp.com> <20240419154913.GA3983@willie-the-truck> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) On Fri, Apr 19, 2024 at 02:38:19PM -0400, Frank Li wrote: > On Fri, Apr 19, 2024 at 04:49:13PM +0100, Will Deacon wrote: > > On Mon, Apr 15, 2024 at 02:13:15PM +0800, Xu Yang wrote: > > > In current design, the user of perf app needs to input counter ID to count > > > events. However, this is not user-friendly since the user needs to lookup > > > the map table to find the counter. Instead of letting the user to input > > > the counter, let this driver to manage the counters in this patch. > > > > > > This will be implemented by: > > > 1. allocate counter 0 for cycle event. > > > 2. find unused counter from 1-10 for reference events. > > > 3. allocate specific counter for counter-specific events. > > > > > > In this patch, counter attr will be kept for back-compatible but all the > > > value passed down by counter= will be ignored. To mark counter-specific > > > events, counter ID will be encoded into perf_pmu_events_attr.id. > > > > > > Reviewed-by: Frank Li > > > Signed-off-by: Xu Yang > > > > > > --- > > > Changes in v6: > > > - new patch > > > Changes in v7: > > > - no changes > > > Changes in v8: > > > - add Rb tag > > > Changes in v9: > > > - keep 'counter' attr for back-compatible > > > Changes in v10: > > > - add some explanation about 'counter' attr in commit message > > > --- > > > drivers/perf/fsl_imx9_ddr_perf.c | 168 ++++++++++++++++++------------- > > > 1 file changed, 100 insertions(+), 68 deletions(-) > > > > [...] > > > > > @@ -245,8 +249,8 @@ static const struct attribute_group ddr_perf_events_attr_group = { > > > .attrs = ddr_perf_events_attrs, > > > }; > > > > > > -PMU_FORMAT_ATTR(event, "config:0-7"); > > > -PMU_FORMAT_ATTR(counter, "config:8-15"); > > > +PMU_FORMAT_ATTR(event, "config:0-15"); > > > +PMU_FORMAT_ATTR(counter, "config:16-23"); > > > > Although these mappings are advertised in sysfs, I don't think we can > > change them because userspace could be relying on them. I also can't > > find any examples of other PMU drivers in the kernel changing these > > mappings after being merged, so please keep tthem the same. > > > > If you need to expand the properties to be 16-bit, then you'll need to > > split them into 2x8-bit fields. > > I just see tools/perf/tests/pmu.c: { "krava01", "config:0-1,62-63\n", } > So I supposed "config:" supported below format > > PMU_FORMAT_ATTR(event, "config:0-7,16-19"); > > I just want to confim with you because I have not found other perf driver > using such format yet. Oh, wow, that's new syntax for me too! Does the perf tool parse it properly? (and what happens if an older tool sees the new syntax?) Will