Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
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] perf/arm-cmn: Fail DTC counter allocation correctly
Date: Mon, 11 Dec 2023 18:21:34 -0800 (PST)	[thread overview]
Message-ID: <bf20c32f-6426-f4ba-3bcc-41aadd89968@os.amperecomputing.com> (raw)
In-Reply-To: <ed589c0d8e4130dc68b8ad1625226d28bdc185d4.1702322847.git.robin.murphy@arm.com>


On Mon, 11 Dec 2023, Robin Murphy wrote:
> Calling arm_cmn_event_clear() before all DTC indices are allocated is
> wrong, and can lead to arm_cmn_event_add() erroneously clearing live
> counters from full DTCs where allocation fails. Since the DTC counters
> are only updated by arm_cmn_init_counter() after all DTC and DTM
> allocations succeed, nothing actually needs cleaning up in this case
> anyway, and it should just return directly as it did before.
>
> Fixes: 7633ec2c262f ("perf/arm-cmn: Rework DTC counters (again)")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

That's a good catch.

     Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>

Cheers, Ilkka

> ---
> drivers/perf/arm-cmn.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 86d970e74129..c584165b13ba 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1816,7 +1816,7 @@ static int arm_cmn_event_add(struct perf_event *event, int flags)
> 			idx = 0;
> 			while (cmn->dtc[j].counters[idx])
> 				if (++idx == CMN_DT_NUM_COUNTERS)
> -					goto free_dtms;
> +					return -ENOSPC;
> 		}
> 		hw->dtc_idx[j] = idx;
> 	}
> -- 
> 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

  reply	other threads:[~2023-12-12  2:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 19:27 [PATCH] perf/arm-cmn: Fail DTC counter allocation correctly Robin Murphy
2023-12-12  2:21 ` Ilkka Koskinen [this message]
2023-12-12  9:16 ` Will Deacon
2023-12-12 17:22 ` Catalin Marinas

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=bf20c32f-6426-f4ba-3bcc-41aadd89968@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