From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: "Ruhl, Michael J" <michael.j.ruhl@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "Auld, Matthew" <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH v3 2/5] drm/i915/gem: Introduce a selftest for the gem object migrate functionality
Date: Mon, 28 Jun 2021 21:32:19 +0200 [thread overview]
Message-ID: <b564e299-88ec-0378-0748-da205beb2f63@linux.intel.com> (raw)
In-Reply-To: <661d41530ae0406b89d07286e0cb384e@intel.com>
On 6/28/21 9:27 PM, Ruhl, Michael J wrote:
>> -----Original Message-----
>> From: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Sent: Monday, June 28, 2021 3:15 PM
>> To: Ruhl, Michael J <michael.j.ruhl@intel.com>; intel-
>> gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
>> Cc: Auld, Matthew <matthew.auld@intel.com>
>> Subject: Re: [Intel-gfx] [PATCH v3 2/5] drm/i915/gem: Introduce a selftest for
>> the gem object migrate functionality
>>
>> On Mon, 2021-06-28 at 18:53 +0000, Ruhl, Michael J wrote:
>>>> -----Original Message-----
>>>> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf
>>>> Of
>>>> Thomas Hellström
>>>> Sent: Monday, June 28, 2021 10:46 AM
>>>> To: intel-gfx@lists.freedesktop.org;
>>>> dri-devel@lists.freedesktop.org
>>>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>; Auld,
>>>> Matthew
>>>> <matthew.auld@intel.com>
>>>> Subject: [Intel-gfx] [PATCH v3 2/5] drm/i915/gem: Introduce a
>>>> selftest for the
>>>> gem object migrate functionality
>>>>
>>>> From: Matthew Auld <matthew.auld@intel.com>
>>>>
>>>> A selftest for the gem object migrate functionality. Slightly
>>>> adapted
>>>> from the original by Matthew to the new interface and new fill blit
>>>> code.
>>>>
>>>> Co-developed-by: Thomas Hellström
>>>> <thomas.hellstrom@linux.intel.com>
>>>> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>>>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>>>> ---
>>>> drivers/gpu/drm/i915/gem/i915_gem_object.c | 1 +
>>>> .../drm/i915/gem/selftests/i915_gem_migrate.c | 237
>>>> ++++++++++++++++++
>>>> .../drm/i915/selftests/i915_live_selftests.h | 1 +
>>>> 3 files changed, 239 insertions(+)
>>>> create mode 100644
>>>> drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c
>>>> b/drivers/gpu/drm/i915/gem/i915_gem_object.c
>>>> index 1c18be067b58..ff147fd59874 100644
>>>> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
>>>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
>>>> @@ -649,6 +649,7 @@ static const struct drm_gem_object_funcs
>>>> i915_gem_object_funcs = {
>>>> #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
>>>> #include "selftests/huge_gem_object.c"
>>>> #include "selftests/huge_pages.c"
>>>> +#include "selftests/i915_gem_migrate.c"
>>>> #include "selftests/i915_gem_object.c"
>>>> #include "selftests/i915_gem_coherency.c"
>>>> #endif
>>>> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c
>>>> b/drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c
>>>> new file mode 100644
>>>> index 000000000000..a437b66f64d9
>>>> --- /dev/null
>>>> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c
>>>> @@ -0,0 +1,237 @@
>>>> +// SPDX-License-Identifier: MIT
>>>> +/*
>>>> + * Copyright © 2020-2021 Intel Corporation
>>>> + */
>>>> +
>>>> +#include "gt/intel_migrate.h"
>>>> +
>>>> +static int igt_smem_create_migrate(void *arg)
>>>> +{
>>>> + struct intel_gt *gt = arg;
>>>> + struct drm_i915_private *i915 = gt->i915;
>>>> + struct drm_i915_gem_object *obj;
>>>> + struct i915_gem_ww_ctx ww;
>>>> + int err = 0;
>>>> +
>>>> + /* Switch object backing-store on create */
>>>> + obj = i915_gem_object_create_lmem(i915, PAGE_SIZE, 0);
>>>> + if (IS_ERR(obj))
>>>> + return PTR_ERR(obj);
>>>> +
>>>> + for_i915_gem_ww(&ww, err, true) {
>>>> + err = i915_gem_object_lock(obj, &ww);
>>>> + if (err)
>>>> + continue;
>>>> +
>>>> + if (!i915_gem_object_can_migrate(obj,
>>>> INTEL_REGION_SMEM)) {
>>>> + err = -EINVAL;
>>>> + continue;
>>>> + }
>>>> +
>>>> + err = i915_gem_object_migrate(obj, &ww,
>>>> INTEL_REGION_SMEM);
>>>> + if (err)
>>>> + continue;
>>>> +
>>>> + err = i915_gem_object_pin_pages(obj);
>>>> + if (err)
>>>> + continue;
>>>> +
>>>> + if (i915_gem_object_can_migrate(obj,
>>>> INTEL_REGION_LMEM))
>>>> + err = -EINVAL;
>>>> +
>>>> + i915_gem_object_unpin_pages(obj);
>>>> + }
>>>> + i915_gem_object_put(obj);
>>>> +
>>>> + return err;
>>>> +}
>>>> +
>>>> +static int igt_lmem_create_migrate(void *arg)
>>>> +{
>>>> + struct intel_gt *gt = arg;
>>>> + struct drm_i915_private *i915 = gt->i915;
>>>> + struct drm_i915_gem_object *obj;
>>>> + struct i915_gem_ww_ctx ww;
>>>> + int err = 0;
>>>> +
>>>> + /* Switch object backing-store on create */
>>>> + obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
>>>> + if (IS_ERR(obj))
>>>> + return PTR_ERR(obj);
>>>> +
>>>> + for_i915_gem_ww(&ww, err, true) {
>>>> + err = i915_gem_object_lock(obj, &ww);
>>>> + if (err)
>>>> + continue;
>>>> +
>>>> + if (!i915_gem_object_can_migrate(obj,
>>>> INTEL_REGION_LMEM)) {
>>>> + err = -EINVAL;
>>>> + continue;
>>>> + }
>>>> +
>>>> + err = i915_gem_object_migrate(obj, &ww,
>>>> INTEL_REGION_LMEM);
>>>> + if (err)
>>>> + continue;
>>>> +
>>>> + err = i915_gem_object_pin_pages(obj);
>>>> + if (err)
>>>> + continue;
>>>> +
>>>> + if (i915_gem_object_can_migrate(obj,
>>>> INTEL_REGION_SMEM))
>>>> + err = -EINVAL;
>>>> +
>>>> + i915_gem_object_unpin_pages(obj);
>>>> + }
>>>> + i915_gem_object_put(obj);
>>>> +
>>>> + return err;
>>>> +}
>>>> +
>>>> +static int lmem_pages_migrate_one(struct i915_gem_ww_ctx *ww,
>>>> + struct drm_i915_gem_object *obj)
>>>> +{
>>>> + int err;
>>>> +
>>>> + err = i915_gem_object_lock(obj, ww);
>>>> + if (err)
>>>> + return err;
>>>> +
>>>> + err = i915_gem_object_wait(obj,
>>>> + I915_WAIT_INTERRUPTIBLE |
>>>> + I915_WAIT_PRIORITY |
>>>> + I915_WAIT_ALL,
>>>> + MAX_SCHEDULE_TIMEOUT);
>>>> + if (err)
>>>> + return err;
>>>> +
>>>> + if (i915_gem_object_is_lmem(obj)) {
>>>> + if (!i915_gem_object_can_migrate(obj,
>>>> INTEL_REGION_SMEM)) {
>>> I don't see any testing of the parameter num_allowed.
>>>
>>> Is that done somewhere else?
>>>
>>> Mike
>> That's a user-space submitted parameter only, dictating what region the
>> object is allowed in when bound to the GPU. It's not exercised in this
>> selftest.
> Got it.
>
> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
>
> M
Thanks!
Thomas
>> Thanks,
>> Thomas
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-06-28 19:32 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 14:46 [Intel-gfx] [PATCH v3 0/5] drm/i915/gem: Introduce a migrate interface Thomas Hellström
2021-06-28 14:46 ` [Intel-gfx] [PATCH v3 1/5] drm/i915/gem: Implement object migration Thomas Hellström
2021-06-28 16:28 ` Matthew Auld
2021-06-28 17:34 ` Thomas Hellström
2021-06-28 18:11 ` Ruhl, Michael J
2021-06-28 19:02 ` Thomas Hellström
2021-06-28 19:50 ` Ruhl, Michael J
2021-06-28 19:54 ` Thomas Hellström
2021-06-28 20:13 ` Ruhl, Michael J
2021-06-29 8:47 ` Daniel Vetter
2021-06-28 14:46 ` [Intel-gfx] [PATCH v3 2/5] drm/i915/gem: Introduce a selftest for the gem object migrate functionality Thomas Hellström
2021-06-28 15:51 ` Matthew Auld
2021-06-28 18:53 ` Ruhl, Michael J
2021-06-28 19:14 ` Thomas Hellström
2021-06-28 19:27 ` Ruhl, Michael J
2021-06-28 19:32 ` Thomas Hellström [this message]
2021-06-28 14:46 ` [Intel-gfx] [PATCH v3 3/5] drm/i915/display: Migrate objects to LMEM if possible for display Thomas Hellström
2021-06-28 15:20 ` Matthew Auld
2021-06-28 14:46 ` [Intel-gfx] [PATCH v3 4/5] drm/i915/gem: Fix same-driver-another-instance dma-buf export Thomas Hellström
2021-06-28 19:45 ` Ruhl, Michael J
2021-06-29 8:43 ` Daniel Vetter
2021-06-29 9:36 ` Thomas Hellström
2021-06-28 14:46 ` [Intel-gfx] [PATCH v3 5/5] drm/i915/gem: Migrate to system at dma-buf map time Thomas Hellström
2021-06-28 19:45 ` Ruhl, Michael J
2021-06-28 19:51 ` Thomas Hellström
2021-06-28 16:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: Introduce a migrate interface (rev3) Patchwork
2021-06-28 16:58 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-06-28 17:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-06-28 20:57 ` [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=b564e299-88ec-0378-0748-da205beb2f63@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=michael.j.ruhl@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