From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH v2 3/4] drm/amdgpu: Make amdgpu_vram_mgr_bo_invisible_size always accurate
Date: Mon, 18 Jun 2018 19:04:28 +0200 [thread overview]
Message-ID: <93d05390-23fa-ba2b-d3b0-3e7a566b9a69@gmail.com> (raw)
In-Reply-To: <20180618165233.5718-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
Am 18.06.2018 um 18:52 schrieb Michel Dänzer:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Even BOs with AMDGPU_GEM_CREATE_NO_CPU_ACCESS may end up at least
> partially in CPU visible VRAM, in particular when all VRAM is visible.
>
> v2:
> * Don't take VRAM mgr spinlock, not needed (Christian König)
> * Make loop logic simpler and clearer.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index ae0049c6c52c..b6333f92ba45 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -106,10 +106,26 @@ static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev,
> */
> u64 amdgpu_vram_mgr_bo_invisible_size(struct amdgpu_bo *bo)
> {
> - if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
> + struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> + struct ttm_mem_reg *mem = &bo->tbo.mem;
> + struct drm_mm_node *nodes = mem->mm_node;
> + unsigned pages = mem->num_pages;
> + u64 usage = 0;
> +
> + if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size)
> + return 0;
> +
> + if (mem->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT)
> return amdgpu_bo_size(bo);
>
> - return 0;
> + while (nodes && pages) {
> + usage += nodes->size << PAGE_SHIFT;
> + usage -= amdgpu_vram_mgr_vis_size(adev, nodes);
> + pages -= nodes->size;
> + ++nodes;
> + }
> +
> + return usage;
> }
>
> /**
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-06-18 17:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-15 14:42 [PATCH 0/4] drm/amdgpu: pin_size fixes Michel Dänzer
[not found] ` <20180615144230.18480-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-15 14:42 ` [PATCH 1/4] drm/amdgpu: Update pin_size values before unpinning BO Michel Dänzer
2018-06-15 14:42 ` [PATCH 2/4] drm/amdgpu: Refactor amdgpu_vram_mgr_bo_invisible_size helper Michel Dänzer
2018-06-15 14:42 ` [PATCH 3/4] drm/amdgpu: Make amdgpu_vram_mgr_bo_invisible_size always accurate Michel Dänzer
[not found] ` <20180615144230.18480-4-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-15 15:11 ` Christian König
[not found] ` <093bbd7a-02cd-068f-a53a-2d4f1c5b3084-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-06-15 15:14 ` Michel Dänzer
[not found] ` <098df480-3db3-485f-8e39-4ebf8201b3a0-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-15 15:18 ` Christian König
[not found] ` <b94d92e5-908d-534a-907a-ad97124b22ec-5C7GfCeVMHo@public.gmane.org>
2018-06-15 15:19 ` Michel Dänzer
[not found] ` <3140ef24-f8c9-5863-ff44-4c83192eabb1-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-18 11:30 ` Christian König
2018-06-18 16:52 ` [PATCH v2 " Michel Dänzer
[not found] ` <20180618165233.5718-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-06-18 17:04 ` Christian König [this message]
2018-06-15 14:42 ` [PATCH 4/4] drm/amdgpu: Use gmc_vram_full_visible in vram_mgr_bo_invisible_size 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=93d05390-23fa-ba2b-d3b0-3e7a566b9a69@gmail.com \
--to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@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