Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp243082lqj; Wed, 10 Apr 2024 09:09:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxCBLMxiB/734+jRASX6JGFoktjn69+bQBSq5rWNyzoOGqewPKK0c4AAzi//rN7Tl5iklvlHAFZfD/xH/XkhP6zKB4eMosHzx64sPCeA== X-Google-Smtp-Source: AGHT+IEGVN2Y3Q5aJEpfNQQulO7xXyQwAWJPZXdrSM+8l7hvCeWEj+JdH25CLF935Gu6oJofFEBq X-Received: by 2002:a05:6a20:6a24:b0:1a7:76fc:46f9 with SMTP id p36-20020a056a206a2400b001a776fc46f9mr4506681pzk.26.1712765389314; Wed, 10 Apr 2024 09:09:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712765389; cv=pass; d=google.com; s=arc-20160816; b=ABKuSpqmofKeUkofzbrE1owFQ8CxPI5tRsNqfXgUzB+EMtfW+WhlOE7pvg5oo8e/Lc W66x38CfMOio0DG5E2X/NGnGVMJEqjcJOTrDwrXGmXGH1d702Gz4bJgI3RItciE9LjoA u2F3gkF8qcudkOsWbvFEZtLaoNKttaHujucFW8n0pCVnoPREN/L+XNTAcBNgj0dYmm81 pj8yPXAMiHsZ8hyuZ5kFhE2Viw1xaFiHwSpHQUeRh7HWvmLTj3w3tWLhLsM2mMK3fcvZ oYy4aXuYzACP6C7qyyFZGOnqXcdfg04y+dYaGcAreK0dzE+b1m22nRMUU4ZveJBNw4Br oQ4A== 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=ARKxwb75WSROUHpo837CVXRFv0iu77AhedjUFXRiiSU=; fh=dr8nEH+xaC+LanfpJ4cPU+OJ/Gh7auuRYfQUTOW3KYQ=; b=daaVjZOkK5on5pQV+BUxswOqlGqgDdHaeqL6I/poiYyDaPx7qQEfvN7XLmy9CiX5v2 VoCdkL44xjC5EZgoR9ShgRnZlNWCHgYOhMYnCkLqLn1VjzGza6nZ4T78T/wR54+0EWz5 1v/lCqOjeuoyfyOGlwGr6EMf6+qB1qer+Lu9aGLI7oNRJmQ4nFu3iqFlAeOpJU8K1Zik fqdvZnG4Illc0C3GUY+IFoz1qBNmMcUQlMpTe0VHMmns0CX+If93/KRACS6qykszhfiR HgL19Jji+Qz1k9u16ReDHZ93cvMqbYeZEoU27lN/YVYbhLRxfXo4jwRirS2w0gZoORDQ 6KdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hztov4Vi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e15-20020a631e0f000000b005e46d335070si10907481pge.203.2024.04.10.09.09.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 09:09:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hztov4Vi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138909-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 36694B27F12 for ; Wed, 10 Apr 2024 15:46:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60B0E16F0EA; Wed, 10 Apr 2024 15:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hztov4Vi" 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 769631E878; Wed, 10 Apr 2024 15:45:55 +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=1712763955; cv=none; b=CkmtlIp7JkCNQer5QB2yRfHCRA+EE1uMyXOWee/SjiXCI+CH7hAoYuv6AXFMUm5+FKVqax2feClSMRKZTkwy181E1k/3sWpp38yyeoxhHfW46rbsXfOhIJPB4Rn5wAkWSxyifUzfiwu06SpCHeQdmJ3dyCvdcx1cU87OmCSScJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763955; c=relaxed/simple; bh=Iws5TST+OzZUPfFNgljptP+ZHHp7PyVhznvweeW0O3I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NrXEVQoxKJYPovdGpwE5LZ0bNA+YfJokKOUIMA6IzE0sS+CqUsKuZhjqe4knKSGFArZBZ4hgyoWlTXvo+HZolatSYS6xzHxfbTLNs0w39jhWL47Zwiov7Xtw2PQ5QwIzQtcYIQLl21/cHumO8pf0314JkfdkGZI9g1RqTnrNfQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hztov4Vi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9686BC433C7; Wed, 10 Apr 2024 15:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712763955; bh=Iws5TST+OzZUPfFNgljptP+ZHHp7PyVhznvweeW0O3I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hztov4Vi8VkLznfPfx81BXFAyzQZRGXg8qs8z09Njupjvxnx0lq8moLtVwrtZ4ugW PC8HjJtzouaE2i7H0Fns76YObHbCk/NIkxZi/v36frgl5gP0eRQU6Yy7FjaIqmZeAs yNY4mKMoX/OlZUES+oyLQeYbXzLk0cWgTsFnn7t3QV1WdJLLJuUAVd7YTMtMU8Z6XV uXmd1hMQlpO7+R0QCk1KOHaVrg4BK2KNNGvLQuukpT85ZEkIGDSmtDjxdF08TxWyci FgVLt/uUPuyMo/JzX/4rG9ptLVA+EK4KPlPluLZ+tn/CzS8LgW5E+NzCSeU7Q5n+76 +mWkohOqm0IwQ== Date: Wed, 10 Apr 2024 16:45:47 +0100 From: Will Deacon To: Xu Yang Cc: Frank Li , "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: [EXT] Re: [PATCH v8 3/8] perf: imx_perf: let the driver manage the counter usage rather the user Message-ID: <20240410154546.GA25225@willie-the-truck> References: <20240322063930.749126-1-xu.yang_2@nxp.com> <20240322063930.749126-3-xu.yang_2@nxp.com> <20240409152627.GA23621@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 Wed, Apr 10, 2024 at 07:39:46AM +0000, Xu Yang wrote: > > On Fri, Mar 22, 2024 at 02:39:25PM +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. > > > > I think we still have to support the old interface so that we don't break > > those existing users (even if the driver just ignores whatever counter ID > > is provided in a backwards-compatible way). > > > > > 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 attribute is removed too. 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 > > > --- > > > drivers/perf/fsl_imx9_ddr_perf.c | 168 ++++++++++++++++++------------- > > > 1 file changed, 99 insertions(+), 69 deletions(-) > > > > > > diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c > > > index 0017f2c9ef91..b728719b494c 100644 > > > --- a/drivers/perf/fsl_imx9_ddr_perf.c > > > +++ b/drivers/perf/fsl_imx9_ddr_perf.c > > > @@ -245,14 +249,12 @@ 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"); > > > > Sadly, this is a user-visible change so I think it will break old tools, > > won't it? > > For imx ddr pmu, most of the people will use metrics rather event itself, > and we have speficy the format of event parameters in metrics table. > The parameters is also updated in this patchset. > > And to easy use for user, the counter should be hidden (transparent) to > user after I had talk with Frank. Then, the user need't to look up the event > table to find which counter to use. > > So this patchset will basically not break the usage of perf tools and will > improve practicality. Sorry, but I don't agree. The original commit adding this driver (55691f99d417) gives the following examples in the commit message: For example: perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_trans_filt,counter=2,axi_mask=ID_MASK,axi_id=ID/ perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_wr_trans_filt,counter=3,axi_mask=ID_MASK,axi_id=ID/ perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_beat_filt,counter=4,axi_mask=ID_MASK,axi_id=ID/ I don't think these will work any more if we apply this patch. Will