* [PATCH v2] drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
@ 2026-05-23 15:41 Julian Braha
2026-05-25 7:35 ` Claude review: " Claude Code Review Bot
2026-05-25 7:35 ` Claude Code Review Bot
0 siblings, 2 replies; 5+ messages in thread
From: Julian Braha @ 2026-05-23 15:41 UTC (permalink / raw)
To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin, airlied,
simona
Cc: intel-gfx, dri-devel, linux-kernel, Julian Braha
A previous version of this patch[1] accidentally introduced an unmet
dependency bug, because DRM_I915_DEBUG selects
DRM_I915_SW_FENCE_DEBUG_OBJECTS without also depending on DEBUG_OBJECTS.
DRM_I915_SW_FENCE_DEBUG_OBJECTS currently selects DEBUG_OBJECTS even though
DEBUG_OBJECTS is visible to users. Other config options use 'depends on'
for DEBUG_OBJECTS, so let's do the same here.
This select-visible Kconfig misusage was detected by Kconfirm, a static
analysis tool for Kconfig.
Link 1: https://lore.kernel.org/all/20260502191932.4491-1-julianbraha@gmail.com/
Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
v2:
- select PREEMPT_COUNT, avoid recursive dependency
drivers/gpu/drm/i915/Kconfig.debug | 3 ++-
lib/Kconfig.debug | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
index 3562a02ef7ad..657cdf49181e 100644
--- a/drivers/gpu/drm/i915/Kconfig.debug
+++ b/drivers/gpu/drm/i915/Kconfig.debug
@@ -35,6 +35,7 @@ config DRM_I915_REPLAY_GPU_HANGS_API
config DRM_I915_DEBUG
bool "Enable additional driver debugging"
+ depends on DEBUG_OBJECTS
depends on DRM_I915
depends on EXPERT # only for developers
depends on !COMPILE_TEST # never built by robots
@@ -153,7 +154,7 @@ config DRM_I915_TRACE_GTT
config DRM_I915_SW_FENCE_DEBUG_OBJECTS
bool "Enable additional driver debugging for fence objects"
depends on DRM_I915
- select DEBUG_OBJECTS
+ depends on DEBUG_OBJECTS
default n
help
Choose this option to turn on extra driver debugging that may affect
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 8ff5adcfe1e0..6501b7040706 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -760,7 +760,7 @@ source "mm/Kconfig.debug"
config DEBUG_OBJECTS
bool "Debug object operations"
- depends on PREEMPT_COUNT || !DEFERRED_STRUCT_PAGE_INIT
+ select PREEMPT_COUNT if !DEFERRED_STRUCT_PAGE_INIT
depends on DEBUG_KERNEL
help
If you say Y here, additional code will be inserted into the
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Claude review: drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
2026-05-23 15:41 [PATCH v2] drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS Julian Braha
@ 2026-05-25 7:35 ` Claude Code Review Bot
2026-05-25 7:35 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 7:35 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
Author: Julian Braha <julianbraha@gmail.com>
Patches: 1
Reviewed: 2026-05-25T17:35:09.900931
---
This is a single-patch series that attempts to fix a Kconfig "select-visible" anti-pattern: `DRM_I915_SW_FENCE_DEBUG_OBJECTS` was using `select DEBUG_OBJECTS` on a user-visible symbol, which is considered Kconfig misuse. The i915-side changes (converting `select` to `depends on`) are correct, but **the patch introduces a bug in `lib/Kconfig.debug`** by inverting the condition on the `select PREEMPT_COUNT` replacement. Additionally, the `lib/Kconfig.debug` change modifies core kernel debug infrastructure and should have broader review beyond i915/DRM maintainers.
**Recommendation: Needs revision.** The `lib/Kconfig.debug` change has an inverted condition that breaks the original constraint, and the change to core kernel config should be split out and reviewed by the debug infrastructure maintainers.
---
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
2026-05-23 15:41 [PATCH v2] drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS Julian Braha
2026-05-25 7:35 ` Claude review: " Claude Code Review Bot
@ 2026-05-25 7:35 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 7:35 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**i915 Kconfig changes — Correct**
The two changes in `drivers/gpu/drm/i915/Kconfig.debug` are logically sound:
1. Changing `DRM_I915_SW_FENCE_DEBUG_OBJECTS` from `select DEBUG_OBJECTS` to `depends on DEBUG_OBJECTS` (line 134→157) is the right fix for the select-visible anti-pattern.
2. Adding `depends on DEBUG_OBJECTS` to `DRM_I915_DEBUG` (line 125→38) is necessary because `DRM_I915_DEBUG` selects `DRM_I915_SW_FENCE_DEBUG_OBJECTS` (line 63), which now depends on `DEBUG_OBJECTS`. Without this, Kconfig would select a symbol whose dependency isn't met.
These two changes are consistent: when `DRM_I915_DEBUG=y`, `DEBUG_OBJECTS` must be on (new depends), so the selected `DRM_I915_SW_FENCE_DEBUG_OBJECTS` has its `DEBUG_OBJECTS` dependency satisfied.
**lib/Kconfig.debug change — Bug: inverted condition**
The change to `DEBUG_OBJECTS` in `lib/Kconfig.debug` has the condition backwards:
```
- depends on PREEMPT_COUNT || !DEFERRED_STRUCT_PAGE_INIT
+ select PREEMPT_COUNT if !DEFERRED_STRUCT_PAGE_INIT
```
The original `depends on` expression means: `DEBUG_OBJECTS` requires `PREEMPT_COUNT` **when `DEFERRED_STRUCT_PAGE_INIT=y`**. When `DEFERRED_STRUCT_PAGE_INIT=n`, `PREEMPT_COUNT` is not needed (the `!DEFERRED_STRUCT_PAGE_INIT` clause satisfies the dependency).
The replacement `select PREEMPT_COUNT if !DEFERRED_STRUCT_PAGE_INIT` does the opposite:
- When `DEFERRED_STRUCT_PAGE_INIT=n`: forces `PREEMPT_COUNT=y` — **unnecessary**, the original constraint was already satisfied without it.
- When `DEFERRED_STRUCT_PAGE_INIT=y`: does nothing — **the dangerous case is left unguarded**. `DEBUG_OBJECTS` can now be enabled with `PREEMPT_COUNT=n` and `DEFERRED_STRUCT_PAGE_INIT=y`, a configuration the original dependency explicitly prohibited.
The correct replacement would be:
```
select PREEMPT_COUNT if DEFERRED_STRUCT_PAGE_INIT
```
This ensures that when `DEFERRED_STRUCT_PAGE_INIT=y`, `PREEMPT_COUNT` is force-enabled, which is the constraint the original `depends on` was enforcing.
**Scope concern: modifying core kernel Kconfig from a driver patch**
The `lib/Kconfig.debug` change modifies `DEBUG_OBJECTS`, a core kernel debug option that affects far more than i915. The patch is CC'd only to i915/DRM maintainers and mailing lists. This change should be reviewed by the maintainers of `lib/Kconfig.debug` (likely Andrew Morton / the debug infrastructure maintainers). At minimum it needs a CC to `linux-kernel@vger.kernel.org` with relevant subsystem maintainers, and ideally should be a separate patch with its own justification rather than bundled into an i915 fix.
**Why the `select` approach is needed at all**
The commit message says "select PREEMPT_COUNT, avoid recursive dependency." The underlying issue is real: `PREEMPT_COUNT` is a prompt-less bool (in `kernel/Kconfig.preempt`), so it can only be enabled via `select`. With the original `depends on PREEMPT_COUNT` in `DEBUG_OBJECTS`, if nothing else in the config happens to select `PREEMPT_COUNT`, then `DEBUG_OBJECTS` becomes unavailable. Converting the dependency to `select` is a reasonable approach — but the condition must be correct.
**Minor: `default n` is unnecessary**
```
depends on DEBUG_OBJECTS
default n
```
In Kconfig, `bool` options default to `n` implicitly. The `default n` on `DRM_I915_SW_FENCE_DEBUG_OBJECTS` (line 158) is redundant. This is pre-existing and not introduced by this patch, but could be cleaned up opportunistically.
**Summary of required changes:**
1. Fix the inverted condition: `select PREEMPT_COUNT if DEFERRED_STRUCT_PAGE_INIT` (not `if !DEFERRED_STRUCT_PAGE_INIT`)
2. Consider splitting the `lib/Kconfig.debug` change into a separate patch with appropriate CC to debug infrastructure maintainers
3. Test the resulting config to verify `DEBUG_OBJECTS` remains selectable in all relevant configurations
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
@ 2026-05-21 14:45 Julian Braha
2026-05-25 10:01 ` Claude review: " Claude Code Review Bot
2026-05-25 10:01 ` Claude Code Review Bot
0 siblings, 2 replies; 5+ messages in thread
From: Julian Braha @ 2026-05-21 14:45 UTC (permalink / raw)
To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin, airlied,
simona
Cc: intel-gfx, dri-devel, linux-kernel, Julian Braha
A previous version of this patch[1] accidentally introduced an unmet
dependency bug, because DRM_I915_DEBUG selects
DRM_I915_SW_FENCE_DEBUG_OBJECTS without also depending on DEBUG_OBJECTS.
DRM_I915_SW_FENCE_DEBUG_OBJECTS currently selects DEBUG_OBJECTS even though
DEBUG_OBJECTS is visible to users. Other config options use 'depends on'
for DEBUG_OBJECTS, so let's do the same here.
In this new version of the patch, let's also add the dependency on
DEBUG_OBJECTS to DRM_I915_DEBUG, to prevent the unmet dependency.
This select-visible Kconfig misusage was detected by Kconfirm, a static
analysis tool for Kconfig.
Link 1:
https://lore.kernel.org/all/20260502191932.4491-1-julianbraha@gmail.com/
Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
drivers/gpu/drm/i915/Kconfig.debug | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
index 3562a02ef7ad..657cdf49181e 100644
--- a/drivers/gpu/drm/i915/Kconfig.debug
+++ b/drivers/gpu/drm/i915/Kconfig.debug
@@ -35,6 +35,7 @@ config DRM_I915_REPLAY_GPU_HANGS_API
config DRM_I915_DEBUG
bool "Enable additional driver debugging"
+ depends on DEBUG_OBJECTS
depends on DRM_I915
depends on EXPERT # only for developers
depends on !COMPILE_TEST # never built by robots
@@ -153,7 +154,7 @@ config DRM_I915_TRACE_GTT
config DRM_I915_SW_FENCE_DEBUG_OBJECTS
bool "Enable additional driver debugging for fence objects"
depends on DRM_I915
- select DEBUG_OBJECTS
+ depends on DEBUG_OBJECTS
default n
help
Choose this option to turn on extra driver debugging that may affect
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Claude review: drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
2026-05-21 14:45 [PATCH] " Julian Braha
@ 2026-05-25 10:01 ` Claude Code Review Bot
2026-05-25 10:01 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 10:01 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
Author: Julian Braha <julianbraha@gmail.com>
Patches: 1
Reviewed: 2026-05-25T20:01:46.137153
---
This is a single-patch series that changes how `DRM_I915_SW_FENCE_DEBUG_OBJECTS` references `DEBUG_OBJECTS` — switching from `select` to `depends on` — and adds a new `depends on DEBUG_OBJECTS` to `DRM_I915_DEBUG`. The stated goal is to fix a Kconfig "select-visible" anti-pattern detected by the Kconfirm static analysis tool.
The intent is reasonable: `select`-ing a user-visible symbol is indeed a Kconfig anti-pattern because it can silently force-enable options without satisfying their dependencies. However, **this patch introduces a functional regression** by making it harder to enable `DRM_I915_DEBUG` — a key developer debugging option — without manually hunting down and enabling `DEBUG_OBJECTS` (and its transitive deps like `DEBUG_KERNEL`) first.
The patch also has a structural problem in how it resolves the dependency chain.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS
2026-05-21 14:45 [PATCH] " Julian Braha
2026-05-25 10:01 ` Claude review: " Claude Code Review Bot
@ 2026-05-25 10:01 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 10:01 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Issue 1 (Major): Adding `depends on DEBUG_OBJECTS` to `DRM_I915_DEBUG` is the wrong fix and degrades usability**
```diff
config DRM_I915_DEBUG
bool "Enable additional driver debugging"
+ depends on DEBUG_OBJECTS
depends on DRM_I915
```
`DRM_I915_DEBUG` is the umbrella debugging option that developers enable as a single switch to turn on all i915 debugging. By adding `depends on DEBUG_OBJECTS`, the option will not even be *visible* in menuconfig unless `DEBUG_OBJECTS` (and its dependency `DEBUG_KERNEL`) are already enabled. This makes it significantly less discoverable and more cumbersome to use.
The current tree has `DRM_I915_DEBUG` selecting `DRM_I915_SW_FENCE_DEBUG_OBJECTS`, which in turn selects `DEBUG_OBJECTS`. The "unmet dependency" the commit message references (from a previous patch version) was a problem with the *previous* patch's approach, not with the current tree. In the current tree, the `select` chain (`DRM_I915_DEBUG` → `select DRM_I915_SW_FENCE_DEBUG_OBJECTS` → `select DEBUG_OBJECTS`) works correctly — `DEBUG_OBJECTS` gets force-enabled transitively.
If the goal is to stop `DRM_I915_SW_FENCE_DEBUG_OBJECTS` from selecting `DEBUG_OBJECTS`, then `DRM_I915_DEBUG` should *also* `select DEBUG_OBJECTS` (not `depends on` it), since `DRM_I915_DEBUG` already selects many other symbols and is designed as a "turn everything on" switch. Alternatively, `DRM_I915_DEBUG` could just add `select DEBUG_OBJECTS` directly to replace the transitive select that would be lost.
**Issue 2 (Medium): Changing `select` to `depends on` for `DRM_I915_SW_FENCE_DEBUG_OBJECTS` changes semantics**
```diff
config DRM_I915_SW_FENCE_DEBUG_OBJECTS
bool "Enable additional driver debugging for fence objects"
depends on DRM_I915
- select DEBUG_OBJECTS
+ depends on DEBUG_OBJECTS
```
This is the core of the Kconfig anti-pattern fix and is directionally correct — `select`-ing a visible, user-configurable symbol that itself has dependencies (`DEBUG_KERNEL`, `PREEMPT_COUNT || !DEFERRED_STRUCT_PAGE_INIT`) can cause unmet dependency warnings. However, this change means that `DRM_I915_SW_FENCE_DEBUG_OBJECTS` will now be hidden unless the user has separately enabled `DEBUG_OBJECTS`. Previously, enabling `DRM_I915_SW_FENCE_DEBUG_OBJECTS` would automatically pull in `DEBUG_OBJECTS`.
This is a trade-off. The Kconfig community generally considers `depends on` correct for visible symbols, so this half of the patch is defensible. But the `DRM_I915_DEBUG` change above needs to compensate for this by using `select DEBUG_OBJECTS` rather than `depends on DEBUG_OBJECTS`.
**Issue 3 (Minor): Commit message formatting**
The commit message uses "Link 1:" as a label, but the kernel convention is either a `Link:` tag or `[1]` footnote reference. The commit message says "A previous version of this patch[1]" with a `[1]` reference but then uses "Link 1:" instead of a proper `[1]` footnote or `Link:` tag:
```
Link 1:
https://lore.kernel.org/all/20260502191932.4491-1-julianbraha@gmail.com/
```
This should be:
```
Link: https://lore.kernel.org/all/20260502191932.4491-1-julianbraha@gmail.com/ [1]
```
**Suggested fix**: Change `DRM_I915_DEBUG` to use `select DEBUG_OBJECTS` instead of `depends on DEBUG_OBJECTS`. This preserves the "one-switch" nature of the umbrella debug option while still fixing the anti-pattern in `DRM_I915_SW_FENCE_DEBUG_OBJECTS`. The diff should look like:
```
config DRM_I915_DEBUG
bool "Enable additional driver debugging"
depends on DRM_I915
depends on EXPERT
depends on !COMPILE_TEST
select DEBUG_FS
select PREEMPT_COUNT
+ select DEBUG_OBJECTS
...
select DRM_I915_SW_FENCE_DEBUG_OBJECTS
```
This way, `DRM_I915_DEBUG` continues to be a self-contained developer switch, `DEBUG_OBJECTS` gets enabled when needed, and `DRM_I915_SW_FENCE_DEBUG_OBJECTS` no longer misuses `select` on a visible symbol.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-25 10:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-23 15:41 [PATCH v2] drm/i915: use 'depends on' with visible DEBUG_OBJECTS for DRM_I915_DEBUG and DRM_I915_SW_FENCE_DEBUG_OBJECTS Julian Braha
2026-05-25 7:35 ` Claude review: " Claude Code Review Bot
2026-05-25 7:35 ` Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-21 14:45 [PATCH] " Julian Braha
2026-05-25 10:01 ` Claude review: " Claude Code Review Bot
2026-05-25 10:01 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox