From: Boris Brezillon <boris.brezillon@collabora.com>
To: Luben Tuikov <luben.tuikov@amd.com>
Cc: "Sarah Walker" <sarah.walker@imgtec.com>,
dri-devel@lists.freedesktop.org,
"Christian König" <christian.koenig@amd.com>,
"Donald Robson" <donald.robson@imgtec.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>
Subject: Re: [PATCH v3] drm/sched: Call drm_sched_fence_set_parent() from drm_sched_fence_scheduled()
Date: Mon, 26 Jun 2023 09:47:12 +0200 [thread overview]
Message-ID: <20230626094712.2030d137@collabora.com> (raw)
In-Reply-To: <50612c38-6a53-c1ae-5c0f-9f3f74833db8@amd.com>
On Fri, 23 Jun 2023 14:37:57 -0400
Luben Tuikov <luben.tuikov@amd.com> wrote:
> On 2023-06-23 04:03, Boris Brezillon wrote:
> > On Fri, 23 Jun 2023 09:52:04 +0200
> > Boris Brezillon <boris.brezillon@collabora.com> wrote:
> >
> >> Drivers that can delegate waits to the firmware/GPU pass the scheduled
> >> fence to drm_sched_job_add_dependency(), and issue wait commands to
> >> the firmware/GPU at job submission time. For this to be possible, they
> >> need all their 'native' dependencies to have a valid parent since this
> >> is where the actual HW fence information are encoded.
> >>
> >> In drm_sched_main(), we currently call drm_sched_fence_set_parent()
> >> after drm_sched_fence_scheduled(), leaving a short period of time
> >> during which the job depending on this fence can be submitted.
> >>
> >> Since setting parent and signaling the fence are two things that are
> >> kinda related (you can't have a parent if the job hasn't been scheduled),
> >> it probably makes sense to pass the parent fence to
> >> drm_sched_fence_scheduled() and let it call drm_sched_fence_set_parent()
> >> before it signals the scheduled fence.
> >>
> >> Here is a detailed description of the race we are fixing here:
> >>
> >> Thread A Thread B
> >>
> >> - calls drm_sched_fence_scheduled()
> >> - signals s_fence->scheduled which
> >> wakes up thread B
> >>
> >> - entity dep signaled, checking
> >> the next dep
> >> - no more deps waiting
> >> - entity is picked for job
> >> submission by drm_gpu_scheduler
> >> - run_job() is called
> >> - run_job() tries to
> >> collect native fence info from
> >> s_fence->parent, but it's
> >> NULL =>
> >> BOOM, we can't do our native
> >> wait
> >>
> >> - calls drm_sched_fence_set_parent()
> >>
> >> v2:
> >> * Fix commit message
> >>
> >> v3:
> >> * Add a detailed description of the race to the commit message
> >> * Add Luben's R-b
> >>
> >
> > FYI, I didn't put a Fixes tag because the various moves/modifications
> > that happened on this file will make it hard to backport anyway, and no
> > one complained about it so far. But if we want to have one, it would
> > probably be:
> >
> > Fixes: 754ce0fa55c4 ("drm/amd: add parent for sched fence")
> >
>
> I agree with your assessment--the race fix doesn't seem to be pointing to
> or introduced by one particular change. Plus that fixes change is from 2016...
> So, we're good to go as is.
Queued to drm-misc-fixes.
prev parent reply other threads:[~2023-06-26 7:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 7:52 [PATCH v3] drm/sched: Call drm_sched_fence_set_parent() from drm_sched_fence_scheduled() Boris Brezillon
2023-06-23 8:03 ` Boris Brezillon
2023-06-23 18:37 ` Luben Tuikov
2023-06-26 7:47 ` Boris Brezillon [this message]
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=20230626094712.2030d137@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=christian.koenig@amd.com \
--cc=donald.robson@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=luben.tuikov@amd.com \
--cc=sarah.walker@imgtec.com \
--cc=sumit.semwal@linaro.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.