From: Michel Thierry <michel.thierry@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: "Vetter, Daniel" <daniel.vetter@intel.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
"Kuoppala, Mika" <mika.kuoppala@intel.com>
Subject: Re: [PATCH 2/7] drm/i915: Push i915_sw_fence_wait into the nonblocking atomic commit
Date: Mon, 7 Aug 2017 10:06:34 -0700 [thread overview]
Message-ID: <1840a5ca-e83c-98e3-17b0-9fdde315dbea@intel.com> (raw)
In-Reply-To: <20170807153325.kdwmhx7lj2p44k2z@phenom.ffwll.local>
On 8/7/2017 8:33 AM, Daniel Vetter wrote:
> On Thu, Aug 03, 2017 at 12:44:40PM -0700, Michel Thierry wrote:
>> On 7/20/2017 10:57 AM, Daniel Vetter wrote:
>>> Blocking in a worker is ok, that's what the unbound_wq is for. And it
>>> unifies the paths between the blocking and nonblocking commit, giving
>>> me just one path where I have to implement the deadlock avoidance
>>> trickery in the next patch.
>>>
>>> I first tried to implement the following patch without this rework, but
>>> force-completing i915_sw_fence creates some serious challenges around
>>> properly cleaning things up. So wasn't a feasible short-term approach.
>>> Another approach would be to simple keep track of all pending atomic
>>> commit work items and manually queue them from the reset code. With the
>>> caveat that double-queue in case we race with the i915_sw_fence must be
>>> avoided. Given all that, taking the cost of a double schedule in atomic
>>> for the short-term fix is the best approach, but can be changed in the
>>> future of course.
>>>
>>> v2: Amend commit message (Chris).
>>>
>>> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>>> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>>> ---
>>> drivers/gpu/drm/i915/intel_display.c | 15 +++++++--------
>>> 1 file changed, 7 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>>> index 995522e40ec1..f6bd6282d7f7 100644
>>> --- a/drivers/gpu/drm/i915/intel_display.c
>>> +++ b/drivers/gpu/drm/i915/intel_display.c
>>> @@ -12394,6 +12394,8 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
>>> unsigned crtc_vblank_mask = 0;
>>> int i;
>>>
>>> + i915_sw_fence_wait(&intel_state->commit_ready);
>>> +
>>> drm_atomic_helper_wait_for_dependencies(state);
>>>
>>> if (intel_state->modeset)
>>> @@ -12561,10 +12563,7 @@ intel_atomic_commit_ready(struct i915_sw_fence *fence,
>>>
>>> switch (notify) {
>>> case FENCE_COMPLETE:
>>> - if (state->base.commit_work.func)
>>> - queue_work(system_unbound_wq, &state->base.commit_work);
>>
>> I would add a small comment here, because later-on if someone has doubts
>> (and use git-blame), it won't be visible that something changed (the case
>> and break were added by the same commit).
>
> Hm, not sure what comment I should put here? Suggestions? Only thing I
> could come up with was
>
> /* we do blocking waits in the worker, nothing to do here */
>
> But not sure that adds the information you're looking for.
That sounds good to me, or maybe
"any blocking waits already handled in the worker"
But I think both are ok.
-Michel
>
>>
>>> break;
>>> -
>>> case FENCE_FREE:
>>> {
>>> struct intel_atomic_helper *helper =
>>> @@ -12668,14 +12667,14 @@ static int intel_atomic_commit(struct drm_device *dev,
>>> }
>>>
>>> drm_atomic_state_get(state);
>>> - INIT_WORK(&state->commit_work,
>>> - nonblock ? intel_atomic_commit_work : NULL);
>>> + INIT_WORK(&state->commit_work, intel_atomic_commit_work);
>>>
>>> i915_sw_fence_commit(&intel_state->commit_ready);
>>> - if (!nonblock) {
>>> - i915_sw_fence_wait(&intel_state->commit_ready);
>>> + if (nonblock)
>>> + queue_work(system_unbound_wq, &state->commit_work);
>>> + else
>>> intel_atomic_commit_tail(state);
>>> - }
>>> +
>>>
>>> return 0;
>>> }
>>
>> Reviewed-by: Michel Thierry <michel.thierry@intel.com>
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-08-07 17:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 17:57 [PATCH 0/7] gpu reset and page_flip removal, take 2 Daniel Vetter
2017-07-20 17:57 ` [PATCH 1/7] drm/i915: Avoid the gpu reset vs. modeset deadlock Daniel Vetter
2017-07-20 19:47 ` Chris Wilson
2017-07-20 20:04 ` Daniel Vetter
2017-07-20 20:16 ` Chris Wilson
2017-07-20 20:18 ` Daniel Vetter
2017-07-20 17:57 ` [PATCH 2/7] drm/i915: Push i915_sw_fence_wait into the nonblocking atomic commit Daniel Vetter
2017-08-03 19:44 ` Michel Thierry
2017-08-07 15:33 ` Daniel Vetter
2017-08-07 17:06 ` Michel Thierry [this message]
2017-07-20 17:57 ` [PATCH 3/7] drm/i915: More surgically unbreak the modeset vs reset deadlock Daniel Vetter
2017-08-03 19:35 ` Michel Thierry
2017-08-07 15:39 ` Daniel Vetter
2017-07-20 17:57 ` [PATCH 4/7] drm/i915: Rip out legacy page_flip completion/irq handling Daniel Vetter
2017-07-20 17:57 ` [PATCH 5/7] drm/i915: adjust has_pending_fb_unpin to atomic Daniel Vetter
2017-07-20 17:57 ` [PATCH 6/7] drm/i915: Remove intel_flip_work infrastructure Daniel Vetter
2017-07-20 17:57 ` [PATCH 7/7] drm/i915: Drop unpin stall in atomic_prepare_commit Daniel Vetter
2017-07-20 20:47 ` Daniel Vetter
2017-07-20 18:14 ` ✓ Fi.CI.BAT: success for gpu reset and page_flip removal, take 2 Patchwork
2017-07-20 19:45 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2017-07-20 11:43 [PATCH 1/7] drm/i915: Avoid the gpu reset vs. modeset deadlock Daniel Vetter
2017-07-20 11:43 ` [PATCH 2/7] drm/i915: Push i915_sw_fence_wait into the nonblocking atomic commit Daniel Vetter
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=1840a5ca-e83c-98e3-17b0-9fdde315dbea@intel.com \
--to=michel.thierry@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=daniel@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox