[drm:dm_plane_helper_prepare_fb [amdgpu]] *ERROR* Failed to pin framebuffer with error -12

From: Mikhail Gavrilov
Date: Sun Jan 10 2021 - 17:27:43 EST


Hi folks,
today I joined to testing Kernel 5.11 and saw that the kernel log was
flooded with BUG messages:
BUG: sleeping function called from invalid context at mm/vmalloc.c:1756
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 266, name: kswapd0
INFO: lockdep is turned off.
CPU: 15 PID: 266 Comm: kswapd0 Tainted: G W ---------
--- 5.11.0-0.rc2.20210108gitf5e6c330254a.119.fc34.x86_64 #1
Hardware name: System manufacturer System Product Name/ROG STRIX
X570-I GAMING, BIOS 2802 10/21/2020
Call Trace:
dump_stack+0x8b/0xb0
___might_sleep.cold+0xb6/0xc6
vm_unmap_aliases+0x21/0x40
change_page_attr_set_clr+0x9e/0x190
set_memory_wb+0x2f/0x80
ttm_pool_free_page+0x28/0x90 [ttm]
ttm_pool_shrink+0x45/0xb0 [ttm]
ttm_pool_shrinker_scan+0xa/0x20 [ttm]
do_shrink_slab+0x177/0x3a0
shrink_slab+0x9c/0x290
shrink_node+0x2e6/0x700
balance_pgdat+0x2f5/0x650
kswapd+0x21d/0x4d0
? do_wait_intr_irq+0xd0/0xd0
? balance_pgdat+0x650/0x650
kthread+0x13a/0x150
? __kthread_bind_mask+0x60/0x60
ret_from_fork+0x22/0x30

But the most unpleasant thing is that after a while the monitor turns
off and does not go on again until the restart.
This is accompanied by an entry in the kernel log:

amdgpu 0000:0b:00.0: amdgpu: 00000000ff7d8b94 pin failed
[drm:dm_plane_helper_prepare_fb [amdgpu]] *ERROR* Failed to pin
framebuffer with error -12

$ grep "Failed to pin framebuffer with error" -Rn .
./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:5816:
DRM_ERROR("Failed to pin framebuffer with error %d\n", r);

$ git blame -L 5811,5821 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Blaming lines: 0% (11/9167), done.
5d43be0ccbc2f (Christian König 2017-10-26 18:06:23 +0200 5811)
domain = AMDGPU_GEM_DOMAIN_VRAM;
e7b07ceef2a65 (Harry Wentland 2017-08-10 13:29:07 -0400 5812)
7b7c6c81b3a37 (Junwei Zhang 2018-06-25 12:51:14 +0800 5813) r =
amdgpu_bo_pin(rbo, domain);
e7b07ceef2a65 (Harry Wentland 2017-08-10 13:29:07 -0400 5814) if
(unlikely(r != 0)) {
30b7c6147d18d (Harry Wentland 2017-10-26 15:35:14 -0400 5815)
if (r != -ERESTARTSYS)
30b7c6147d18d (Harry Wentland 2017-10-26 15:35:14 -0400 5816)
DRM_ERROR("Failed to pin framebuffer with error %d\n", r);
0f257b09531b4 (Chunming Zhou 2019-05-07 19:45:31 +0800 5817)
ttm_eu_backoff_reservation(&ticket, &list);
e7b07ceef2a65 (Harry Wentland 2017-08-10 13:29:07 -0400 5818)
return r;
e7b07ceef2a65 (Harry Wentland 2017-08-10 13:29:07 -0400 5819) }
e7b07ceef2a65 (Harry Wentland 2017-08-10 13:29:07 -0400 5820)
bb812f1ea87dd (Junwei Zhang 2018-06-25 13:32:24 +0800 5821) r =
amdgpu_ttm_alloc_gart(&rbo->tbo);

Who knows how to fix it?

Full kernel logs is here:
[1] https://pastebin.com/fLasjDHX
[2] https://pastebin.com/g3wR2r9e

--
Best Regards,
Mike Gavrilov.