On Fri, 2021-06-11 at 17:29 +0100, Matthew Auld wrote: > On Fri, 11 Jun 2021 at 15:55, Thomas Hellström > <thomas.hellstrom@xxxxxxxxxxxxxxx> wrote: > > > > After a TTM move we need to update the i915 gem flags and caching > > settings to reflect the new placement. > > Also introduce gpu_binds_iomem() and cpu_maps_iomem() to clean up > > the > > various ways we previously used to detect this. > > Finally, initialize the TTM object reserved to be able to update > > flags and caching before anyone else gets hold of the object. > > Hmm, why do we need to update it after a move? Is it not static? i.e > we just consider the mm.placements/region to determine the correct > domain and cache tracking? Or maybe it doesn't really matter either > way? Flags are not static, currently. If migrating from LMEM to SYSTEM, they need to be updated. Caching and domains should remain unchanged for now because of the rule that we don't want to change caching mode when migrating from LMEM to SYSTEM for buffers that support both, and that rule is enforced by setting the ttm_tt caching mode accordingly. However, I figure if we need to change that rule moving forward because we decide we can't rely on the TTM shinker for WC system pages, or because allocating WC system pages is too expensive, It would be good if we don't need to audit all the code to find places where an updated caching policy needs changes. /Thomas