Re: [PATCH 3/5] drm/amdgpu: Track time of last page fault and last CS move in struct amdgpu_bo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 28.06.2017 um 04:33 schrieb John Brooks:
Signed-off-by: John Brooks <john@xxxxxxxxxxxxx>
---
  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.

+
  	/* 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 */


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux