[PATCH 2/2] drm/amdgpu: Clean up IP version checks in gmcv9.0

2025-01-27 Thread Lijo Lazar
Clean up some IP version checks in gmcv9.0 Signed-off-by: Lijo Lazar --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 49 ++- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 65

[PATCH 1/2] drm/amdgpu: Clean up GFX v9.4.3 IP version checks

2025-01-27 Thread Lijo Lazar
Remove unnecessary IP version checks for GFX 9.4.3 and similar variants. Wrap checks inside meaningful function. Signed-off-by: Lijo Lazar --- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 68 ++-- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 22 2 files changed, 29 inser

[PATCH 1/2] drm/amdgpu: Pass IP instance/hwid as parameters

2025-01-27 Thread Lijo Lazar
Use IP instance number and hwid as function args for validation checks. Signed-off-by: Lijo Lazar --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 42 --- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/g

[PATCH 2/2] drm/amdgpu: Use version to figure out harvest info

2025-01-27 Thread Lijo Lazar
IP tables with version <=2 may use harvest bit. For version 3 and above, harvest bit is not applicable, instead uses harvest table. Fix the logic accordingly. Signed-off-by: Lijo Lazar --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 27 +++ 1 file changed, 16 insertions(+), 1

[PATCH] drm/amd/display: restore invalid MSA timing check for freesync

2025-01-27 Thread Melissa Wen
This restores the original behavior that gets min/max freq from EDID and only set DP/eDP connector as freesync capable if "sink device is capable of rendering incoming video stream without MSA timing parameters", i.e., `allow_invalid_MSA_timing_params` is true. The condition was mistakenly removed

Re: [PATCH] drm/amdgpu: restore wait-free fastpath for GEM_WAIT_IDLE

2025-01-27 Thread Christian König
Am 27.01.25 um 17:33 schrieb Lucas Stach: Hi Christian, Am Montag, dem 27.01.2025 um 17:14 +0100 schrieb Christian König: Am 27.01.25 um 17:02 schrieb Lucas Stach: This effectively reverts 0fea2ed61e7f ("drm/amdgpu: Remove call to reservation_object_test_signaled_rcu before wait"), as the prem

[PATCH] drm/amdgpu: restore wait-free fastpath for GEM_WAIT_IDLE

2025-01-27 Thread Lucas Stach
This effectively reverts 0fea2ed61e7f ("drm/amdgpu: Remove call to reservation_object_test_signaled_rcu before wait"), as the premise of that commit is wrong. dma_resv_wait_timeout() without a timeout will not turn into a wait-free dma_resv_test_signaled, but will wait a jiffy for unsignaled fences

Re: [PATCH] drm/amdgpu: restore wait-free fastpath for GEM_WAIT_IDLE

2025-01-27 Thread Lucas Stach
Hi Christian, Am Montag, dem 27.01.2025 um 17:14 +0100 schrieb Christian König: > Am 27.01.25 um 17:02 schrieb Lucas Stach: > > This effectively reverts 0fea2ed61e7f ("drm/amdgpu: Remove call to > > reservation_object_test_signaled_rcu before wait"), as the premise of > > that commit is wrong. dma

Re: [PATCH] drm/amdgpu: restore wait-free fastpath for GEM_WAIT_IDLE

2025-01-27 Thread Christian König
Am 27.01.25 um 17:02 schrieb Lucas Stach: This effectively reverts 0fea2ed61e7f ("drm/amdgpu: Remove call to reservation_object_test_signaled_rcu before wait"), as the premise of that commit is wrong. dma_resv_wait_timeout() without a timeout will not turn into a wait-free dma_resv_test_signaled,

Re: [PATCH] drm/amdgpu: add a BO metadata flag to disable write compression for Vulkan

2025-01-27 Thread Marek Olšák
Updated patch attached. Vulkan can't support DCC and Z/S compression on GFX12 without this. Marek On Fri, Jan 24, 2025 at 10:15 AM Marek Olšák wrote: > Required by Vulkan because it can allocate whole VRAM as 1 BO and parts > of it bypass compression and read raw data. > > Signed-off-by: Marek

