From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Karolina Stolarek <karolina.stolarek@intel.com>,
dri-devel@lists.freedesktop.org
Cc: "Christian König" <christian.koenig@amd.com>,
"Matthew Auld" <matthew.auld@intel.com>,
"Amaranath Somalapuram" <asomalap@amd.com>
Subject: Re: [PATCH v12 06/10] drm/ttm/tests: Add tests with mock resource managers
Date: Mon, 03 Jun 2024 11:30:07 +0200 [thread overview]
Message-ID: <7ba3ffaa4c05692ecb10b0b3b2f16ab973b05d64.camel@linux.intel.com> (raw)
In-Reply-To: <aedb4864-afbc-4261-9618-3489a1755f0d@intel.com>
On Mon, 2024-06-03 at 10:28 +0200, Karolina Stolarek wrote:
> > > > > diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> > > > > b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> > > > > index 2f590bae53f8..2a2585b37118 100644
> > > > > --- a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> > > > > +++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
> > > > > @@ -27,8 +27,42 @@ static int mock_move(struct
> > > > > ttm_buffer_object
> > > > > *bo,
> > > > > bool evict,
> > > > > struct ttm_resource *new_mem,
> > > > > struct ttm_place *hop)
> > > > > {
> (...)
> > > > > +
> > > > > + if (ret)
> > > > > + return ret;
> > > > > +
> > > > > + ttm_resource_free(bo, &bo->resource);
> > > > > + ttm_bo_assign_mem(bo, new_mem);
> > > > > + return 0;
> > > > > + }
> > > > > +
> > > > > + return ttm_bo_move_memcpy(bo, ctx, new_mem);
> > > >
> > > > Do we hit this move_memcpy()? Since the mock manager doesn't
> > > > actually
> > > > reserve any memory to manager, I'd expect this to run into
> > > > problems?
> > >
> > > We do. The mock manager has use_tt=true, so on move, we'd use
> > > ttm_kmap_iter_tt_init() for src and dest and copy the pages. I'm
> > > not
> > > sure if that's the right approach, but it enables me to test if
> > > ttm_operation_ctx's bytes_moved is correctly updated.
> >
> > Ah, ok. It's probably not a common use-case since with both src and
> > dst
> > having use_tt, IIRC ttm should keep the pages and their content
> > mostly
> > intact across a move. So you would memcpy the source on itself?
> >
> > But it would give some coverage of the copy code though.
>
> I dug around and it looks like, in the current scenario,
> ttm_bo_move_memcpy() is just ttm_bo_move_sync_cleanup()
> (ttm_resource_free + ttm_bo_assign_mem). That means I should revisit
> the
> definitions of move and mock manager... I'll try to simplify them.
>
> Do I understand correctly that we'd prefer to have a mock manager
> with
> user_tt=false?
Yes, but then you need to allocate a chunk of contigous memory for the
mock manager to manage. And instead of using drm_buddy you'd have to
use drm_mm to manage it, since the ttm_kmap_iter default iterators can
only handle either
a) Contigous memory regions as returned from the drm_mm manager.
b) Fragmented memory regions as returned from the drm_buddy manager,
but in that case, they currently only handle pci io memory.
So I'd suggest to go with the current code and mark as a TODO: to
implement a) above.
/Thomas
>
> All the best,
> Karolina
>
> >
> > /Thomas
next prev parent reply other threads:[~2024-06-03 9:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 11:24 [PATCH v12 00/10] Improve test coverage of TTM Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 01/10] drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk Karolina Stolarek
2024-05-24 15:16 ` Thomas Hellström
2024-05-15 11:24 ` [PATCH v12 02/10] drm/ttm/tests: Delete unnecessary config option Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 03/10] drm/ttm/tests: Set DMA mask in KUnit device Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 04/10] drm/ttm/tests: Use an init function from the helpers lib Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 05/10] drm/ttm/tests: Test simple BO creation and validation Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 06/10] drm/ttm/tests: Add tests with mock resource managers Karolina Stolarek
2024-05-29 12:58 ` Thomas Hellström
2024-06-03 6:55 ` Karolina Stolarek
2024-06-03 7:24 ` Thomas Hellström
2024-06-03 8:28 ` Karolina Stolarek
2024-06-03 9:30 ` Thomas Hellström [this message]
2024-06-03 9:46 ` Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 07/10] drm/ttm/tests: Add test cases dependent on fence signaling Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 08/10] drm/ttm/tests: Add eviction testing Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 09/10] drm/ttm/tests: Add tests for ttm_tt_populate Karolina Stolarek
2024-05-15 11:24 ` [PATCH v12 10/10] drm/ttm/tests: Add TODO file Karolina Stolarek
2024-05-24 15:29 ` Thomas Hellström
2024-05-17 3:37 ` [PATCH v12 00/10] Improve test coverage of TTM Somalapuram, Amaranath
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=7ba3ffaa4c05692ecb10b0b3b2f16ab973b05d64.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=asomalap@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karolina.stolarek@intel.com \
--cc=matthew.auld@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 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.