[PATCH] drm/ttm: Set CPU caching mode to cached for BOs being swapped out

Thomas Hellstrom thellstrom at vmware.com
Thu Nov 5 00:47:59 PST 2015


Hi, Michel,

On 11/05/2015 09:08 AM, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> I ran into the BUG_ON in ttm_tt_swapout, presumably the BO being swapped
> out was using a write-combined CPU mapping.
>
> Instead of BUGging out, just set the caching mode to what's needed.
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>  drivers/gpu/drm/ttm/ttm_tt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index 4e19d0f..c2794eb 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -334,7 +334,8 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
>  	int ret = -ENOMEM;
>  
>  	BUG_ON(ttm->state != tt_unbound && ttm->state != tt_unpopulated);
> -	BUG_ON(ttm->caching_state != tt_cached);
> +
> +	ttm_tt_set_caching(ttm, tt_cached);
>  
>  	if (!persistent_swap_storage) {
>  		swap_storage = shmem_file_setup("ttm swap",

This *is* actually a bug somewhere, since before ttm_tt_swapout,
ttm_bo_swapout should have moved out the bo to system and set
the correct caching. A WARN_ON_ONCE instead of BUG_ON is ok, but this
should never happen.

/Thomas






More information about the dri-devel mailing list