[PATCH 2/6] drm/amdgpu: use GFP_NOWAIT for memory allocations

2025-01-27 Thread Christian König
In the critical submission path memory allocations can't wait for reclaim since that can potentially wait for submissions to finish. Finally clean that up and mark most memory allocations in the critical path with GFP_NOWAIT. The only exception left is the dma_fence_array() used when no VMID is av

[PATCH 5/6] drm/amdgpu: rework how the cleaner shader is emitted

2025-01-27 Thread Christian König
Instead of emitting the cleaner shader for every job which has the enforce_isolation flag set only emit it for the first submission from every client. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 25 - 1 file changed, 20 insertions(+), 5 del

[PATCH 3/6] drm/amdgpu: overwrite signaled fence in amdgpu_sync

2025-01-27 Thread Christian König
This allows using amdgpu_sync even without peeking into the fences for a long time. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gp

[PATCH 4/6] drm/amdgpu: rework how isolation is enforced

2025-01-27 Thread Christian König
Limiting the number of available VMIDs to enforce isolation causes some issues with gang submit and applying certain HW workarounds which require multiple VMIDs to work correctly. So instead start to track all submissions to the relevant engines in a per partition data structure and use the dma_fe

[PATCH 6/6] drm/amdgpu: stop reserving VMIDs to enforce isolation

2025-01-27 Thread Christian König
That was quite troublesome for gang submit. Completely drop this approach and enforce the isolation separately. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 11

[PATCH 1/6] drm/amdgpu: grab an additional reference on the gang fence

2025-01-27 Thread Christian König
We keep the gang submission fence around in adev, make sure that it stays alive. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev

RE: [PATCH 00/14] DC Patches JANUARY 20, 2025

2025-01-27 Thread Wheeler, Daniel
[Public] Hi all, This week this patchset was tested on 4 systems, two dGPU and two APU based, and tested across multiple display and connection types. APU * Single Display eDP -> 1080p 60hz, 2560x1600 120hz, 1920x1200 165hz * Single Display DP (SST DSC) -> 4k144hz, 4k240hz

Re: [V7 31/45] drm/colorop: add BT2020/BT709 OETF and Inverse OETF

2025-01-27 Thread Pekka Paalanen
On Thu, 23 Jan 2025 15:16:29 -0500 Harry Wentland wrote: > On 2025-01-17 04:06, Pekka Paalanen wrote: > > On Thu, 16 Jan 2025 10:56:22 +0200 > > Pekka Paalanen wrote: > > > >> On Thu, 19 Dec 2024 21:33:37 -0700 > >> Alex Hung wrote: > >> > >>> From: Harry Wentland > >>> > >>> The BT.709 a

Re: [PATCH v10 2/4] drm/doc: Document device wedged event

2025-01-27 Thread Pekka Paalanen
On Wed, 22 Jan 2025 07:22:25 +0200 Raag Jadav wrote: > On Tue, Jan 21, 2025 at 02:14:56AM +0100, Xaver Hugl wrote: > > > +It is the responsibility of the consumer to make sure that the device or > > > +its resources are not in use by any process before attempting recovery. > > I'm not convinced

Re: [BUG,BISECTED] WARNING dcn20_find_secondary_pipe

2025-01-27 Thread Imre Deak
On Sun, Jan 26, 2025 at 04:46:49PM +, Chris Bainbridge wrote: > Hardware is HP Pavilion Aero 13 laptop with Dell WD19 dock and three > external monitors. I get a warning with recent kernel builds when > enabling the external monitors with xrandr after initial boot: > > 16:57:49 kernel: WARNING

[PATCH 05/63] dyndbg: replace classmap list with a vector

2025-01-27 Thread Jim Cromie
Classmaps are stored in an elf section/array, but are individually list-linked onto dyndbg's per-module ddebug_table for operation. This is unnecessary; even when ddebug_attach_classmap() is handling the builtin section (with classmaps for multiple builtin modules), its contents are ordered, so a

