[SRU][N][PATCH 00/13] Coresight fails to build on 6.8.0-101 due to 'atomic_t' member accessed as 'int'

Noah Wager noah.wager at canonical.com
Sat Feb 21 00:49:40 UTC 2026


BugLink: https://bugs.launchpad.net/bugs/2142336

SRU Justification:

[Impact]

When CONFIG_CORESIGHT is enabled, noble 6.8.0-101 fails to build with the following errors:

```
drivers/hwtracing/coresight/coresight-catu.c: In function 'catu_enable':
drivers/hwtracing/coresight/coresight-catu.c:465:27: error: invalid operands to binary == (have 'atomic_t' and 'int')
  465 | if (csdev->refcnt == 0) {
      | ~~~~~~~~~~~~~ ^~
      | |
      | atomic_t
drivers/hwtracing/coresight/coresight-catu.c:471:30: error: wrong type argument to increment
  471 | csdev->refcnt++;
      | ^~
drivers/hwtracing/coresight/coresight-catu.c: In function 'catu_disable':
drivers/hwtracing/coresight/coresight-catu.c:498:13: error: wrong type argument to decrement
  498 | if (--csdev->refcnt == 0) {
      | ^~
drivers/hwtracing/coresight/coresight-catu.c: In function 'catu_init':
drivers/hwtracing/coresight/coresight-catu.c:728:15: error: implicit declaration of function 'coresight_init_driver' [-Werror=implicit-function-declaration]
  728 | ret = coresight_init_driver("catu", &catu_driver, &catu_platform_driver);
      | ^~~~~~~~~~~~~~~~~~~~~
```

These errors are a result of including the following patch in upstream stable
updates, but missing some dependencies from the original patch set:

  Error description: refcnt accessed as int but defined as atomic_t
  Break commit: n/linux 0e2198d37507 ("coresight: catu: Introduce refcount and spinlock for enabling/disabling")
  Missing commit: 4545b38ef004 ("coresight: Remove atomic type from refcnt")
  Patch series: "coresight: Separate sysfs and Perf usage and some other cleanups"
                (https://lists.infradead.org/pipermail/linux-arm-kernel/2024-January/899269.html)

[Fix]

Cherry-pick upstream commit:
4545b38ef004 ("coresight: Remove atomic type from refcnt")
which involves cherry-picking the commits in the series:
"coresight: Separate sysfs and Perf usage and some other cleanups"
up to the fix commit.

NOTE: I decided it would be best to backport the entire patch series
because the rest of the patches, while not *strictly* necessary for a
successful build, add some clean up and helpers that do not change
behaviour and may be useful when pulling in future upstream commits,
as we will be less likely to miss a dependency. That means the full list
of cherry-picks is:

a0fef3f05cf3 ("coresight: Make language around "activated" sinks consistent")
a11ebe138b8d ("coresight: Remove ops callback checks")
9cae77cf23e3 ("coresight: Move mode to struct coresight_device")
d5e83f97eb56 ("coresight: Remove the 'enable' field.")
1f5149c7751c ("coresight: Move all sysfs code to sysfs file")
4545b38ef004 ("coresight: Remove atomic type from refcnt")
053ad9ad1d13 ("coresight: Remove unused stubs")
812265e26ed3 ("coresight: Add explicit member initializers to coresight_dev_type")
d724f65218b9 ("coresight: Add helper for atomically taking the device")
c95c2733e5fe ("coresight: Add a helper for getting csdev->mode")
bcaabb95f0c9 ("coresight: Add helper for setting csdev->mode")

NOTE 2: To apply the patches cleanly, I had to revert the already-applied
"coresight-etb10: change etb_drvdata spinlock's type to raw_spinlock_t"
and then re-cherry-pick it from upstream, where it applies cleanly. I found
this approach safer than mangling all the new commits to fix context changes.

[Test Plan]

Ensure CONFIG_CORESIGHT and CONFIG_CORESIGHT_CATU are enabled, then compile test.

[Where problems could occur]

There is a low chance of regression since this patchset is purely cleanup and
does not modify observable behaviour, as stated by the author in the original
patch set. Additionally, coresight failed to build before this, so this is
a guaranteed improvement in that respect. These changes do alter some function
and struct definitions, which could cause build failures in downstream projects
that have non-upstream coresight patches reliant on the legacy definitions.

James Clark (11):
  coresight: Make language around "activated" sinks consistent
  coresight: Remove ops callback checks
  coresight: Move mode to struct coresight_device
  coresight: Remove the 'enable' field.
  coresight: Move all sysfs code to sysfs file
  coresight: Remove atomic type from refcnt
  coresight: Remove unused stubs
  coresight: Add explicit member initializers to coresight_dev_type
  coresight: Add helper for atomically taking the device
  coresight: Add a helper for getting csdev->mode
  coresight: Add helper for setting csdev->mode

Noah Wager (1):
  Revert "coresight-etb10: change etb_drvdata spinlock's type to
    raw_spinlock_t"

Yeoreum Yun (1):
  coresight-etb10: change etb_drvdata spinlock's type to raw_spinlock_t

 drivers/hwtracing/coresight/coresight-core.c  | 490 +-----------------
 drivers/hwtracing/coresight/coresight-etb10.c |  29 +-
 drivers/hwtracing/coresight/coresight-etm.h   |   2 -
 .../coresight/coresight-etm3x-core.c          |  23 +-
 .../coresight/coresight-etm3x-sysfs.c         |   4 +-
 .../coresight/coresight-etm4x-core.c          |  26 +-
 drivers/hwtracing/coresight/coresight-etm4x.h |   1 -
 drivers/hwtracing/coresight/coresight-priv.h  |   7 +-
 drivers/hwtracing/coresight/coresight-stm.c   |  30 +-
 drivers/hwtracing/coresight/coresight-sysfs.c | 391 ++++++++++++++
 .../hwtracing/coresight/coresight-tmc-core.c  |   2 +-
 .../hwtracing/coresight/coresight-tmc-etf.c   |  46 +-
 .../hwtracing/coresight/coresight-tmc-etr.c   |  33 +-
 drivers/hwtracing/coresight/coresight-tmc.h   |   2 -
 drivers/hwtracing/coresight/coresight-tpda.c  |  13 +-
 drivers/hwtracing/coresight/coresight-tpiu.c  |  14 +-
 drivers/hwtracing/coresight/ultrasoc-smb.c    |  22 +-
 drivers/hwtracing/coresight/ultrasoc-smb.h    |   2 -
 include/linux/coresight.h                     | 146 ++----
 19 files changed, 594 insertions(+), 689 deletions(-)

-- 
2.43.0




More information about the kernel-team mailing list