AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>,
	"StDenis, Tom" <Tom.StDenis-5C7GfCeVMHo@public.gmane.org>
Cc: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amd/amdgpu: Bail out of BO node creation if not enough VRAM (v2)
Date: Wed, 12 Jun 2019 10:03:14 +0200	[thread overview]
Message-ID: <80760492-7d0a-25a2-1410-3a72e2a64ce9@gmail.com> (raw)
In-Reply-To: <fd4c5152-2670-8ac5-e6cc-fff6f260f3ed-otUistvHUpPR7s880joybQ@public.gmane.org>

Am 12.06.19 um 09:26 schrieb Michel Dänzer:
> On 2019-06-11 6:54 p.m., StDenis, Tom wrote:
>> (v2): Return 0 and set mem->mm_node to NULL.
>>
>> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 18 +++++++++++++-----
>>   1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> [...]
>>   
>> @@ -284,6 +284,14 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
>>   	if (!lpfn)
>>   		lpfn = man->size;
>>   
>> +	/* bail out quickly if there's likely not enough VRAM for this BO */
>> +	atomic64_add(mem->num_pages << PAGE_SHIFT, &mgr->usage);
>> +	if (atomic64_read(&mgr->usage) > adev->gmc.mc_vram_size) {
> Should probably use atomic64_add_return instead of atomic64_add +
> atomic64_read.
>
> Also, AFAICT this doesn't allow any VRAM overcommit, which seems a bit
> conservative?

This is the low level VRAM manager. Here we can't overcomit anyway and 
need to return early for TTM to evict things.

Christian.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-06-12  8:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 16:54 [PATCH] drm/amd/amdgpu: Bail out of BO node creation if not enough VRAM (v2) StDenis, Tom
     [not found] ` <20190611165444.17841-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2019-06-12  7:26   ` Michel Dänzer
     [not found]     ` <fd4c5152-2670-8ac5-e6cc-fff6f260f3ed-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-12  8:03       ` Christian König [this message]
2019-06-12  8:00   ` Christian König

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=80760492-7d0a-25a2-1410-3a72e2a64ce9@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Tom.StDenis-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=michel-otUistvHUpPR7s880joybQ@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox