ttm_bo_add_to_lru mystery

Michel Dänzer michel at
Wed Feb 10 09:57:27 UTC 2016

On 10.02.2016 18:28, Michel Dänzer wrote:
> 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.

Okay, so it was just me being stupid and missing that ttm_bo_unreserve
already calls ttm_bo_add_to_lru. Thanks to olesalscheider for
enlightening me on IRC.

Earthling Michel Dänzer               |     
Libre software enthusiast             |             Mesa and X developer

More information about the dri-devel mailing list