[PATCH 39/63] drm: use correct ccflags-y spelling

2025-01-27 Thread Jim Cromie
Incorrectly spelled CFLAGS- failed to add -DDYNAMIC_DEBUG_MODULE, which disabled dynamic-debug in modules built with: CONFIG_DYNAMIC_DEBUG=n # 1 CONFIG_DYNAMIC_DEBUG_CORE=y # 2 CONFIG_DRM_USE_DYNAMIC_DEBUG=y # 3 NB: this adds the flag (when 3) more often than strictly needed; module

[PATCH 21/63] dyndbg: allow ddebug_add_module to fail

2025-01-27 Thread Jim Cromie
To prep for failing modprobe on classid conflicts, upgrade the call-chain around ddebug_add_module(), in 2 ways: 1. in ddebug_add_module() add local reserved_ids to accumulate reservations, pass it by ref to ddebug_attach_{,user_}module_classes() so they can examine the reservations as they work.

[PATCH 49/63] drm-dyndbg: add DRM_CLASSMAP_USE to Xe driver

2025-01-27 Thread Jim Cromie
Invoke DRM_CLASSMAP_USE from xe_drm_client.c. When built with CONFIG_DRM_USE_DYNAMIC_DEBUG=y, this tells dydnbg that Xe uses has drm.debug calls. Signed-off-by: Jim Cromie --- drivers/gpu/drm/xe/xe_drm_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_drm_clie

[PATCH 04/63] dyndbg: make ddebug_class_param union members same size

2025-01-27 Thread Jim Cromie
struct ddebug_class_param keeps a ref to the state-storage of the param; make both class-types use the same unsigned long storage type. ISTM this is simpler and safer; it avoids an irrelevant difference, and if 2 users somehow get class-type mixed up (or refer to the wrong union member), at least

[PATCH 07/63] dyndbg: split param_set_dyndbg_classes to _module & wrapper fns

2025-01-27 Thread Jim Cromie
Split api-fn: param_set_dyndbg_classes(), adding modname param and passing NULL in from api-fn. The new arg allows caller to specify that only one module is affected by a prdbgs update. This selectivity will be used later to narrow the scope of changes made. no functional change. Signed-off-by:

[PATCH 43/63] drm-print: fix config-dependent unused variable

2025-01-27 Thread Jim Cromie
With CONFIG_DRM_USE_DYNAMIC_DEBUG=y, __drm_printfn_dbg() gets an unused variable warning/error on 'category', even though the usage follows immediately, in drm_debug_enabled(category). For static-key optimized dyndbg, the macro doesn't actually check the category var, since the static-key patches

[BUG,BISECTED] WARNING dcn20_find_secondary_pipe

2025-01-27 Thread Chris Bainbridge
Hardware is HP Pavilion Aero 13 laptop with Dell WD19 dock and three external monitors. I get a warning with recent kernel builds when enabling the external monitors with xrandr after initial boot: 16:57:49 kernel: WARNING: CPU: 4 PID: 1347 at drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn

[PATCH 27/63] selftests-dyndbg: add tools/testing/selftests/dynamic_debug/*

2025-01-27 Thread Jim Cromie
Add a selftest script for dynamic-debug. The config requires CONFIG_TEST_DYNAMIC_DEBUG=m (and CONFIG_TEST_DYNAMIC_DEBUG_SUBMOD=m), which tacitly requires either CONFIG_DYNAMIC_DEBUG=y or CONFIG_DYNAMIC_DEBUG_CORE=y ATM this has just basic_tests(), which modifies pr_debug flags in module params, w

[PATCH 55/63] drm-dyndbg: add DRM_CLASSMAP_USE to radeon

2025-01-27 Thread Jim Cromie
radeon has some DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg about its use of the class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon

[PATCH 16/63] dyndbg-API: replace DECLARE_DYNDBG_CLASSMAP

2025-01-27 Thread Jim Cromie
DECLARE_DYNDBG_CLASSMAP() has a design error; its usage fails a basic K&R rule: "define once, refer many times". It is used across DRM core & drivers, each use re-defines the classmap understood by that module; and all must match for the modules to respond together when DRM.debug categories are en

[PATCH 28/63] dyndbg-API: promote DYNDBG_CLASSMAP_PARAM to API

2025-01-27 Thread Jim Cromie
move the DYNDBG_CLASSMAP_PARAM macro from test-dynamic-debug.c into the header, and refine it, by distinguishing the 2 use cases: 1.DYNDBG_CLASSMAP_PARAM_REF for DRM, to pass in extern __drm_debug by name. dyndbg keeps bits in it, so drm can still use it as before 2.DYNDBG_CLASSMAP_PARAM

[PATCH 01/63] docs/dyndbg: update examples \012 to \n

2025-01-27 Thread Jim Cromie
commit 47ea6f99d06e ("dyndbg: use ESCAPE_SPACE for cat control") changed the control-file to display format strings with "\n" rather than "\012". Update the docs to match the new reality. Signed-off-by: Jim Cromie --- Documentation/admin-guide/dynamic-debug-howto.rst | 10 +- 1 file ch

[PATCH 54/63] drm-dyndbg: add DRM_CLASSMAP_USE to gma500 driver

2025-01-27 Thread Jim Cromie
The gma500 has 126 DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/gma500/psb_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/gma500/psb_drv

[PATCH 41/63] drm-dyndbg: adapt drm core to use dyndbg classmaps-v2

2025-01-27 Thread Jim Cromie
dyndbg's CLASSMAP-v1 api was broken; DECLARE_DYNDBG_CLASSMAP tried to do too much. Its replaced by DRM_CLASSMAP_DEFINE, which creates & EXPORTs a classmap (in DRM core), and DRM_CLASSMAP_USE which refers to the classmap defined elsewhere. The drivers still use DECLARE_DYNDBG_CLASSMAP for now, so

[PATCH 08/63] dyndbg: drop NUM_TYPE_ARRAY

2025-01-27 Thread Jim Cromie
ARRAY_SIZE works here, since array decl is complete. no functional change Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2b0057058ecf..e458d4b8

[PATCH 22/63] dyndbg: rework ddebug_attach_*module_classes()

2025-01-27 Thread Jim Cromie
These 2 fns both start with a codeblock which cleans up the classmaps arrays, finding the few that pertain to the module being added. Reduce this repetition to a macro: dd_mark_vector_subrange() and call it 2x. This macro finds the matching-on-modname subrange of a linker ordered array of builtin

[PATCH 53/63] drm-dyndbg: add DRM_CLASSMAP_USE to etnaviv

2025-01-27 Thread Jim Cromie
etnaviv has 5 DRM_UT_CORE debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module has class'd debugs as well as plain-old pr_debug()s Signed-off-by: Jim Cromie --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --g

[PATCH 40/63] checkpatch: dont warn about unused macro arg on empty body

2025-01-27 Thread Jim Cromie
we currently get: WARNING: Argument 'name' is not used in function-like macro on: #define DRM_CLASSMAP_USE(name) /* nothing here */ Following this advice is wrong here, and shouldn't be fixed by ignoring args altogether; the macro should properly fail if invoked with 0 or 2+ args. cc: Andy W

[PATCH 30/63] dyndbg: treat comma as a token separator

2025-01-27 Thread Jim Cromie
Treat comma as a token terminator, just like a space. This allows a user to avoid quoting hassles when spaces are otherwise needed: :#> modprobe drm dyndbg=class,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p or as a boot arg: drm.dyndbg=class,DRM_UT_CORE,+p # todo: support multi-query here Given the

[PATCH 10/63] dyndbg: silence debugs with no-change updates

2025-01-27 Thread Jim Cromie
In ddebug_apply_class_bitmap(), check for actual changes to the bits before announcing them, to declutter logs. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dyna

[PATCH 34/63] docs/dyndbg: explain new delimiters: comma, percent

