All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Brooks <john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
To: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/amdgpu: Place new CPU-accessbile BOs in GTT if visible VRAM is full
Date: Fri, 19 May 2017 19:23:52 +0000	[thread overview]
Message-ID: <20170519192352.GA21642@kitsune.fastquake.com> (raw)
In-Reply-To: <b2ecb0f8-cd1b-9a00-6ba6-082674fde776-otUistvHUpPR7s880joybQ@public.gmane.org>

On Fri, May 19, 2017 at 04:03:28PM +0900, Michel Dänzer wrote:
> On 19/05/17 12:04 PM, John Brooks wrote:
> > Set GTT as the busy placement for newly created BOs that have the
> > AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED flag, so that they don't cause
> > established BOs to be evicted from visible VRAM.
> 
> This is an interesting idea, but there are some issues with this patch.
> 
> 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > index 365883d..655718a 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> > @@ -392,6 +392,17 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
> >  #endif
> >  
> >  	amdgpu_fill_placement_to_bo(bo, placement);
> > +
> > +	/* This is a new BO that wants to be CPU-visible; set GTT as the busy
> > +	 * placement so that it does not evict established BOs from visible VRAM.
> > +	 */
> > +	if (domain & (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT) &&
> 
> Should be something like
> 
> 	if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT) &&
> 
> otherwise it would also match e.g. BOs with domain ==
> AMDGPU_GEM_DOMAIN_GTT and the AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED
> flag set (not that this makes sense, but there's nothing to prevent it).
> 
> 
> > +	    flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
> > +		bo->placement.num_placement = 1;
> > +		bo->placement.num_busy_placement = 1;
> > +		bo->placement.busy_placement = &bo->placement.placement[1];
> > +	}
> 
> The original placements set by amdgpu_fill_placement_to_bo need to be
> restored before returning from this function, otherwise I suspect such
> BOs which end up being created in GTT will stay there permanently.
> 

I'm curious, what makes you think that the BOs cannot move back to VRAM
otherwise? VRAM is still in the placements and prefered/allowed domains, just
not in the busy placements.

