From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Subject: Re: [PATCH v2] drm/i915: Apply a cond_resched() to the saturated signaler
Date: Tue, 4 Apr 2017 13:38:36 +0100 [thread overview]
Message-ID: <5dc89289-d707-2db9-ddee-e0a50a5be120@linux.intel.com> (raw)
In-Reply-To: <20170404120531.10737-1-chris@chris-wilson.co.uk>
On 04/04/2017 13:05, Chris Wilson wrote:
> If the engine is continually completing nops, we can saturate the
> signaler and keep it working indefinitely. This angers the NMI watchdog!
>
> A good example is to disable semaphores on snb and run igt/gem_exec_nop -
> the parallel, multi-engine workloads are more than sufficient to hog the
> CPU, preventing the system from even processing ICMP echo replies.
>
> v2: Tvrtko dug into cond_resched() on x86 and found that it only
> depended upon preempt_cound and not tif_need_resched() - which means
> that we would always call schedule() at that point.
>
> Fixes: c81d46138da6 ("drm/i915: Convert trace-irq to the breadcrumb waiter")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> drivers/gpu/drm/i915/intel_breadcrumbs.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> index 308c56a021ab..9ccbf26124c6 100644
> --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> @@ -580,6 +580,8 @@ static int intel_breadcrumbs_signaler(void *arg)
> signaler_set_rtpriority();
>
> do {
> + bool do_schedule = true;
> +
> set_current_state(TASK_INTERRUPTIBLE);
>
> /* We are either woken up by the interrupt bottom-half,
> @@ -626,7 +628,18 @@ static int intel_breadcrumbs_signaler(void *arg)
> spin_unlock_irq(&b->rb_lock);
>
> i915_gem_request_put(request);
> - } else {
> +
> + /* If the engine is saturated we may be continually
> + * processing completed requests. This angers the
> + * NMI watchdog if we never let anything else
> + * have access to the CPU. Let's pretend to be nice
> + * and relinquish the CPU if we burn through the
> + * entire RT timeslice!
> + */
> + do_schedule = need_resched();
> + }
> +
> + if (unlikely(do_schedule)) {
> DEFINE_WAIT(exec);
>
> if (kthread_should_park())
>
My thinking was to add a check before the request assignment like:
rcu_read_lock();
request = ...;
if (request && !need_resched())
request = ...;
else
request = NULL;
rcu_read_unlock();
But this looks correct as well, maybe it is just my preference on what
would have been easier to understand.
I trust that you have tested it both for solving the NMI lockup detector
issue and that it doesn't affect the signaller latency a lot.
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:[~2017-04-04 12:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 10:10 [PATCH] drm/i915: Apply a cond_resched() to the saturated signaler Chris Wilson
2017-04-04 10:34 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-04-04 12:05 ` [PATCH v2] " Chris Wilson
2017-04-04 12:38 ` Tvrtko Ursulin [this message]
2017-04-04 12:24 ` ✓ Fi.CI.BAT: success for drm/i915: Apply a cond_resched() to the saturated signaler (rev2) Patchwork
2017-04-04 12:52 ` Chris Wilson
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=5dc89289-d707-2db9-ddee-e0a50a5be120@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@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.