Skip to content

drm/amdgpu: When device init failed, there is no remove measure file. - #113

Closed
jinsdb wants to merge 3070 commits into
ROCm:masterfrom
jinsdb:master
Closed

drm/amdgpu: When device init failed, there is no remove measure file.#113
jinsdb wants to merge 3070 commits into
ROCm:masterfrom
jinsdb:master

Conversation

@jinsdb

@jinsdb jinsdb commented May 28, 2021

Copy link
Copy Markdown
Contributor

When device init failed, there is no remove measure file.
here is the log:

  1. device init failed due to firmware loss
    [ 4.032747] amdgpu 0000:43:00.0: irq 106 for MSI/MSI-X
    [ 4.032801] amdgpu 0000:43:00.0: gfx9: Failed to load firmware "amdgpu/vega20_rlc.bin"
    [ 4.032869] [drm:gfx_v9_0_sw_init [amdgpu]] ERROR Failed to load gfx firmware!
    [ 4.032926] [drm:amdgpu_device_init [amdgpu]] ERROR sw_init of IP block <gfx_v9_0> failed -2
    [ 4.032970] amdgpu 0000:43:00.0: amdgpu_device_ip_init failed
    [ 4.033003] amdgpu 0000:43:00.0: Fatal error during GPU init
    [ 4.033032] [drm] amdgpu: finishing device.
    [ 4.034232] amdgpu: probe of 0000:43:00.0 failed with error -2

  2. rmmod amdpu and reload amdgpu,cause system reset:
    [ 123.330381] BUG: unable to handle kernel paging request at ffffffffc01b04df
    [ 123.330468] IP: [] strcmp+0x20/0x40
    [ 123.330525] PGD 2dce14067 PUD 2dce16067 PMD fd7273067 PTE 0
    [ 123.330590] Oops: 0000 [Modify README.md to warn the users to un-install old driver before in… #1] SMP
    [ 123.331951] Workqueue: events work_for_cpu_fn
    [ 123.331992] task: ffff9b8f8c87e180 ti: ffff9b8f93fe4000 task.ti: ffff9b8f93fe4000
    [ 123.332054] RIP: 0010:[] [] strcmp+0x20/0x40
    [ 123.332124] RSP: 0018:ffff9b8f93fe7c78 EFLAGS: 00010292
    [ 123.332171] RAX: 0000000000000063 RBX: ffff9b903eefd1f8 RCX: 0000000000000000
    [ 123.332230] RDX: 0000000033584a28 RSI: ffffffffc01b04e0 RDI: ffffffffc026e4e0
    [ 123.332288] RBP: ffff9b8f93fe7c78 R08: 0000000000000000 R09: 0000000000000000
    [ 123.332347] R10: ffff9b8f9dc1f380 R11: fffff6ddbf5e4800 R12: ffff9b903eefdb40
    [ 123.332405] R13: ffff9b829d4c0078 R14: ffffffffc02703a0 R15: ffff9b8f89257a00
    [ 123.332465] FS: 00002b11916db480(0000) GS:ffff9b8f9dc00000(0000) knlGS:0000000000000000
    [ 123.332532] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 123.332580] CR2: ffffffffc01b04df CR3: 000000084fb54000 CR4: 00000000003407e0
    [ 123.332639] Call Trace:
    [ 123.332671] [] kernfs_link_sibling+0x79/0xf0
    [ 123.332724] [] kernfs_add_one+0x9a/0x150
    [ 123.332774] [] __kernfs_create_file+0x7e/0xa0
    [ 123.332827] [] sysfs_add_file_mode_ns+0x9b/0x160
    [ 123.332882] [] sysfs_create_file_ns+0x2a/0x30
    [ 123.332938] [] device_create_file+0x3f/0xa0
    [ 123.332993] [] _kcl_pci_create_measure_file+0x22/0x100 [amdkcl]
    [ 123.333104] [] amdgpu_pci_probe+0x148/0x270 [amdgpu]
    [ 123.333163] [] local_pci_probe+0x4a/0xb0
    [ 123.333212] [] work_for_cpu_fn+0x1a/0x30
    [ 123.333261] [] process_one_work+0x17f/0x440
    [ 123.333312] [] worker_thread+0x278/0x3c0
    [ 123.333362] [] ? manage_workers.isra.25+0x2a0/0x2a0
    [ 123.333419] [] kthread+0xd1/0xe0
    [ 123.333463] [] ? insert_kthread_work+0x40/0x40
    [ 123.333519] [] ret_from_fork_nospec_begin+0xe/0x21
    [ 123.333575] [] ? insert_kthread_work+0x40/0x40
    [ 123.333625] Code: 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 eb 0e 66 2e 0f 1f 84 00 00 00 00 00 84 c0 74 1c 48 83 c7 01 0f b6 47 ff 48 83 c6 01 <3a> 46 ff 74 eb 19 c0 83 c8 01 5d c3 0f 1f 40 00 31 c0 5d c3 66
    [ 123.334002] RIP [] strcmp+0x20/0x40
    [ 123.334053] RSP
    [ 123.334083] CR2: ffffffffc01b04df

Tom St Denis and others added 30 commits March 8, 2021 10:05
The register mmOTG1_OTG_BLANK_CONTROL was missing BASE_IDX value.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
[Why & How]
Find out that referring to crtc_state->crc_src is not thread safe.
Move crc_src from dm_crtc_state to dm_irq_params to fix this.

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
[Why]
To support feature that calculates CRTC CRC value on specific
region (crc window).

[How]
1. Use debugfs to specify crtc crc window
2. Use vline0 IRQ to write crtc crc window

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
[Why & How]
Add additional MCP_SCP commands for starting/stopping updaing crc
window at DMCU

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
[Why & How]
To have crc window being unchanged, we have dmcu to keep monitoring crc
window registers. In order not to have driver and dmcu change crc
registers at the same time, have work of changing crc window to be done
by dmcu fw.

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
[Why & How]
To read back crc by sending command READ_ROI_CRC to
PSP TA to ask it to read out crc of crc window.

Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Eryk Brol <eryk.brol@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
SDMA 4_x asics share the same MGCG/MGLS setting.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Add VM_HOLE/DOORBELL_INVALID_BE/POLL_TIMEOUT/SRBMWRITE
interrupt info printing.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Change-Id: Ie514d194e628a0f742a20e4bd4bb1d8fccebaf33
Signed-off-by: Rui Teng <rui.teng@amd.com>
Change-Id: Icb63cfb32e095be01d403a41d8c36334ea59d3a0
Signed-off-by: Rui Teng <rui.teng@amd.com>
[Why]
when try to shutdown guest vm in sriov mode, virt data
exchange is not fini. After vram lost, trying to write
vram could hang cpu.

[How]
add fini virt data exchange in ip_suspend

Signed-off-by: Jingwen Chen <Jingwen.Chen2@amd.com>
Reviewed-by: Jack Zhang <Jack.Zhang1@amd.com>
When unloading driver after killing some applications, it will hit sdma
flush tlb job timeout which is called by ttm_bo_delay_delete. So
to avoid the job submit after fence driver fini, call ttm_bo_lock_delayed_workqueue
before fence driver fini. And also put drm_sched_fini before waiting fence.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
If have memory leak, maybe it will have issue in
ttm_bo_force_list_clean-> ttm_mem_evict_first.

Set adev->gart.ptr to null to avoid to call
amdgpu_gmc_set_pte_pde to cause ptr issue pointer when
calling amdgpu_gart_unbind in amdgpu_bo_fini which is after gart_fini.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Existing, buggy user mode breaks when SRAM ECC is correctly reported as
"enabled". To avoid breaking existing user mode, deprecate that bit and
leave it as 0. Define a new bit to report the actual SRAM ECC mode that
new, correct user mode can use in the future.

Fixes: 7ec177b ("drm/amdkfd: fix set kfd node ras properties value")
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
Trap handler is set per-process per-device and is unrelated
to queue management.

Move implementation closer to TMA setup code.

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
This has been stable for a while.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
We set up the parameters, but never called the atom table.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Avoid the extra wrapper function.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
It just spams the logs.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Need to fetch it via aux.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This patch is caused by 'drm/amdgpu/display: handle aux backlight in backlight_get_brightness'
v5.11-2425-ge0b52d6b6d5d

Signed-off-by: Leslie Shi <Yuliang.Shi@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
There seem devices that don't work with the aux channel backlight
control.  For allowing such users to test with the other backlight
control method, provide a new module option, aux_backlight, to specify
enabling or disabling the aux backport support explicitly.  As
default, the aux support is detected by the hardware capability.

v2: make the backlight option generic in case we add future
backlight types (Alex)

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1180749
BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1438
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Fix the following coccicheck warnings:

./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:956:52-57: WARNING:
conversion to bool not needed here.

./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:8311:16-21: WARNING:
conversion to bool not needed here.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
The variable status is being initialized with a value that is never read
and it is being updated later with a new value.  The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
The continue statement in a for-loop is redudant and can be removed.
Clean up the code to address this.

Addresses-Coverity: ("Continue as no effect")
Fixes: b6f91fc ("drm/amdgpu/display: buffer INTERRUPT_LOW_IRQ_CONTEXT interrupt work")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Commit 41401ac added FPU wrappers to dcn21_validate_bandwidth(),
which was correct. Unfortunately a nested function alredy contained
DC_FP_START()/DC_FP_END() calls, which results in nested FPU context
enter/exit and complaints by kernel_fpu_begin_mask().
This can be observed e.g. with 5.10.20, which backported 41401ac
and now emits the following warning on boot:

WARNING: CPU: 6 PID: 858 at arch/x86/kernel/fpu/core.c:129 kernel_fpu_begin_mask+0xa5/0xc0
Call Trace:
 dcn21_calculate_wm+0x47/0xa90 [amdgpu]
 dcn21_validate_bandwidth_fp+0x15d/0x2b0 [amdgpu]
 dcn21_validate_bandwidth+0x29/0x40 [amdgpu]
 dc_validate_global_state+0x3c7/0x4c0 [amdgpu]

The warning is emitted due to the additional DC_FP_START/END calls in
patch_bounding_box(), which is inlined into dcn21_calculate_wm(),
its only caller. Removing the calls brings the code in line with
dcn20 and makes the warning disappear.

Fixes: 41401ac ("drm/amd/display: Add FPU wrappers to dcn21_validate_bandwidth()")
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
After fixing nested FPU contexts caused by 41401ac we're still seeing
complaints about spurious kernel_fpu_end(). As it turns out this was
already fixed for dcn20 in commit f41ed88 ("drm/amdgpu/display:
use GFP_ATOMIC in dcn20_validate_bandwidth_internal") but never moved
forward to dcn21.

Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Move fences that have already signaled should not prevent memory
allocations with no_wait_gpu.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Trap handler behavior will differ when a debugger is attached.

Make the debug trap flag available in the trap handler TMA.
Update it when the debug trap ioctl is invoked.

v2:
Add missing debug flag setup on APUs

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Philip Cox <philip.cox@amd.com>
Cc: Jonathan Kim <jonathan.kim@amd.com>
v1: Add gc v9_4_2 register offset and shift
masks in header files (Hawking)
v2: Clean up gc v9_4_2 registers (Alex)
v3: update registers (Alex)

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Rui Teng and others added 15 commits March 18, 2021 15:42
Change-Id: I4d4c77e847761261b70a9bff6eb38ea972fa3903
Signed-off-by: Rui Teng <rui.teng@amd.com>
Change-Id: I83c9dd6e55d00382bcc535be94a2a554fcb9b5d9
Signed-off-by: Rui Teng <rui.teng@amd.com>
This change was lost in last merge. The upstream commit 672242b
removed init_mem_type

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Acked-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Reviewed-by:  Eric Huang <jinhuieric.huang@amd.com>
This change does a partial revert of this commit

'drm/amdgpu: set CPU mapping of vram as cached for A+A mode (v2)'

The on-chip memory pools are not accessed by CPU so the previous change
is not necessary

Acked-by: Joseph Greathouse <Joseph.Greathouse@amd.com>
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Oak Zeng <Oak.Zeng@amd.com>
Setting amdgpu.noretry=1 as default for Arcturus.

Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
This resolves SWDEV-278695.

Searching for queues by process to raise debug events on doorbell ids will
raise an event on the wrong queue since doorbell ids can overlap per
process.  Do an additional device check to prevent this.

Reported-by: Laurent Morichetti <laurent.morichetti@amd.com>
Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Indicate the availability reliable SRAM EDC state in the new bit
in the device properties.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
It's mostly a wrapper around the peerdirect code. One small modification
to the API was needed to support DMA mapping with an added dma_dev
parameter in the get_pages function:

	int (*get_pages)(uint64_t address, uint64_t length, struct pid *pid,
			 struct device *dma_dev,
			 struct amd_p2p_info **amd_p2p_data,
			 void  (*free_callback)(void *client_priv),
			 void  *client_priv);

Added version macros to allow users to distinguish the API version. This
is version 2.0.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
amd_rdma.h is added, so need to update dkms sources.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
The debugger should not touch hardware state on unwind nor drop references
for a target it does not own.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
If we skipped loading MEC2 firmware separately
from MEC, then MEC2 will be running the same
firmware image. Copy the MEC version and feature
numbers into MEC2 version and feature numbers.
This is needed for things like GWS support, where
we rely on knowing what version of firmware is
running on MEC2. Leaving these MEC2 entries blank
breaks our ability to version-check enables and
workarounds.

Change-Id: Iabd19ec51b89395a8b83772138c490553bc6e032
Signed-off-by: Joseph Greathouse <Joseph.Greathouse@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
The HW is not in production yet. Driver support is still in development.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
dev_*_ratelimited printing will avoid dmesg flush.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Acked-by: Kent Russell <kent.russell@amd.com>
Change the print level into debug.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
@kentrussell

Copy link
Copy Markdown
Collaborator

Merged

kentrussell pushed a commit that referenced this pull request Aug 26, 2026
If hardware doesn't support RX Flow Filters, rx_fs_lock spinlock is not
initialized leading to the following assertion splat triggerable via
set_rxnfc callback.

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 PID: 949 Comm: syz.0.6 Not tainted 6.1.164+ #113
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x8d/0xba lib/dump_stack.c:106
 assign_lock_key kernel/locking/lockdep.c:974 [inline]
 register_lock_class+0x141b/0x17f0 kernel/locking/lockdep.c:1287
 __lock_acquire+0x74f/0x6c40 kernel/locking/lockdep.c:4928
 lock_acquire kernel/locking/lockdep.c:5662 [inline]
 lock_acquire+0x190/0x4b0 kernel/locking/lockdep.c:5627
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x33/0x50 kernel/locking/spinlock.c:162
 gem_del_flow_filter drivers/net/ethernet/cadence/macb_main.c:3562 [inline]
 gem_set_rxnfc+0x533/0xac0 drivers/net/ethernet/cadence/macb_main.c:3667
 ethtool_set_rxnfc+0x18c/0x280 net/ethtool/ioctl.c:961
 __dev_ethtool net/ethtool/ioctl.c:2956 [inline]
 dev_ethtool+0x229c/0x6290 net/ethtool/ioctl.c:3095
 dev_ioctl+0x637/0x1070 net/core/dev_ioctl.c:510
 sock_do_ioctl+0x20d/0x2c0 net/socket.c:1215
 sock_ioctl+0x577/0x6d0 net/socket.c:1320
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x18c/0x210 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x35/0x80 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x6e/0xd8

A more straightforward solution would be to always initialize rx_fs_lock,
just like rx_fs_list.  However, in this case the driver set_rxnfc callback
would return with a rather confusing error code, e.g. -EINVAL.  So deny
set_rxnfc attempts directly if the RX filtering feature is not supported
by hardware.

Fixes: ae8223d ("net: macb: Added support for RX filtering")
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Link: https://patch.msgid.link/20260316103826.74506-2-pchelkin@ispras.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.