From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: will@kernel.org, mark.rutland@arm.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, jeremy.linton@arm.com,
ilkka@os.amperecomputing.com, renyu.zj@linux.alibaba.com
Subject: Re: [PATCH 3/3] perf/arm-cmn: Enable per-DTC counter allocation
Date: Fri, 20 Oct 2023 16:00:37 -0700 (PDT) [thread overview]
Message-ID: <fa35f25b-2db8-daa1-1817-3ac256fc27ec@os.amperecomputing.com> (raw)
In-Reply-To: <849f65566582cb102c6d0843d0f26e231180f8ac.1697824215.git.robin.murphy@arm.com>
Hi Robin,
It seems that I somehow managed to reply to patch 2/3 second time with the
comments that were supposed to be here... :(
On Fri, 20 Oct 2023, Robin Murphy wrote:
> Finally enable independent per-DTC-domain counter allocation, except on
> CMN-600 where we still need to cope with not knowing the domain topology
> and thus keep counter indices sychronised across domains. This allows
> users to simultaneously count up to 8 targeted events per domain, rather
> than 8 globally, for up to 4x wider coverage on maximum configurations.
>
> Even though this now looks deceptively simple, I stand by my previous
> assertion that it was a flippin' nightmare to implement; all the real
> head-scratchers are hidden in the foundations in the previous patch...
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Thanks! I had that on my task list but never had time to start working on
it.
Reviewed-by: Ilkka Koskinen <ilkka at os.amperecomputing.com>
Cheers, Ilkka
> ---
> drivers/perf/arm-cmn.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 675f1638013e..9479e919c063 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1570,7 +1570,7 @@ struct arm_cmn_val {
> u8 dtm_count[CMN_MAX_DTMS];
> u8 occupid[CMN_MAX_DTMS][SEL_MAX];
> u8 wp[CMN_MAX_DTMS][4];
> - int dtc_count;
> + int dtc_count[CMN_MAX_DTCS];
> bool cycles;
> };
>
> @@ -1591,7 +1591,8 @@ static void arm_cmn_val_add_event(struct arm_cmn *cmn, struct arm_cmn_val *val,
> return;
> }
>
> - val->dtc_count++;
> + for_each_hw_dtc_idx(hw, dtc, idx)
> + val->dtc_count[dtc]++;
>
> for_each_hw_dn(hw, dn, i) {
> int wp_idx, dtm = dn->dtm, sel = hw->filter_sel;
> @@ -1638,8 +1639,9 @@ static int arm_cmn_validate_group(struct arm_cmn *cmn, struct perf_event *event)
> goto done;
> }
>
> - if (val->dtc_count == CMN_DT_NUM_COUNTERS)
> - goto done;
> + for (i = 0; i < CMN_MAX_DTCS; i++)
> + if (val->dtc_count[i] == CMN_DT_NUM_COUNTERS)
> + goto done;
>
> for_each_hw_dn(hw, dn, i) {
> int wp_idx, wp_cmb, dtm = dn->dtm, sel = hw->filter_sel;
> @@ -1806,9 +1808,9 @@ static int arm_cmn_event_add(struct perf_event *event, int flags)
> return 0;
> }
>
> - /* Grab a free global counter first... */
> + /* Grab the global counters first... */
> for_each_hw_dtc_idx(hw, j, idx) {
> - if (j > 0) {
> + if (cmn->part == PART_CMN600 && j > 0) {
> idx = hw->dtc_idx[0];
> } else {
> idx = 0;
> @@ -1819,10 +1821,10 @@ static int arm_cmn_event_add(struct perf_event *event, int flags)
> hw->dtc_idx[j] = idx;
> }
>
> - /* ...then the local counters to feed it. */
> + /* ...then the local counters to feed them */
> for_each_hw_dn(hw, dn, i) {
> struct arm_cmn_dtm *dtm = &cmn->dtms[dn->dtm] + hw->dtm_offset;
> - unsigned int dtm_idx, shift, d = 0;
> + unsigned int dtm_idx, shift, d = max_t(int, dn->dtc, 0);
> u64 reg;
>
> dtm_idx = 0;
> --
> 2.39.2.101.g768bb238c484.dirty
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-10-20 23:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 17:51 [PATCH 0/3] perf/arm-cmn: Multi-DTC improvements Robin Murphy
2023-10-20 17:51 ` [PATCH 1/3] perf/arm-cmn: Fix DTC domain detection Robin Murphy
2023-10-20 22:45 ` Ilkka Koskinen
2023-10-20 17:51 ` [PATCH 2/3] perf/arm-cmn: Rework DTC counters (again) Robin Murphy
2023-10-20 22:50 ` Ilkka Koskinen
2023-10-23 9:06 ` Mark Rutland
2023-10-23 14:14 ` Robin Murphy
2023-10-25 3:18 ` Ilkka Koskinen
2023-10-20 22:53 ` Ilkka Koskinen
2023-10-23 10:26 ` Will Deacon
2023-10-20 17:51 ` [PATCH 3/3] perf/arm-cmn: Enable per-DTC counter allocation Robin Murphy
2023-10-20 23:00 ` Ilkka Koskinen [this message]
2023-10-23 14:39 ` [PATCH 0/3] perf/arm-cmn: Multi-DTC improvements Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa35f25b-2db8-daa1-1817-3ac256fc27ec@os.amperecomputing.com \
--to=ilkka@os.amperecomputing.com \
--cc=jeremy.linton@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=renyu.zj@linux.alibaba.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox