Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	linux-graphics-maintainer@vmware.com
Cc: alexander.deucher@amd.com, arunpravin.paneerselvam@amd.com,
	arvind.yadav@amd.com
Subject: Re: [Intel-gfx] [PATCH 2/6] drm/amdgpu: Remove TTM resource->start visible VRAM condition
Date: Wed, 8 Feb 2023 13:11:07 +0100	[thread overview]
Message-ID: <a918a254-5c8c-b5f5-853e-e70dc97a4ed0@amd.com> (raw)
In-Reply-To: <20230208090106.9659-2-Amaranath.Somalapuram@amd.com>



Am 08.02.23 um 10:01 schrieb Somalapuram Amaranath:
> Use amdgpu_bo_in_cpu_visible_vram() instead.
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 981010de0a28..d835ee2131d2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -600,7 +600,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
>   
>   	if (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
>   	    bo->tbo.resource->mem_type == TTM_PL_VRAM &&
> -	    bo->tbo.resource->start < adev->gmc.visible_vram_size >> PAGE_SHIFT)
> +	    amdgpu_bo_in_cpu_visible_vram(bo))
>   		amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved,
>   					     ctx.bytes_moved);
>   	else
> @@ -1346,7 +1346,6 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>   	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
>   	struct ttm_operation_ctx ctx = { false, false };
>   	struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
> -	unsigned long offset;
>   	int r;
>   
>   	/* Remember that this BO was accessed by the CPU */
> @@ -1355,8 +1354,7 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>   	if (bo->resource->mem_type != TTM_PL_VRAM)
>   		return 0;
>   
> -	offset = bo->resource->start << PAGE_SHIFT;
> -	if ((offset + bo->base.size) <= adev->gmc.visible_vram_size)
> +	if (amdgpu_bo_in_cpu_visible_vram(abo))
>   		return 0;
>   
>   	/* Can't move a pinned BO to visible VRAM */
> @@ -1378,10 +1376,9 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>   	else if (unlikely(r))
>   		return VM_FAULT_SIGBUS;
>   
> -	offset = bo->resource->start << PAGE_SHIFT;
>   	/* this should never happen */
>   	if (bo->resource->mem_type == TTM_PL_VRAM &&
> -	    (offset + bo->base.size) > adev->gmc.visible_vram_size)
> +	    amdgpu_bo_in_cpu_visible_vram(abo))

This check needs to be inversed. E.g. we return the error if the BO is 
not in visible VRAM.

Apart from that the patch looks good to me.

Regards,
Christian.

>   		return VM_FAULT_SIGBUS;
>   
>   	ttm_bo_move_to_lru_tail_unlocked(bo);


  reply	other threads:[~2023-02-08 12:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  9:01 [Intel-gfx] [PATCH 1/6] drm/gem: Remove BUG_ON in drm_gem_private_object_init Somalapuram Amaranath
2023-02-08  9:01 ` [Intel-gfx] [PATCH 2/6] drm/amdgpu: Remove TTM resource->start visible VRAM condition Somalapuram Amaranath
2023-02-08 12:11   ` Christian König [this message]
2023-02-08  9:01 ` [Intel-gfx] [PATCH 3/6] drm/ttm: Change the meaning of resource->start from pfn to bytes Somalapuram Amaranath
2023-02-08 12:24   ` Christian König
2023-02-08  9:01 ` [Intel-gfx] [PATCH 4/6] drm/ttm: Change the parameters of ttm_range_man_init() from pages " Somalapuram Amaranath
2023-02-08  9:01 ` [Intel-gfx] [PATCH 5/6] drm/ttm: Change the meaning of the fields in the drm_mm_nodes structure from pfn " Somalapuram Amaranath
2023-02-08  9:01 ` [Intel-gfx] [PATCH 6/6] drm/amdgpu: Cleanup the GDS, GWS and OA allocations Somalapuram Amaranath
2023-02-08  9:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/6] drm/gem: Remove BUG_ON in drm_gem_private_object_init Patchwork
2023-02-08 18:09 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-02-08 22:18 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=a918a254-5c8c-b5f5-853e-e70dc97a4ed0@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=arvind.yadav@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=nouveau@lists.freedesktop.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