On Wed, Jun 28, 2017 at 03:06:47PM +0200, Christian König wrote: > Am 28.06.2017 um 04:33 schrieb John Brooks: > >Signed-off-by: John Brooks <john at fastquake.com> > >--- > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ > > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 +++++ > > drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ > > 3 files changed, 10 insertions(+) > > > >diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > >index 7366115..34c293a 100644 > >--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > >+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > >@@ -428,6 +428,9 @@ struct amdgpu_bo { > > void *metadata; > > u32 metadata_size; > > unsigned prime_shared_count; > >+ unsigned long last_page_fault_jiffies; > >+ unsigned long last_cs_move_jiffies; > > Please use jiffies64 here, apart from that the patch looks good to me. > > Christian. > I'm not sure I understand. Do you mean change these variables to u64 and use get_jiffies_64() instead of the plain jiffies variable below? I believe jiffies_64 can be slower than jiffies also. John > >+ > > /* list of all virtual address to which this bo > > * is associated to > > */ > >diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > >index 1dfa847..071b592 100644 > >--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > >+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > >@@ -335,6 +335,7 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p, > > struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); > > u64 initial_bytes_moved, bytes_moved; > > uint32_t domain; > >+ uint32_t old_mem; > > int r; > > if (bo->pin_count) > >@@ -364,6 +365,7 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p, > > retry: > > amdgpu_ttm_placement_from_domain(bo, domain); > > initial_bytes_moved = atomic64_read(&adev->num_bytes_moved); > >+ old_mem = bo->tbo.mem.mem_type; > > r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false); > > bytes_moved = atomic64_read(&adev->num_bytes_moved) - > > initial_bytes_moved; > >@@ -377,6 +379,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p, > > goto retry; > > } > >+ if (bo->tbo.mem.mem_type != old_mem) > >+ bo->last_cs_move_jiffies = jiffies; > >+ > > return r; > > } > >diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > >index dcf1ddb..b71775c 100644 > >--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > >+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > >@@ -953,6 +953,8 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo) > > if (bo->mem.mem_type != TTM_PL_VRAM) > > return 0; > >+ abo->last_page_fault_jiffies = jiffies; > >+ > > size = bo->mem.num_pages << PAGE_SHIFT; > > offset = bo->mem.start << PAGE_SHIFT; > > /* TODO: figure out how to map scattered VRAM to the CPU */ > >