perf: CXL: fix mismatched number of counters mask
A message that is not in the archive (sent off-list or not yet received): CGME20230905123044epcas2p2b1052956527cf63a03e2895d4b93e7e1@epcas2p2.samsung.com
PATCH 1/1 perf: CXL: fix mismatched number of counters mask
The number of Count Units field is described as 6 bits long in the CXL 3.0 specification. However, its mask value was only declared as 5 bits long.
--- drivers/perf/cxl_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/cxl_pmu.c +1 -1
@@ -25,7 +25,7 @@#include "../cxl/pmu.h" #define CXL_PMU_CAP_REG 0x0 -#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(4, 0) +#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(5, 0)#define CXL_PMU_CAP_COUNTER_WIDTH_MSK GENMASK_ULL(15, 8)#define CXL_PMU_CAP_NUM_EVN_CAP_REG_SUP_MSK GENMASK_ULL(24, 20)#define CXL_PMU_CAP_FILTERS_SUP_MSK GENMASK_ULL(39, 32)
base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9
Signature · 7 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerQuoted 14 lines · Jeongtae Park
The number of Count Units field is described as 6 bits long in the CXL 3.0 specification. However, its mask value was only declared as 5 bits long.
Signed-off-by Jeongtae Park <[email protected]>--- drivers/perf/cxl_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/perf/cxl_pmu.c +0
-0
drivers/perf/cxl_pmu.c line 31
Quoted 8 lines
drivers/perf/cxl_pmu.c +1
-1@@ -25,7 +25,7 @@#include "../cxl/pmu.h" #define CXL_PMU_CAP_REG 0x0 -#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(4, 0) +#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(5, 0)#define CXL_PMU_CAP_COUNTER_WIDTH_MSK GENMASK_ULL(15, 8)#define CXL_PMU_CAP_NUM_EVN_CAP_REG_SUP_MSK GENMASK_ULL(24, 20)#define CXL_PMU_CAP_FILTERS_SUP_MSK GENMASK_ULL(39, 32)
I don't have access to the CXL spec, but widening this mask looks like it puts us out-of-whack with CXL_PMU_MAX_COUNTERS.
Did v3.0 of the spec bump the number of counters? If so, can you please check that this is a backwards-compatible change?
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Jonathan Cameron
Acked-byQuoted 27 lines · On Tue, 5 Sep 2023 15:28:54 +0100 Will Deacon <[email protected]> wrote:
Quoted 14 lines · Jeongtae Park
The number of Count Units field is described as 6 bits long in the CXL 3.0 specification. However, its mask value was only declared as 5 bits long.
Signed-off-by Jeongtae Park <[email protected]>--- drivers/perf/cxl_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/perf/cxl_pmu.c +0
-0drivers/perf/cxl_pmu.c line 31
Quoted 8 lines
drivers/perf/cxl_pmu.c +1
-1@@ -25,7 +25,7 @@#include "../cxl/pmu.h" #define CXL_PMU_CAP_REG 0x0 -#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(4, 0) +#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(5, 0)#define CXL_PMU_CAP_COUNTER_WIDTH_MSK GENMASK_ULL(15, 8)#define CXL_PMU_CAP_NUM_EVN_CAP_REG_SUP_MSK GENMASK_ULL(24, 20)#define CXL_PMU_CAP_FILTERS_SUP_MSK GENMASK_ULL(39, 32)I don't have access to the CXL spec, but widening this mask looks like it puts us out-of-whack with
CXL_PMU_MAX_COUNTERS.
Quoted 2 lines
Did v3.0 of the spec bump the number of counters? If so, can you please check that this is a backwards-compatible change?
CXL Performance monitors were only introduced in CXL 3.0 so not that.
The max value that register can take is 0x3f (0 based, so 64 counters == CXL_PMU_MAX_COUNTERS)
So it should be 6 bits wide. I did some history digging and this isn't even a draft spec / final spec issue - simple typo I guess.
Fix seems correct to me.
Quoted 2 lines
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerQuoted 30 lines · Jonathan Cameron
Quoted 27 lines · On Tue, 5 Sep 2023 15:28:54 +0100 Will Deacon <[email protected]> wrote:
Quoted 14 lines · Jeongtae Park
The number of Count Units field is described as 6 bits long in the CXL 3.0 specification. However, its mask value was only declared as 5 bits long.
Signed-off-by Jeongtae Park <[email protected]>--- drivers/perf/cxl_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/perf/cxl_pmu.c +0
-0drivers/perf/cxl_pmu.c line 31
Quoted 8 lines
drivers/perf/cxl_pmu.c +1
-1@@ -25,7 +25,7 @@#include "../cxl/pmu.h" #define CXL_PMU_CAP_REG 0x0 -#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(4, 0) +#define CXL_PMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(5, 0)#define CXL_PMU_CAP_COUNTER_WIDTH_MSK GENMASK_ULL(15, 8)#define CXL_PMU_CAP_NUM_EVN_CAP_REG_SUP_MSK GENMASK_ULL(24, 20)#define CXL_PMU_CAP_FILTERS_SUP_MSK GENMASK_ULL(39, 32)I don't have access to the CXL spec, but widening this mask looks like it puts us out-of-whack with
CXL_PMU_MAX_COUNTERS.
Quoted 4 lines
Quoted 2 lines
Did v3.0 of the spec bump the number of counters? If so, can you please check that this is a backwards-compatible change?
CXL Performance monitors were only introduced in CXL 3.0 so not that.
Thanks for the information!
Quoted 4 lines
The max value that register can take is
0x3f(0 based, so 64 counters ==CXL_PMU_MAX_COUNTERS)
So it should be 6 bits wide. I did some history digging and this isn't even a draft spec / final spec issue - simple typo I guess.
Heh, I blame the heat as I thought this was extending to 7 bits for some reason. Sorry about that.
Quoted 3 lines
Fix seems correct to me.
Acked-by Jonathan Cameron <[email protected]>
I'll pick it up, thanks again!
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 5 lines · Jeongtae Park
The number of Count Units field is described as 6 bits long in the CXL 3.0 specification. However, its mask value was only declared as 5 bits long.
Applied to arm64 (for-next/fixes), thanks!
[1/1] perf: CXL: fix mismatched number of counters mask
https://git.kernel.org/arm64/c/7625df9f4b25
Cheers,
Signature · 10 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel