ttm_bo_add_to_lru mystery

Michel Dänzer michel at
Wed Feb 10 09:28:34 UTC 2016

I recently came to realize that nothing seems to be ensuring that BOs
which are unpinned in the amdgpu/radeon drivers get added to the TTM
LRU list. I thought that should be easy enough to fix, but I ran into
an issue that has me scratching my head.

See the attached patch for the current debugging state, and the
corresponding dmesg output below. The BO's lru member is considered
empty (i.e. it's not hooked up to the LRU list) in radeon_bo_unpin,
as expected. However, calling ttm_bo_add_to_lru in that case, the lru
member is suddenly not considered empty (i.e. it seems to be hooked up
to the LRU list, which would normally trigger the BUG_ON). And indeed,
the prev/next pointers are different between the two functions. But I
have no idea how they could be modified between those two points, or
why else they would be seeing different values...

*Any* ideas for what might be going on here would be much appreciated.

[    5.043993] &bo->tbo.lru=ffff88007c0d1918, bo->tbo.lru.prev=ffff88007c0d1918, bo->
[    5.043996] ------------[ cut here ]------------
[    5.044004] WARNING: CPU: 3 PID: 117 at drivers/gpu/drm//ttm/ttm_bo.c:173 ttm_bo_add_to_lru+0x145/0x150 [ttm]()
[    5.044005] Modules linked in: hid_generic usbhid hid cpufreq_stats binfmt_misc cpufreq_powersave cpufreq_userspace cpufreq_conservative kvm_amd kvm irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel nls_utf8 nls_cp437 vfat fat radeon(O) sha256_ssse3 sha256_generic hmac drbg ansi_cprng eeepc_wmi asus_wmi sparse_keymap rfkill evdev efi_pstore aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd edac_mce_amd r8169 psmouse pcspkr serio_raw snd_hda_codec_realtek snd_hda_codec_generic edac_core mii amdkfd efivars k10temp fam15h_power snd_hda_codec_hdmi amdgpu(O) ohci_pci ttm(O) snd_hda_intel xhci_pci snd_hda_codec drm_kms_helper i2c_piix4 snd_hda_core xhci_hcd drm snd_hwdep ehci_pci ohci_hcd ehci_hcd snd_pcm i2c_algo_bit sg usbcore snd_timer snd usb_common soundcore shpchp 8250_fintek
[    5.044037]  wmi acpi_cpufreq video tpm_tis tpm button processor efivarfs autofs4 ext4 crc16 mbcache jbd2 dm_mod sd_mod ahci libahci libata scsi_mod
[    5.044047] CPU: 3 PID: 117 Comm: kworker/u8:7 Tainted: G        W  O    4.4.0+ #193
[    5.044048] Hardware name: System manufacturer System Product Name/A88X-PRO, BIOS 1602 12/04/2014
[    5.044066] Workqueue: radeon-crtc radeon_unpin_work_func [radeon]
[    5.044068]  0000000000000000 0000000031d3b9d6 ffff88022407bd80 ffffffff813030f4
[    5.044070]  0000000000000000 ffff88022407bdb8 ffffffff8107a332 ffff88007c0d1868
[    5.044071]  ffff88007c0d1918 ffff88007c0d1800 ffff88007c0d1868 ffff880224cf1320
[    5.044073] Call Trace:
[    5.044078]  [<ffffffff813030f4>] dump_stack+0x44/0x60
[    5.044080]  [<ffffffff8107a332>] warn_slowpath_common+0x82/0xc0
[    5.044082]  [<ffffffff8107a47a>] warn_slowpath_null+0x1a/0x20
[    5.044085]  [<ffffffffa03260d5>] ttm_bo_add_to_lru+0x145/0x150 [ttm]
[    5.044096]  [<ffffffffa073e87b>] radeon_unpin_work_func+0x8b/0x1a0 [radeon]
[    5.044098]  [<ffffffff81092443>] process_one_work+0x1a3/0x3d0
[    5.044099]  [<ffffffff810926be>] worker_thread+0x4e/0x460
[    5.044101]  [<ffffffff81092670>] ? process_one_work+0x3d0/0x3d0
[    5.044102]  [<ffffffff81098848>] kthread+0xd8/0xf0
[    5.044104]  [<ffffffff81098770>] ? kthread_create_on_node+0x190/0x190
[    5.044107]  [<ffffffff815b5a4f>] ret_from_fork+0x3f/0x70
[    5.044108]  [<ffffffff81098770>] ? kthread_create_on_node+0x190/0x190
[    5.044109] ---[ end trace 64028355474e8bbe ]---
[    5.044110] [TTM] &bo->lru=ffff88007c0d1918, bo->lru.prev=ffff88007dcb6d18, bo->

Earthling Michel Dänzer               |     
Libre software enthusiast             |             Mesa and X developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ttm_bo_add_lru.diff
Type: text/x-patch
Size: 1424 bytes
Desc: not available
URL: <>

More information about the dri-devel mailing list