All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: John Brooks <john@fastquake.com>
Cc: "Michel Dänzer" <michel@daenzer.net>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/amdgpu: Track time of last page fault and last CS move in struct amdgpu_bo
Date: Thu, 29 Jun 2017 10:11:58 +0200	[thread overview]
Message-ID: <83b17e15-70b5-9003-df86-3a78d302982f@vodafone.de> (raw)
In-Reply-To: <20170628225920.GA11762@kitsune.fastquake.com>

Am 29.06.2017 um 00:59 schrieb John Brooks:
> 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@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?

Yes, exactly.

> I believe jiffies_64 can be slower than jiffies also.

Yeah, but it doesn't matter on 64bit systems and they don't wrap around 
every 49 days on 32bit systems :)

Christian.

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

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

  reply	other threads:[~2017-06-29  8:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28  2:33 [PATCH v2] Visible VRAM Management Improvements John Brooks
2017-06-28  2:33 ` [PATCH 1/5] drm/amdgpu: Add vis_vramlimit module parameter John Brooks
2017-06-28  2:33 ` [PATCH 2/5] drm/amdgpu: Throttle visible VRAM moves separately John Brooks
2017-06-28  2:33 ` [PATCH 3/5] drm/amdgpu: Track time of last page fault and last CS move in struct amdgpu_bo John Brooks
2017-06-28 13:06   ` Christian König
     [not found]     ` <e3d7be62-e63b-f370-f159-147aaf8d7c50-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-28 22:59       ` John Brooks
2017-06-29  8:11         ` Christian König [this message]
     [not found] ` <1498617201-24557-1-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-06-28  2:33   ` [PATCH 4/5] drm/amdgpu: Set/clear CPU_ACCESS_REQUIRED flag on page fault and CS John Brooks
     [not found]     ` <1498617201-24557-5-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-06-28 13:05       ` Christian König
2017-06-28 23:26         ` John Brooks
     [not found]           ` <20170628232639.GB11762-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-06-29  2:35             ` Michel Dänzer
2017-06-29  8:23               ` Christian König
2017-06-29  9:58                 ` Michel Dänzer
2017-06-29 10:05                   ` Daniel Vetter
     [not found]                     ` <20170629100523.khsozocltct7tnfu-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-06-30  2:24                       ` Michel Dänzer
     [not found]                         ` <e1568d15-42da-4720-dff8-3a6e373f51d8-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-06-30  6:47                           ` Christian König
     [not found]                             ` <c9b732c1-4bdd-a2ce-1dc2-6abbaf89ce5a-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-30 12:39                               ` Daniel Vetter
     [not found]                                 ` <20170630123904.afbsnmxkxxzuydr2-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2017-06-30 12:46                                   ` Christian König
2017-07-07 14:47                             ` Marek Olšák
2017-06-30  1:56               ` John Brooks
     [not found]                 ` <20170630015638.GA735-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-06-30  2:16                   ` John Brooks
2017-06-29  3:18       ` Michel Dänzer
2017-06-28  2:33   ` [PATCH 5/5] drm/amdgpu: Don't force BOs into visible VRAM for page faults John Brooks
2017-06-29  2:30     ` Michel Dänzer
2017-06-29  2:33 ` [PATCH v2] Visible VRAM Management Improvements Michel Dänzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83b17e15-70b5-9003-df86-3a78d302982f@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=john@fastquake.com \
    --cc=michel@daenzer.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.