Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 31/32] drm/i915/execlists: Virtual engine bonding
Date: Thu, 18 Apr 2019 09:57:43 +0100	[thread overview]
Message-ID: <b7981714-d076-c766-1820-89b72ddb4194@linux.intel.com> (raw)
In-Reply-To: <155557065786.3649.15598309807699098369@skylake-alporthouse-com>


On 18/04/2019 07:57, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-04-18 07:47:51)
>>
>> On 17/04/2019 08:56, Chris Wilson wrote:
>>> +static void
>>> +virtual_bond_execute(struct i915_request *rq, struct dma_fence *signal)
>>> +{
>>> +     struct virtual_engine *ve = to_virtual_engine(rq->engine);
>>> +     struct ve_bond *bond;
>>> +
>>> +     bond = virtual_find_bond(ve, to_request(signal)->engine);
>>> +     if (bond) {
>>> +             intel_engine_mask_t old, new, cmp;
>>> +
>>> +             cmp = READ_ONCE(rq->execution_mask);
>>> +             do {
>>> +                     old = cmp;
>>> +                     new = cmp & bond->sibling_mask;
>>> +             } while ((cmp = cmpxchg(&rq->execution_mask, old, new)) != old);
>>
>> Loop implies someone else might be modifying the rq->execution_mask in
>> parallel?
> 
> There's nothing that prevents there being multiple bonds being
> executed simultaneously (other than practicality). There's also nothing
> that says this should be the only way to modify rq->execution_mask in
> the future.

But request is one, how can it be submitted multiple times simultaneously?

>>> +static int
>>> +set_engines__bond(struct i915_user_extension __user *base, void *data)
>>> +{
>>> +     struct i915_context_engines_bond __user *ext =
>>> +             container_of_user(base, typeof(*ext), base);
>>> +     const struct set_engines *set = data;
>>> +     struct intel_engine_cs *virtual;
>>> +     struct intel_engine_cs *master;
>>> +     u16 class, instance;
>>> +     u16 idx, num_bonds;
>>> +     int err, n;
>>> +
>>> +     if (get_user(idx, &ext->virtual_index))
>>> +             return -EFAULT;
>>> +
>>> +     if (idx >= set->engines->num_engines) {
>>> +             DRM_DEBUG("Invalid index for virtual engine: %d >= %d\n",
>>> +                       idx, set->engines->num_engines);
>>> +             return -EINVAL;
>>> +     }
>>> +
>>> +     idx = array_index_nospec(idx, set->engines->num_engines);
>>> +     if (!set->engines->engines[idx]) {
>>> +             DRM_DEBUG("Invalid engine at %d\n", idx);
>>> +             return -EINVAL;
>>> +     }
>>> +
>>> +     /*
>>> +      * A non-virtual engine has 0 siblings to choose between; and submit
>>> +      * fence will always be directed to the one engine.
>>> +      */
>>> +     virtual = set->engines->engines[idx]->engine;
>>> +     if (!intel_engine_is_virtual(virtual))
>>> +             return 0;
>>
>> Hmm wouldn't we strictly speaking need to distinguish between uAPI
>> errors and auto-magic-single-veng-replacement? Latter is OK to return
>> success, but former should be reported as -EINVAL I think.
> 
> Is it a uAPI error if it works? :)

It works but what is the practical use? It more signals userspace got 
it's configuration wrong and if we silently accept it gets more 
difficult to figure out.

> 
>>> +
>>> +     err = check_user_mbz(&ext->flags);
>>> +     if (err)
>>> +             return err;
>>> +
>>> +     for (n = 0; n < ARRAY_SIZE(ext->mbz64); n++) {
>>> +             err = check_user_mbz(&ext->mbz64[n]);
>>> +             if (err)
>>> +                     return err;
>>> +     }
>>> +
>>> +     if (get_user(class, &ext->master_class))
>>> +             return -EFAULT;
>>> +
>>> +     if (get_user(instance, &ext->master_instance))
>>> +             return -EFAULT;
>>> +
>>> +     master = intel_engine_lookup_user(set->ctx->i915, class, instance);
>>> +     if (!master) {
>>> +             DRM_DEBUG("Unrecognised master engine: { class:%d, instance:%d }\n",
>>> +                       class, instance);
>>> +             return -EINVAL;
>>> +     }
>>> +
>>> +     if (get_user(num_bonds, &ext->num_bonds))
>>> +             return -EFAULT;
>>
>> Should num_bonds > virtual->num_siblings be an error?
> 
> They could specify the same bond multiple times for whatever reason (and
> probably should allow skipping NONE?), if the target doesn't exist that's
> definitely an error.

So which bond we pick if they specify multiple ones? Just the first one 
found. Hm actually I was thinking about making sure each master is only 
specified once, not siblings. For siblings we indeed do not care.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-04-18  8:57 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  7:56 [PATCH 01/32] drm/i915: Seal races between async GPU cancellation, retirement and signaling Chris Wilson
2019-04-17  7:56 ` [PATCH 02/32] drm/i915: Verify workarounds immediately after application Chris Wilson
2019-04-17  7:56 ` [PATCH 03/32] drm/i915: Verify the engine workarounds stick on application Chris Wilson
2019-04-17  7:56 ` [PATCH 04/32] drm/i915: Make workaround verification *optional* Chris Wilson
2019-04-17  9:37   ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 05/32] drm/i915/selftests: Verify whitelist of context registers Chris Wilson
2019-04-17  7:56 ` [PATCH 06/32] drm/i915: Store the default sseu setup on the engine Chris Wilson
2019-04-17  9:40   ` Tvrtko Ursulin
2019-04-24  9:45     ` Chris Wilson
2019-04-17  7:56 ` [PATCH 07/32] drm/i915: Move GraphicsTechnology files under gt/ Chris Wilson
2019-04-17  9:42   ` Tvrtko Ursulin
2019-04-18 12:04   ` Joonas Lahtinen
2019-04-23  8:57     ` Joonas Lahtinen
2019-04-23  9:40       ` Jani Nikula
2019-04-23 16:46         ` Rodrigo Vivi
2019-04-17  7:56 ` [PATCH 08/32] drm/i915: Introduce struct intel_wakeref Chris Wilson
2019-04-17  9:45   ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 09/32] drm/i915: Pull the GEM powermangement coupling into its own file Chris Wilson
2019-04-17  7:56 ` [PATCH 10/32] drm/i915: Introduce context->enter() and context->exit() Chris Wilson
2019-04-17  7:56 ` [PATCH 11/32] drm/i915: Pass intel_context to i915_request_create() Chris Wilson
2019-04-17  7:56 ` [PATCH 12/32] drm/i915: Invert the GEM wakeref hierarchy Chris Wilson
2019-04-18 12:42   ` Tvrtko Ursulin
2019-04-18 13:07     ` Chris Wilson
2019-04-18 13:22       ` Chris Wilson
2019-04-23 13:02   ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 13/32] drm/i915/gvt: Pin the per-engine GVT shadow contexts Chris Wilson
2019-04-17  7:56 ` [PATCH 14/32] drm/i915: Explicitly pin the logical context for execbuf Chris Wilson
2019-04-17  7:56 ` [PATCH 15/32] drm/i915: Export intel_context_instance() Chris Wilson
2019-04-17  7:56 ` [PATCH 16/32] drm/i915/selftests: Use the real kernel context for sseu isolation tests Chris Wilson
2019-04-17  7:56 ` [PATCH 17/32] drm/i915/selftests: Pass around intel_context for sseu Chris Wilson
2019-04-17  7:56 ` [PATCH 18/32] drm/i915: Pass intel_context to intel_context_pin_lock() Chris Wilson
2019-04-17  7:56 ` [PATCH 19/32] drm/i915: Split engine setup/init into two phases Chris Wilson
2019-04-17  7:56 ` [PATCH 20/32] drm/i915: Switch back to an array of logical per-engine HW contexts Chris Wilson
2019-04-17  7:56 ` [PATCH 21/32] drm/i915: Remove intel_context.active_link Chris Wilson
2019-04-17  9:47   ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 22/32] drm/i915: Move i915_request_alloc into selftests/ Chris Wilson
2019-04-17  7:56 ` [PATCH 23/32] drm/i915: Allow multiple user handles to the same VM Chris Wilson
2019-04-17  7:56 ` [PATCH 24/32] drm/i915: Restore control over ppgtt for context creation ABI Chris Wilson
2019-04-17  7:56 ` [PATCH 25/32] drm/i915: Allow a context to define its set of engines Chris Wilson
2019-04-17  9:50   ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 26/32] drm/i915: Re-expose SINGLE_TIMELINE flags for context creation Chris Wilson
2019-04-17  7:56 ` [PATCH 27/32] drm/i915: Allow userspace to clone contexts on creation Chris Wilson
2019-04-17  9:50   ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 28/32] drm/i915: Load balancing across a virtual engine Chris Wilson
2019-04-17 11:26   ` Tvrtko Ursulin
2019-04-17 13:51     ` Chris Wilson
2019-04-17  7:56 ` [PATCH 29/32] drm/i915: Apply an execution_mask to the virtual_engine Chris Wilson
2019-04-17 11:43   ` Tvrtko Ursulin
2019-04-17 11:57     ` Chris Wilson
2019-04-17 12:35       ` Tvrtko Ursulin
2019-04-17 12:46         ` Chris Wilson
2019-04-17 13:32           ` Tvrtko Ursulin
2019-04-18  7:24             ` Chris Wilson
2019-04-17  7:56 ` [PATCH 30/32] drm/i915: Extend execution fence to support a callback Chris Wilson
2019-04-17  7:56 ` [PATCH 31/32] drm/i915/execlists: Virtual engine bonding Chris Wilson
2019-04-18  6:47   ` Tvrtko Ursulin
2019-04-18  6:57     ` Chris Wilson
2019-04-18  8:57       ` Tvrtko Ursulin [this message]
2019-04-18  9:13         ` Chris Wilson
2019-04-18  9:50           ` Tvrtko Ursulin
2019-04-18  9:59             ` Chris Wilson
2019-04-18 10:24               ` Tvrtko Ursulin
2019-04-17  7:56 ` [PATCH 32/32] drm/i915: Allow specification of parallel execbuf Chris Wilson
2019-04-17  8:46 ` [PATCH 01/32] drm/i915: Seal races between async GPU cancellation, retirement and signaling Chris Wilson
2019-04-17 11:33 ` ✗ Fi.CI.BAT: failure for series starting with [01/32] " Patchwork
2019-04-18 10:32 ` [PATCH 01/32] " Tvrtko Ursulin
2019-04-18 10:40   ` Chris Wilson
2019-04-23 12:59 ` Tvrtko Ursulin

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=b7981714-d076-c766-1820-89b72ddb4194@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@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