diff mbox series

perf/arm-cmn: Permit more exhaustive groups

Message ID bdfd1e58dac449e407c5cacfd6bf8577dc0a5899.1733943898.git.robin.murphy@arm.com (mailing list archive)
State New
Headers show
Series perf/arm-cmn: Permit more exhaustive groups | expand

Commit Message

Robin Murphy Dec. 11, 2024, 7:04 p.m. UTC
The group validation logic still somewhat assumes the original CMN-600
case of events counting globally, such that if one tries to group 9
events where the first 8 target a single DTC domain, the 9th will be
rejected because *a* DTC domain is full, even though it might only
target other non-overlapping domains and thus still be schedulable.
Improve matters by only counting the DTCs that the new event actually
needs (as arm_cmn_val_add_event() was already clever enough to do).

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/perf/arm-cmn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Will Deacon Dec. 11, 2024, 9:51 p.m. UTC | #1
[+ Ilkka for comments/testing]

On Wed, Dec 11, 2024 at 07:04:58PM +0000, Robin Murphy wrote:
> The group validation logic still somewhat assumes the original CMN-600
> case of events counting globally, such that if one tries to group 9
> events where the first 8 target a single DTC domain, the 9th will be
> rejected because *a* DTC domain is full, even though it might only
> target other non-overlapping domains and thus still be schedulable.
> Improve matters by only counting the DTCs that the new event actually
> needs (as arm_cmn_val_add_event() was already clever enough to do).
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/perf/arm-cmn.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index edefb51ac90a..b49e353e10ab 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1779,8 +1779,8 @@ static int arm_cmn_validate_group(struct arm_cmn *cmn, struct perf_event *event)
>  		goto done;
>  	}
>  
> -	for (i = 0; i < CMN_MAX_DTCS; i++)
> -		if (val->dtc_count[i] == CMN_DT_NUM_COUNTERS)
> +	for_each_hw_dtc_idx(hw, dtc, idx)
> +		if (val->dtc_count[dtc] == CMN_DT_NUM_COUNTERS)
>  			goto done;
>  
>  	for_each_hw_dn(hw, dn, i) {
> -- 
> 2.39.2.101.g768bb238c484.dirty
>
diff mbox series

Patch

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index edefb51ac90a..b49e353e10ab 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1779,8 +1779,8 @@  static int arm_cmn_validate_group(struct arm_cmn *cmn, struct perf_event *event)
 		goto done;
 	}
 
-	for (i = 0; i < CMN_MAX_DTCS; i++)
-		if (val->dtc_count[i] == CMN_DT_NUM_COUNTERS)
+	for_each_hw_dtc_idx(hw, dtc, idx)
+		if (val->dtc_count[dtc] == CMN_DT_NUM_COUNTERS)
 			goto done;
 
 	for_each_hw_dn(hw, dn, i) {