2025-01-27 Thread Jim Cromie
Add mention of comma and percent delimiters into the respective paragraphs describing their equivalents: space and newline. Signed-off-by: Jim Cromie --- .../admin-guide/dynamic-debug-howto.rst | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Documen

[PATCH 02/63] test-dyndbg: fixup CLASSMAP usage error

2025-01-27 Thread Jim Cromie
A more careful reading of logging output from test_dynamic_debug.ko reveals: lib/test_dynamic_debug.c:103 [test_dynamic_debug]do_cats =pmf "doing categories\n" lib/test_dynamic_debug.c:105 [test_dynamic_debug]do_cats =p "LOW msg\n" class:MID lib/test_dynamic_debug.c:106 [test_dynamic_debug]do_ca

[PATCH 64/64] This series fixes dyndbg (dynamic debug) classmap support for DRM.

2025-01-27 Thread Jim Cromie
Despite a few latent flaws (1-3 below), classmaps-v1 went in with: ee7d633f2dfb drm-print.h: include dyndbg header 84ec67288c10 drm_print: wrap drm_*_dbg in dyndbg descriptor factory macro e820f52577b1 drm_print: interpose drm_*dbg with forwarding macros f158936b60a7 drm: POC drm on dyndbg - use i

[PATCH 61/63] drm-dyndbg: add DRM_CLASSMAP_USE to the qxl driver

2025-01-27 Thread Jim Cromie
The qxl driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/qxl/qxl_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_drv.c

[PATCH 19/63] dyndbg: make proper substructs in _ddebug_info

2025-01-27 Thread Jim Cromie
struct _ddebug_info's jobs is to enapsulate the __sections of dyndbg data from the linker. The data started as a single pair of fields: descs - ref'g an array of descriptors & num_descs - counting the "pertinent" descriptors. Then classes & num_classes were added, and _ddebug_info was invented to

[PATCH 57/63] drm-dyndbg: add DRM_CLASSMAP_USE to vkms driver

2025-01-27 Thread Jim Cromie
The vkms driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/vkms/vkms_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_d

[PATCH 20/63] dyndbg: drop premature optimization in ddebug_add_module

2025-01-27 Thread Jim Cromie
The class_ct var was added to avoid 2 function calls, but to do this it loops over all the module's debug callsites to determine the count. But it doesn't really help, so remove it. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-)

[PATCH 51/63] drm-dyndbg: add DRM_CLASSMAP_USE to simpledrm

2025-01-27 Thread Jim Cromie
tiny/simpledrm has 3 DRM_UT_DRIVER debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/tiny/simpledrm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/si

[PATCH 56/63] drm-dyndbg: add DRM_CLASSMAP_USE to vmwgfx driver

2025-01-27 Thread Jim Cromie
The vmwgfx driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vmwgf

[PATCH 24/63] dyndbg: hoist the range-overlap checks

2025-01-27 Thread Jim Cromie
hoist the classmaps range-check up to ddebug_add_module() from ddebug_module_apply_class*(). THis puts both copies of the task together, with the other semi-init work. this allows ddebug_module_apply_class*() to revert back to void return, but doesn't do that yet. this is a candidate for squashi

[PATCH 45/63] drm-dyndbg: DRM_CLASSMAP_USE in i915 driver

2025-01-27 Thread Jim Cromie
Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f

[PATCH 36/63] docs/dyndbg: explain flags parse 1st

2025-01-27 Thread Jim Cromie
When writing queries to >control, flags are parsed 1st, since they are the only required field, and they require specific compositions. So if the flags draw an error (on those specifics), then keyword errors aren't reported. This can be mildly confusing/annoying, so explain it instead. Signed-of

[PATCH 46/63] drm-dyndbg: DRM_CLASSMAP_USE in drm_crtc_helper

2025-01-27 Thread Jim Cromie
Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f

[PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()

2025-01-27 Thread Imkanmod Khan
From: Nikita Zhandarovich [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ] Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL before the call to dc_enable_dmub_notifications(), check beforehand to ensure there will not be a possible NULL-ptr-deref there. Also, since c

[PATCH 62/63] drm-dyndbg: add DRM_CLASSMAP_USE to the drm_gem_shmem_helper driver

2025-01-27 Thread Jim Cromie
The drm_gem_shmem_helper driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/drm_gem_shmem_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/driver

[PATCH 35/63] selftests-dyndbg: add test_mod_submod

2025-01-27 Thread Jim Cromie
This new test-fn runs 3 module/submodule modprobe scenarios, variously using both the generic dyndbg= modprobe arg, and the test-module's classmap-params to manipulate the test-mod*'s pr_debugs. In all cases, the current flag-settings are counted and tested vs expectations. The 3rd scenario recapi

[PATCH 37/63] dyndbg: change __dynamic_func_call_cls* macros into expressions

2025-01-27 Thread Jim Cromie
The Xe driver's XE_IOCTL_DBG macro calls drm_dbg() from inside an if (expression). This breaks when CONFIG_DRM_USE_DYNAMIC_DEBUG=y because the invoked macro has a do-while-0 wrapper. if (cond && (drm_dbg("expr-form"),1)) { ... do some more stuff } Fix for this usage by changing __dyn

[PATCH 31/63] selftests-dyndbg: add comma_terminator_tests

2025-01-27 Thread Jim Cromie
New fn validates parsing and effect of queries using combinations of commas and spaces to delimit the tokens. It manipulates pr-debugs in builtin module/params, so might have deps I havent foreseen on odd configurations. Signed-off-by: Jim Cromie --- - skip comma tests if no builtins --- .../dy

[PATCH 47/63] drm-dyndbg: DRM_CLASSMAP_USE in drm_dp_helper

2025-01-27 Thread Jim Cromie
Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f

[PATCH 26/63] dyndbg-test: change do_prints testpoint to accept a loopct

2025-01-27 Thread Jim Cromie
echo 1000 > /sys/module/test_dynamic_debug/parameters/do_prints This allows its use as a scriptable load generator, to generate dynamic-prefix-emits for flag combinations vs undecorated printks. This will make it easy to assess the cost of the prefixing. NB: the count is an unsigned int, and is *

[PATCH 44/63] drm-dyndbg: DRM_CLASSMAP_USE in amdgpu driver

2025-01-27 Thread Jim Cromie
Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f

[PATCH 17/63] dyndbg: check DYNDBG_CLASSMAP_DEFINE args at compile-time

2025-01-27 Thread Jim Cromie
Add __DYNDBG_CLASSMAP_CHECK to implement these arg-checks at compile: 0 <= _base < 63 class_names is not empty class_names[0] is a string (class_names.length + _base) < 63 These compile-time checks will prevent several misuses; 4 such examples are added to test_dyna

[PATCH 42/63] drm-dyndbg: adapt DRM to invoke DYNDBG_CLASSMAP_PARAM

2025-01-27 Thread Jim Cromie
Invoke DYNDBG_CLASSMAP_PARAM to hook drm.debug (__drm_debug) to the DRM_UT_* classmap, replacing the ad-hoc wiring previously doing it. Add DRM_CLASSMAP_* adapter macros to selectively use DYNDBG_CLASSMAP_* when DRM_USE_DYNAMIC_DEBUG=y is configured. Signed-off-by: Jim Cromie --- drivers/gpu/dr

[PATCH 32/63] dyndbg: split multi-query strings with %

2025-01-27 Thread Jim Cromie
Since commit 85f7f6c0edb8 ("dynamic_debug: process multiple debug-queries on a line") Multi-query commands have been allowed: modprobe drm dyndbg="class DRM_UT_CORE +p; class DRM_UT_KMS +p" modprobe drm dyndbg=< [ 203.902703] dyndbg: query parse failed [ 203.902871] dyndbg: processed 2 quer

[PATCH 58/63] drm-dyndbg: add DRM_CLASSMAP_USE to udl driver

2025-01-27 Thread Jim Cromie
The udl driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/udl/udl_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/udl/udl_main.

[PATCH 13/63] dyndbg: reduce verbose=3 messages in ddebug_add_module

2025-01-27 Thread Jim Cromie
When modprobing a module, dyndbg currently logs/says "add-module", and then "skipping" if the module has no prdbgs. Instead just check 1st and return quietly. no functional change Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) di

