Skip to content

Commit 1892fe1

Browse files
rmurphy-armctmarinas
authored andcommitted
perf/arm-cmn: Fail DTC counter allocation correctly
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: 7633ec2 ("perf/arm-cmn: Rework DTC counters (again)") Signed-off-by: Robin Murphy <[email protected]> Reviewed-by: Ilkka Koskinen <[email protected]> Acked-by: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/ed589c0d8e4130dc68b8ad1625226d28bdc185d4.1702322847.git.robin.murphy@arm.com Signed-off-by: Catalin Marinas <[email protected]>
1 parent f525999 commit 1892fe1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/perf/arm-cmn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ static int arm_cmn_event_add(struct perf_event *event, int flags)
18161816
idx = 0;
18171817
while (cmn->dtc[j].counters[idx])
18181818
if (++idx == CMN_DT_NUM_COUNTERS)
1819-
goto free_dtms;
1819+
return -ENOSPC;
18201820
}
18211821
hw->dtc_idx[j] = idx;
18221822
}

0 commit comments

Comments
 (0)