Skip to contentSkip to conversation

perf/arm-cmn: Move overlapping wp_combine field

PATCH Applied Ilkka Koskinen 3 participants 5 messages Mar 1, 2023 – Mar 27, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/arm-cmn: Move overlapping wp_combine field

As eventid field was expanded to support new mesh versions, it started to overlap with wp_combine field. Move wp_combine to fix the issue.

Fixes 23760a014417 ("perf/arm-cmn: Add CMN-700 support")
---
 drivers/perf/arm-cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm-cmn.c +1 -1
index c9689861be3f..9f2edc28d16e 100644
@@ -166,7 +166,7 @@
 #define CMN_EVENT_BYNODEID(event)	FIELD_GET(CMN_CONFIG_BYNODEID, (event)->attr.config)
 #define CMN_EVENT_NODEID(event)		FIELD_GET(CMN_CONFIG_NODEID, (event)->attr.config)
 
-#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(27, 24)
+#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(30, 27)
 #define CMN_CONFIG_WP_DEV_SEL		GENMASK_ULL(50, 48)
 #define CMN_CONFIG_WP_CHN_SEL		GENMASK_ULL(55, 51)
 /* Note that we don't yet support the tertiary match group on newer IPs */
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw
Quoted 2 lines · Ilkka Koskinen

As eventid field was expanded to support new mesh versions, it started to overlap with wp_combine field. Move wp_combine to fix the issue.

Watchpoint events still only strictly need 2 bits of eventid, though. Could you clarify whether userspace is getting confused by this, or whether it's just arm_cmn_event_init() falling over itself (FWIW I can see how I broke things there...)

Thanks,
Robin.

Quoted 11 lines
Fixes 23760a014417 ("perf/arm-cmn: Add CMN-700 support")
---
  drivers/perf/arm-cmn.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm-cmn.c +0 -0
index c9689861be3f..9f2edc28d16e 100644

drivers/perf/arm-cmn.c line 172

Quoted 8 lines
drivers/perf/arm-cmn.c +1 -1
@@ -166,7 +166,7 @@
  #define CMN_EVENT_BYNODEID(event)	FIELD_GET(CMN_CONFIG_BYNODEID, (event)->attr.config)
  #define CMN_EVENT_NODEID(event)		FIELD_GET(CMN_CONFIG_NODEID, (event)->attr.config)
 
-#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(27, 24)
+#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(30, 27)
  #define CMN_CONFIG_WP_DEV_SEL		GENMASK_ULL(50, 48)
  #define CMN_CONFIG_WP_CHN_SEL		GENMASK_ULL(55, 51)
  /* Note that we don't yet support the tertiary match group on newer IPs */

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Hi Robin,

Quoted 5 lines · Robin Murphy
Quoted 2 lines · Ilkka Koskinen

As eventid field was expanded to support new mesh versions, it started to overlap with wp_combine field. Move wp_combine to fix the issue.

Watchpoint events still only strictly need 2 bits of eventid, though. Could you clarify whether userspace is getting confused by this, or whether it's just arm_cmn_event_init() falling over itself (FWIW I can see how I broke things there...)

Basically, perf seems to set eventid at first and then wp_combine field into the config argument. The problem is when arm_cmn_event_init() is doing:

	eventid = CMN_EVENT_EVENTID(event);
	....
	if (eventid != CMN_WP_UP && eventid != CMN_WP_DOWN)
		return -EINVAL;

If wp_combine has any of the overlapping bits set, eventid doesn't match with either up or down event.

Cheers, Ilkka

Quoted 10 lines

Thanks,
Robin.

Quoted 6 lines
Fixes 23760a014417 ("perf/arm-cmn: Add CMN-700 support")
---
  drivers/perf/arm-cmn.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 14 lines
drivers/perf/arm-cmn.c +1 -0
index c9689861be3f..9f2edc28d16e 100644
@@ -166,7 +166,7 @@
  #define CMN_EVENT_BYNODEID(event)	FIELD_GET(CMN_CONFIG_BYNODEID, 
 (event)->attr.config)
  #define CMN_EVENT_NODEID(event)		FIELD_GET(CMN_CONFIG_NODEID, 
 (event)->attr.config)
  -#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(27, 24)
+#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(30, 27)
  #define CMN_CONFIG_WP_DEV_SEL		GENMASK_ULL(50, 48)
  #define CMN_CONFIG_WP_CHN_SEL		GENMASK_ULL(55, 51)
  /* Note that we don't yet support the tertiary match group on newer IPs 
Quoted 1 line

*/

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

Hi Robin,

Quoted 10 lines · Ilkka Koskinen

Hi Robin,

Quoted 5 lines · Robin Murphy
Quoted 2 lines · Ilkka Koskinen

As eventid field was expanded to support new mesh versions, it started to overlap with wp_combine field. Move wp_combine to fix the issue.

Watchpoint events still only strictly need 2 bits of eventid, though. Could you clarify whether userspace is getting confused by this, or whether it's just arm_cmn_event_init() falling over itself (FWIW I can see how I broke things there...)

Quoted 8 lines

Basically, perf seems to set eventid at first and then wp_combine field into the config argument. The problem is when arm_cmn_event_init() is doing:

	eventid = CMN_EVENT_EVENTID(event);
	....
	if (eventid != CMN_WP_UP && eventid != CMN_WP_DOWN)
		return -EINVAL;

If wp_combine has any of the overlapping bits set, eventid doesn't match with either up or down event.

I probably should have also copy pasted what the format files say:

	$ cat format/eventid format/wp_combine
	config:16-26
	config:24-27

So, here you can see that those two fields overlap. If wp_combine has any of the bits 24-26 set, arm_cmn_event_init() returns -EINVAL as shown in the code above.

Would you need some more clarification from me?

Br, Ilkka

Quoted 30 lines

Cheers, Ilkka

Quoted 26 lines

Thanks,
Robin.

Quoted 21 lines
Fixes 23760a014417 ("perf/arm-cmn: Add CMN-700 support")
---
  drivers/perf/arm-cmn.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm-cmn.c +1 -0
index c9689861be3f..9f2edc28d16e 100644
@@ -166,7 +166,7 @@
  #define CMN_EVENT_BYNODEID(event)	FIELD_GET(CMN_CONFIG_BYNODEID, 
 (event)->attr.config)
  #define CMN_EVENT_NODEID(event)		FIELD_GET(CMN_CONFIG_NODEID, 
 (event)->attr.config)
  -#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(27, 24)
+#define CMN_CONFIG_WP_COMBINE		GENMASK_ULL(30, 27)
  #define CMN_CONFIG_WP_DEV_SEL		GENMASK_ULL(50, 48)
  #define CMN_CONFIG_WP_CHN_SEL		GENMASK_ULL(55, 51)
  /* Note that we don't yet support the tertiary match group on newer IPs 

*/

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Applied
#4 lore raw
In reply to Ilkka Koskinen
Quoted 4 lines · Ilkka Koskinen

As eventid field was expanded to support new mesh versions, it started to overlap with wp_combine field. Move wp_combine to fix the issue.

Applied to will (for-next/perf), thanks!

[1/1] perf/arm-cmn: Move overlapping wp_combine field

      https://git.kernel.org/will/c/f87e9114b5e5

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