[PATCH 25/63] ddebug: cleanup-range-overlap fails

2025-01-27 Thread Jim Cromie
add cleanup block, to handle kfree before dt is added to list. Once dt is on-list, do ddebug_remove_module to cleanup. tbd. review some more. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/li

[PATCH 33/63] selftests-dyndbg: test_percent_splitting

2025-01-27 Thread Jim Cromie
This does basic testing of classmaps using '%' separated multi-queries. It modprobes test_dynamic_debug with several classes enabled, and counts to verify that the expected sites show the enablement in the control file. Signed-off-by: Jim Cromie --- .../dynamic_debug/dyndbg_selftest.sh

[PATCH 29/63] dyndbg-doc: add classmap info to howto

2025-01-27 Thread Jim Cromie
Describe the 3 API macros providing dynamic_debug's classmaps DYNDBG_CLASSMAP_DEFINE - create, exports a module's classmap DYNDBG_CLASSMAP_USE- refer to exported map DYNDBG_CLASSMAP_PARAM - bind control param to the classmap DYNDBG_CLASSMAP_PARAM_REF + use module's storage - __drm_debug cc:

[PATCH 38/63] dyndbg: drop "protection" of class'd pr_debugs from legacy queries

2025-01-27 Thread Jim Cromie
Current classmap code protects class'd pr_debugs from unintended changes by "legacy" unclassed queries: # this doesn't disable all of DRM_UT_* categories echo "-p" > /proc/dynamic_debug/control # name the class to change it - protective but tedious echo "class DRM_UT_CORE +p" > /proc/dyna

[PATCH 50/63] drm-dyndbg: add DRM_CLASSMAP_USE to virtio_gpu

2025-01-27 Thread Jim Cromie
virtio_gpu has 10 DRM_UT_CORE debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/virtio/virtgpu_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/virtio/v

[PATCH 60/63] drm-dyndbg: add DRM_CLASSMAP_USE to the gud driver

2025-01-27 Thread Jim Cromie
The gud driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/gud/gud_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/gud/gud_drv.c

[PATCH 59/63] drm-dyndbg: add DRM_CLASSMAP_USE to mgag200 driver

2025-01-27 Thread Jim Cromie
The mgag200 driver has a number of DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module uses them. Signed-off-by: Jim Cromie --- drivers/gpu/drm/mgag200/mgag200_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mg

[PATCH 18/63] dyndbg: add/use for_subvec() to reduce boilerplate

2025-01-27 Thread Jim Cromie
add for_subvec() macro to encapsulate a for-loop pattern thats used repeatedly to iterate over a boxed.vector of N elements. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/dynamic_debug.c b

[PATCH 12/63] dyndbg: tighten fn-sig of ddebug_apply_class_bitmap

2025-01-27 Thread Jim Cromie
old_bits arg is currently a pointer to the input bits, but this could allow inadvertent changes to the input by the fn. Disallow this. And constify new_bits while here. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-

[PATCH 48/63] drm-dyndbg: DRM_CLASSMAP_USE in nouveau

2025-01-27 Thread Jim Cromie
Following the dyndbg-api-fix, replace DECLARE_DYNDBG_CLASSMAP with DRM_CLASSMAP_USE. This refs the defined & exported classmap, rather than re-declaring it redundantly, and error-prone-ly. This resolves the appearance of "class:_UNKNOWN_" in the control file for the driver's drm_dbg()s. Fixes: f

[PATCH 03/63] dyndbg: reword "class unknown," to "class:_UNKNOWN_"