> Does the patch still help for Dying Light if you fix this?
> 
> The patch as is doesn't seem to make any difference for my dirt-rally
> test case.
> 
> 
> > @@ -484,6 +495,13 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
> >  	memset(&placements, 0,
> >  	       (AMDGPU_GEM_DOMAIN_MAX + 1) * sizeof(struct ttm_place));
> >  
> > +
> > +	/* New CPU-visible BOs will have GTT set as their busy placement */
> > +	if (domain & AMDGPU_GEM_DOMAIN_VRAM &&
> > +	    flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
> 
> Make this
> 
> 	if ((domain & AMDGPU_GEM_DOMAIN_VRAM) &&
> 	    (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)) {
> 
> to match the coding style.
> 
> 
> -- 
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer

Thanks very much for your feedback. I'll send an updated patch soon.

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

  parent reply	other threads:[~2017-05-19 19:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18  9:08 [PATCH 0/3] drm/amdgpu: Tweaks for high pressure on CPU visible VRAM Michel Dänzer
     [not found] ` <20170518090809.15916-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-18  9:08   ` [PATCH 1/3] drm/amdgpu: Drop useless loops for placement restrictions Michel Dänzer
     [not found]     ` <20170518090809.15916-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-18  9:17       ` Christian König
     [not found]         ` <6c3e7a55-d3b0-fc3f-39f4-e85934119e29-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-18  9:47           ` Michel Dänzer
2017-05-18  9:08   ` [PATCH 2/3] drm/amdgpu: Don't evict other BOs from VRAM for page faults Michel Dänzer
2017-05-18  9:08   ` [PATCH 3/3] drm/amdgpu: Try evicting from CPU visible to invisible VRAM first Michel Dänzer
     [not found]     ` <20170518090809.15916-4-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-18 15:43       ` John Brooks
     [not found]         ` <20170518154346.GA5730-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-05-19  1:20           ` Michel Dänzer
     [not found]             ` <b65d8565-47e6-39d7-12f7-f7b60cf9787e-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-19  1:43               ` John Brooks
     [not found]                 ` <20170519014314.GA29857-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-05-19  1:50                   ` Michel Dänzer
2017-05-19  3:04   ` [PATCH 0/3] drm/amdgpu: Tweaks for high pressure on CPU visible VRAM John Brooks
     [not found]     ` <1495163086-4747-1-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-05-19  3:04       ` [PATCH] drm/amdgpu: Place new CPU-accessbile BOs in GTT if visible VRAM is full John Brooks
     [not found]         ` <1495163086-4747-2-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-05-19  5:37           ` zhoucm1
2017-05-19  7:03           ` Michel Dänzer
     [not found]             ` <b2ecb0f8-cd1b-9a00-6ba6-082674fde776-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-19 15:52               ` Marek Olšák
     [not found]                 ` <CAAxE2A7DjWR8x1WYE=Fgqn7vZ7hyRdQHA3wKo_HcNdZ14KdmkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-20  1:22                   ` Michel Dänzer
2017-05-19 19:23               ` John Brooks [this message]
     [not found]                 ` <20170519192352.GA21642-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-05-20  1:27                   ` Michel Dänzer
     [not found]                     ` <d0535946-a10d-3b77-0d94-c52098dce021-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-20  3:21                       ` John Brooks
     [not found]                         ` <20170520032101.GA16371-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-05-22  1:30                           ` Michel Dänzer
2017-05-19 15:24       ` [PATCH 0/3] drm/amdgpu: Tweaks for high pressure on CPU visible VRAM Marek Olšák
     [not found]         ` <CAAxE2A6pcm8EiXDRO2kO64TWJRR4BVrzbpiVrLdzhh3uERzTUg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-19 15:27           ` John Brooks
     [not found]             ` <20170519152732.GA11484-6hIufAJW0g7Gr8qjsLp7YGXnswh1EIUO@public.gmane.org>
2017-05-19 15:47               ` Marek Olšák
     [not found]                 ` <CAAxE2A77Yu9c02Mu-wK3HD_gAKvPbN8q7aEtHcxrcOUhGG4Pfw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-19 15:49                   ` Marek Olšák
2017-05-19 16:14   ` Marek Olšák
     [not found]     ` <CAAxE2A65deE+hue7oPMQ+=K5s8TEGZE+bJMNVOdp=LQuq_RnMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-20  1:26       ` Michel Dänzer
     [not found]         ` <CAAxE2A6ZiNSswhArstqHpYnm30ieoDZj=j_-aFvZz1_ByXLOGA@mail.gmail.com>
     [not found]           ` <CAAxE2A4zdgFRh-GDqyDRrXmEWqjSrkfCo=Z41hfo-UNY0E5FhA@mail.gmail.com>
     [not found]             ` <CAAxE2A4zdgFRh-GDqyDRrXmEWqjSrkfCo=Z41hfo-UNY0E5FhA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-20  9:26               ` Marek Olšák
     [not found]                 ` <CAAxE2A67T3Mhw68thNewFtcdua3ufSP-FDX_RN153x-aLKUh1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-20  9:35                   ` Michel Dänzer
2017-05-22 10:00                   ` Michel Dänzer
     [not found]                     ` <7649341f-6407-1a12-9674-fb65076125fc-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-22 10:09                       ` Marek Olšák
     [not found]                         ` <CAAxE2A446KFb+CiwdZusvdgRSfQS8jLgsCy4K7L0_tc00pvWKA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-22 18:20                           ` John Brooks
2017-05-23  0:45                           ` Michel Dänzer
     [not found]                             ` <c3dfa73a-e0c1-c6e9-0264-3c52e444c297-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-23 10:38                               ` Marek Olšák
     [not found]                                 ` <CAAxE2A7tKvvmZ+qf8f06FJODWNLgHcv-XPiJJgLana-PcXBR_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-24  7:56                                   ` Michel Dänzer
     [not found]                                     ` <f04e8239-e8cb-1c6c-a0ae-581facadb3cf-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-24 11:03                                       ` Marek Olšák
     [not found]                                         ` <CAAxE2A5uha-MPx4B=ZeW9kf2qQXOTNcK7sxMJDtEk54S=us47g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-24 11:27                                           ` Christian König
     [not found]                                             ` <eafd4ca6-fbbf-2bb4-be97-16f54fe402dd-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-05-25  3:31                                               ` Michel Dänzer
     [not found]                                                 ` <0535f00f-9095-6209-72e9-e6bb46569a63-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-05-25 11:24                                                   ` Marek Olšák
     [not found]                                                     ` <CAAxE2A6YFjK1VPuxW=HROqKX+-ejvVJ=YneULp+cDkj033YAbA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-26  0:46                                                       ` 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=20170519192352.GA21642@kitsune.fastquake.com \
    --to=john-xq/ko7c6e2bl57midrcfdg@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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 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.