From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/13] drm/i915: Rearrange i915_scheduler.c
Date: Tue, 7 May 2019 13:06:40 +0100 [thread overview]
Message-ID: <2ce4a4c1-ebbc-1de5-7289-bc46d0062007@linux.intel.com> (raw)
In-Reply-To: <20190503115225.30831-10-chris@chris-wilson.co.uk>
On 03/05/2019 12:52, Chris Wilson wrote:
> To avoid pulling in a forward declaration in the next patch, move the
> i915_sched_node handling to after the main dfs of the scheduler.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_scheduler.c | 210 +++++++++++++-------------
> 1 file changed, 105 insertions(+), 105 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
> index fadf0cd9c75a..4a95cf2201a7 100644
> --- a/drivers/gpu/drm/i915/i915_scheduler.c
> +++ b/drivers/gpu/drm/i915/i915_scheduler.c
> @@ -35,109 +35,6 @@ static inline bool node_signaled(const struct i915_sched_node *node)
> return i915_request_completed(node_to_request(node));
> }
>
> -void i915_sched_node_init(struct i915_sched_node *node)
> -{
> - INIT_LIST_HEAD(&node->signalers_list);
> - INIT_LIST_HEAD(&node->waiters_list);
> - INIT_LIST_HEAD(&node->link);
> - node->attr.priority = I915_PRIORITY_INVALID;
> - node->semaphores = 0;
> - node->flags = 0;
> -}
> -
> -static struct i915_dependency *
> -i915_dependency_alloc(void)
> -{
> - return kmem_cache_alloc(global.slab_dependencies, GFP_KERNEL);
> -}
> -
> -static void
> -i915_dependency_free(struct i915_dependency *dep)
> -{
> - kmem_cache_free(global.slab_dependencies, dep);
> -}
> -
> -bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
> - struct i915_sched_node *signal,
> - struct i915_dependency *dep,
> - unsigned long flags)
> -{
> - bool ret = false;
> -
> - spin_lock_irq(&schedule_lock);
> -
> - if (!node_signaled(signal)) {
> - INIT_LIST_HEAD(&dep->dfs_link);
> - list_add(&dep->wait_link, &signal->waiters_list);
> - list_add(&dep->signal_link, &node->signalers_list);
> - dep->signaler = signal;
> - dep->flags = flags;
> -
> - /* Keep track of whether anyone on this chain has a semaphore */
> - if (signal->flags & I915_SCHED_HAS_SEMAPHORE_CHAIN &&
> - !node_started(signal))
> - node->flags |= I915_SCHED_HAS_SEMAPHORE_CHAIN;
> -
> - ret = true;
> - }
> -
> - spin_unlock_irq(&schedule_lock);
> -
> - return ret;
> -}
> -
> -int i915_sched_node_add_dependency(struct i915_sched_node *node,
> - struct i915_sched_node *signal)
> -{
> - struct i915_dependency *dep;
> -
> - dep = i915_dependency_alloc();
> - if (!dep)
> - return -ENOMEM;
> -
> - if (!__i915_sched_node_add_dependency(node, signal, dep,
> - I915_DEPENDENCY_ALLOC))
> - i915_dependency_free(dep);
> -
> - return 0;
> -}
> -
> -void i915_sched_node_fini(struct i915_sched_node *node)
> -{
> - struct i915_dependency *dep, *tmp;
> -
> - GEM_BUG_ON(!list_empty(&node->link));
> -
> - spin_lock_irq(&schedule_lock);
> -
> - /*
> - * Everyone we depended upon (the fences we wait to be signaled)
> - * should retire before us and remove themselves from our list.
> - * However, retirement is run independently on each timeline and
> - * so we may be called out-of-order.
> - */
> - list_for_each_entry_safe(dep, tmp, &node->signalers_list, signal_link) {
> - GEM_BUG_ON(!node_signaled(dep->signaler));
> - GEM_BUG_ON(!list_empty(&dep->dfs_link));
> -
> - list_del(&dep->wait_link);
> - if (dep->flags & I915_DEPENDENCY_ALLOC)
> - i915_dependency_free(dep);
> - }
> -
> - /* Remove ourselves from everyone who depends upon us */
> - list_for_each_entry_safe(dep, tmp, &node->waiters_list, wait_link) {
> - GEM_BUG_ON(dep->signaler != node);
> - GEM_BUG_ON(!list_empty(&dep->dfs_link));
> -
> - list_del(&dep->signal_link);
> - if (dep->flags & I915_DEPENDENCY_ALLOC)
> - i915_dependency_free(dep);
> - }
> -
> - spin_unlock_irq(&schedule_lock);
> -}
> -
> static inline struct i915_priolist *to_priolist(struct rb_node *rb)
> {
> return rb_entry(rb, struct i915_priolist, node);
> @@ -239,6 +136,11 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
> return &p->requests[idx];
> }
>
> +void __i915_priolist_free(struct i915_priolist *p)
> +{
> + kmem_cache_free(global.slab_priorities, p);
> +}
> +
> struct sched_cache {
> struct list_head *priolist;
> };
> @@ -443,9 +345,107 @@ void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump)
> spin_unlock_irqrestore(&schedule_lock, flags);
> }
>
> -void __i915_priolist_free(struct i915_priolist *p)
> +void i915_sched_node_init(struct i915_sched_node *node)
> {
> - kmem_cache_free(global.slab_priorities, p);
> + INIT_LIST_HEAD(&node->signalers_list);
> + INIT_LIST_HEAD(&node->waiters_list);
> + INIT_LIST_HEAD(&node->link);
> + node->attr.priority = I915_PRIORITY_INVALID;
> + node->semaphores = 0;
> + node->flags = 0;
> +}
> +
> +static struct i915_dependency *
> +i915_dependency_alloc(void)
> +{
> + return kmem_cache_alloc(global.slab_dependencies, GFP_KERNEL);
> +}
> +
> +static void
> +i915_dependency_free(struct i915_dependency *dep)
> +{
> + kmem_cache_free(global.slab_dependencies, dep);
> +}
> +
> +bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
> + struct i915_sched_node *signal,
> + struct i915_dependency *dep,
> + unsigned long flags)
> +{
> + bool ret = false;
> +
> + spin_lock_irq(&schedule_lock);
> +
> + if (!node_signaled(signal)) {
> + INIT_LIST_HEAD(&dep->dfs_link);
> + list_add(&dep->wait_link, &signal->waiters_list);
> + list_add(&dep->signal_link, &node->signalers_list);
> + dep->signaler = signal;
> + dep->flags = flags;
> +
> + /* Keep track of whether anyone on this chain has a semaphore */
> + if (signal->flags & I915_SCHED_HAS_SEMAPHORE_CHAIN &&
> + !node_started(signal))
> + node->flags |= I915_SCHED_HAS_SEMAPHORE_CHAIN;
> +
> + ret = true;
> + }
> +
> + spin_unlock_irq(&schedule_lock);
> +
> + return ret;
> +}
> +
> +int i915_sched_node_add_dependency(struct i915_sched_node *node,
> + struct i915_sched_node *signal)
> +{
> + struct i915_dependency *dep;
> +
> + dep = i915_dependency_alloc();
> + if (!dep)
> + return -ENOMEM;
> +
> + if (!__i915_sched_node_add_dependency(node, signal, dep,
> + I915_DEPENDENCY_ALLOC))
> + i915_dependency_free(dep);
> +
> + return 0;
> +}
> +
> +void i915_sched_node_fini(struct i915_sched_node *node)
> +{
> + struct i915_dependency *dep, *tmp;
> +
> + GEM_BUG_ON(!list_empty(&node->link));
> +
> + spin_lock_irq(&schedule_lock);
> +
> + /*
> + * Everyone we depended upon (the fences we wait to be signaled)
> + * should retire before us and remove themselves from our list.
> + * However, retirement is run independently on each timeline and
> + * so we may be called out-of-order.
> + */
> + list_for_each_entry_safe(dep, tmp, &node->signalers_list, signal_link) {
> + GEM_BUG_ON(!node_signaled(dep->signaler));
> + GEM_BUG_ON(!list_empty(&dep->dfs_link));
> +
> + list_del(&dep->wait_link);
> + if (dep->flags & I915_DEPENDENCY_ALLOC)
> + i915_dependency_free(dep);
> + }
> +
> + /* Remove ourselves from everyone who depends upon us */
> + list_for_each_entry_safe(dep, tmp, &node->waiters_list, wait_link) {
> + GEM_BUG_ON(dep->signaler != node);
> + GEM_BUG_ON(!list_empty(&dep->dfs_link));
> +
> + list_del(&dep->signal_link);
> + if (dep->flags & I915_DEPENDENCY_ALLOC)
> + i915_dependency_free(dep);
> + }
> +
> + spin_unlock_irq(&schedule_lock);
> }
>
> static void i915_global_scheduler_shrink(void)
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-05-07 12:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 11:52 [PATCH 01/13] drm/i915: Assert breadcrumbs are correctly ordered in the signal handler Chris Wilson
2019-05-03 11:52 ` [PATCH 02/13] drm/i915: Prefer checking the wakeref itself rather than the counter Chris Wilson
2019-05-07 10:48 ` Tvrtko Ursulin
2019-05-03 11:52 ` [PATCH 03/13] drm/i915: Assert the local engine->wakeref is active Chris Wilson
2019-05-07 10:52 ` Tvrtko Ursulin
2019-05-03 11:52 ` [PATCH 04/13] drm/i915/hangcheck: Replace hangcheck.seqno with RING_HEAD Chris Wilson
2019-05-03 11:52 ` [PATCH 05/13] drm/i915: Remove delay for idle_work Chris Wilson
2019-05-07 10:54 ` Tvrtko Ursulin
2019-05-03 11:52 ` [PATCH 06/13] drm/i915: Cancel retire_worker on parking Chris Wilson
2019-05-07 10:55 ` Tvrtko Ursulin
2019-05-03 11:52 ` [PATCH 07/13] drm/i915: Stop spinning for DROP_IDLE (debugfs/i915_drop_caches) Chris Wilson
2019-05-03 11:52 ` [PATCH 08/13] drm/i915: Only reschedule the submission tasklet if preemption is possible Chris Wilson
2019-05-07 11:53 ` Tvrtko Ursulin
2019-05-03 11:52 ` [PATCH 09/13] drm/i915/execlists: Don't apply priority boost for resets Chris Wilson
2019-05-07 12:04 ` Tvrtko Ursulin
2019-05-03 11:52 ` [PATCH 10/13] drm/i915: Rearrange i915_scheduler.c Chris Wilson
2019-05-07 12:06 ` Tvrtko Ursulin [this message]
2019-05-03 11:52 ` [PATCH 11/13] drm/i915: Pass i915_sched_node around internally Chris Wilson
2019-05-07 12:12 ` Tvrtko Ursulin
2019-05-07 12:26 ` Chris Wilson
2019-05-03 11:52 ` [PATCH 12/13] drm/i915: Bump signaler priority on adding a waiter Chris Wilson
2019-05-07 12:46 ` Tvrtko Ursulin
2019-05-07 13:14 ` Chris Wilson
2019-05-07 14:32 ` Tvrtko Ursulin
2019-05-07 14:38 ` Chris Wilson
2019-05-03 11:52 ` [PATCH 13/13] drm/i915: Disable semaphore busywaits on saturated systems Chris Wilson
2019-05-03 12:56 ` ✗ Fi.CI.SPARSE: warning for series starting with [01/13] drm/i915: Assert breadcrumbs are correctly ordered in the signal handler Patchwork
2019-05-03 13:18 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-05-03 13:32 ` [PATCH 01/13] " Tvrtko Ursulin
2019-05-03 13:37 ` Chris Wilson
2019-05-03 13:49 ` Tvrtko Ursulin
2019-05-03 15:22 ` [PATCH v2] " Chris Wilson
2019-05-07 10:39 ` Tvrtko Ursulin
2019-05-03 15:38 ` ✗ Fi.CI.SPARSE: warning for series starting with [v2] drm/i915: Assert breadcrumbs are correctly ordered in the signal handler (rev2) Patchwork
2019-05-03 15:53 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-03 19:22 ` ✗ Fi.CI.IGT: failure " 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=2ce4a4c1-ebbc-1de5-7289-bc46d0062007@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 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.