2025-01-27 Thread Jim Cromie
When a dyndbg classname is unknown to a kernel module (as before previous patch), the callsite is un-addressable via >control queries. The control-file displays this condition as "class unknown," currently. That spelling is sub-optimal/too-generic, so change it to "class:_UNKNOWN_" to loudly anno

[PATCH 00/63] Fix CONFIG_DRM_USE_DYNAMIC_DEBUG=y

2025-01-27 Thread Jim Cromie
This series fixes dynamic-debug's support for DRM debug-categories. Classmaps-v1 evaded full review, and got committed in 2 chunks: b7b4eebdba7b..6ea3bf466ac6# core dyndbg changes 0406faf25fb1..ee7d633f2dfb# drm adoption DRM-CI found a regression during init with drm.debug=; the stati

[PATCH 63/63] drm: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN

2025-01-27 Thread Jim Cromie
Time for some thorough CI. Also, the previous 18 patches could perhaps be replaced by a single invocation of DYNDBG_CLASSMAP_USE, from a C-file linked into all drm drivers & helpers. I didn't find such a file, nor a drm-client linkage item in the Makefile. Signed-off-by: Jim Cromie --- drivers

[PATCH 15/63] checkpatch: add an exception to the do-while wrapper advice

2025-01-27 Thread Jim Cromie
Several new DYNDBG_CLASSMAP_* macros (added in following commits) expand to multi-statement declarations, like module_param_named does. They are invoked in file-scope, not in function scope, and cannot be wrapped by a do-while, so add an exception by name for them. cc: Andy Whitcroft cc: Joe Perc

[PATCH 09/63] dyndbg: reduce verbose/debug clutter

2025-01-27 Thread Jim Cromie
currently, for verbose=3, these are logged (blank lines for clarity): dyndbg: query 0: "class DRM_UT_CORE +p" mod:* dyndbg: split into words: "class" "DRM_UT_CORE" "+p" dyndbg: op='+' dyndbg: flags=0x1 dyndbg: *flagsp=0x1 *maskp=0x dyndbg: parsed: func="" file="" module="" format="

[PATCH 52/63] drm-dyndbg: add DRM_CLASSMAP_USE to bochs

2025-01-27 Thread Jim Cromie
tiny/bochs has 5 DRM_UT_* debugs, make them controllable when CONFIG_DRM_USE_DYNAMIC_DEBUG=y by telling dyndbg that the module has class'd debugs. Signed-off-by: Jim Cromie --- drivers/gpu/drm/tiny/bochs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drive

[PATCH 23/63] dyndbg: fail modprobe on ddebug_class_range_overlap()

2025-01-27 Thread Jim Cromie
1. All classes used by a module (declared DYNDBG_CLASSMAP_{DEFINE,USE} by module code) must share 0..62 class-id space; ie their respective base,+length reservations shouldn't overlap. Overlaps would lead to unintended changes in ddebug enablements. Detecting these class-id range overlaps at comp

[PATCH 14/63] dyndbg-API: remove DD_CLASS_TYPE_(DISJOINT|LEVEL)_NAMES and code

2025-01-27 Thread Jim Cromie
Remove the NAMED class types; these 2 classmap types accept class names at the PARAM interface, for example: echo +DRM_UT_CORE,-DRM_UT_KMS > /sys/module/drm/parameters/debug_names The code works, but its only used by test-dynamic-debug, and wasn't asked for by anyone else, so reduce test-surfac

[PATCH 11/63] dyndbg: tighten ddebug_class_name() 1st arg type

2025-01-27 Thread Jim Cromie
Change function's 1st arg-type, and deref in the caller. The fn doesn't need any other fields in the struct. no functional change. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_d

[PATCH 06/63] dyndbg: ddebug_apply_class_bitmap - add module arg, select on it

2025-01-27 Thread Jim Cromie
Add param: query_module to ddebug_apply_class_bitmap(), and pass it thru to _ddebug_queries(), replacing NULL with query_module. This allows its caller to update just one module, or all (as currently). We'll use this later to propagate drm.debug to each USEr as they're modprobed. No functional c