Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] fixup! drm/xe/bo: Evict VRAM to TT rather than to system
Date: Wed, 20 Sep 2023 15:43:10 -0400	[thread overview]
Message-ID: <ZQtLTgnMqyKNSb5j@intel.com> (raw)
In-Reply-To: <20230920082217.2093-1-thomas.hellstrom@linux.intel.com>

On Wed, Sep 20, 2023 at 10:22:17AM +0200, Thomas Hellström wrote:
> The dma-buf kunit test and to some extent the dma-buf code assumed
> that all bos were evicted to system. Fix this by having the dma-buf
> code not assume anything about eviction placement and the test
> code assume that VRAM bos are evicted to TT.

I believe that we should minimize the fixup patches now and use that
only for the display ones that still need a lot of work.

This could be a simple Fixes: case. And even the commit message is
very good for a standalone patch.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 
> The patch applies using automerge conflict resolution.
> 
> This fixes the following errors:
> 
> [  102.102086]     KTAP version 1
> [  102.102102]     # Subtest: xe_dma_buf
> [  102.102113]     1..1
> [  102.102377]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.106167]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:76
>                Importer wasn't properly evicted.
> [  102.106327]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.107136]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:98
>                    Expected xe_bo_is_mem_type(exported, mem_type) to be true, but is false
> [  102.107691]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.108099]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:76
>                Importer wasn't properly evicted.
> [  102.108158]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.108294]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.108742]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:76
>                Importer wasn't properly evicted.
> [  102.108800]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.108908]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.109080]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.109842]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.109941]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.110131]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.110236]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.110402]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.110731]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:76
>                Importer wasn't properly evicted.
> [  102.110790]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.111498]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.111793]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:76
>                Importer wasn't properly evicted.
> [  102.111851]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.112302]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.112580]     # xe_dma_buf_kunit: EXPECTATION FAILED at drivers/gpu/drm/xe/tests/xe_dma_buf.c:76
>                Importer wasn't properly evicted.
> [  102.112638]     # xe_dma_buf_kunit: running xe_test_dmabuf_import_same_driver
> [  102.113292]     not ok 1 xe_dma_buf_kunit
> [  102.113296] not ok 1 xe_dma_buf
> 
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
>  drivers/gpu/drm/xe/tests/xe_dma_buf.c |  5 ++---
>  drivers/gpu/drm/xe/xe_dma_buf.c       | 11 ++++-------
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/tests/xe_dma_buf.c b/drivers/gpu/drm/xe/tests/xe_dma_buf.c
> index 1c3f4bc72b99..1c4d8751be69 100644
> --- a/drivers/gpu/drm/xe/tests/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/tests/xe_dma_buf.c
> @@ -72,7 +72,7 @@ static void check_residency(struct kunit *test, struct xe_bo *exported,
>  	}
>  
>  	/* Verify that also importer has been evicted to SYSTEM */
> -	if (!xe_bo_is_mem_type(imported, XE_PL_SYSTEM)) {
> +	if (exported != imported && !xe_bo_is_mem_type(imported, XE_PL_SYSTEM)) {
>  		KUNIT_FAIL(test, "Importer wasn't properly evicted.\n");
>  		return;
>  	}
> @@ -91,8 +91,7 @@ static void check_residency(struct kunit *test, struct xe_bo *exported,
>  	 * possible, saving a migration step as the transfer is just
>  	 * likely as fast from system memory.
>  	 */
> -	if (params->force_different_devices &&
> -	    params->mem_mask & XE_BO_CREATE_SYSTEM_BIT)
> +	if (params->mem_mask & XE_BO_CREATE_SYSTEM_BIT)
>  		KUNIT_EXPECT_TRUE(test, xe_bo_is_mem_type(exported, XE_PL_TT));
>  	else
>  		KUNIT_EXPECT_TRUE(test, xe_bo_is_mem_type(exported, mem_type));
> diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c
> index bd8d51e7f93f..cfde3be3b0dc 100644
> --- a/drivers/gpu/drm/xe/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/xe_dma_buf.c
> @@ -98,13 +98,10 @@ static struct sg_table *xe_dma_buf_map(struct dma_buf_attachment *attach,
>  		return ERR_PTR(-EOPNOTSUPP);
>  
>  	if (!xe_bo_is_pinned(bo)) {
> -		if (!attach->peer2peer ||
> -		    bo->ttm.resource->mem_type == XE_PL_SYSTEM) {
> -			if (xe_bo_can_migrate(bo, XE_PL_TT))
> -				r = xe_bo_migrate(bo, XE_PL_TT);
> -			else
> -				r = xe_bo_validate(bo, NULL, false);
> -		}
> +		if (!attach->peer2peer)
> +			r = xe_bo_migrate(bo, XE_PL_TT);
> +		else
> +			r = xe_bo_validate(bo, NULL, false);
>  		if (r)
>  			return ERR_PTR(r);
>  	}
> -- 
> 2.41.0
> 

  parent reply	other threads:[~2023-09-20 19:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20  8:22 [Intel-xe] [PATCH] fixup! drm/xe/bo: Evict VRAM to TT rather than to system Thomas Hellström
2023-09-20  8:54 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-09-20  8:54 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-09-20  8:55 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-09-20  9:02 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-20  9:02 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-20  9:04 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-09-20  9:37 ` [Intel-xe] ✓ CI.BAT: " Patchwork
2023-09-20 19:43 ` Rodrigo Vivi [this message]
2023-09-20 20:07   ` [Intel-xe] [PATCH] " Thomas Hellström
2023-09-20 20:58     ` Rodrigo Vivi

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=ZQtLTgnMqyKNSb5j@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.intel.com \
    /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