From: Philipp Stanner <phasta@mailbox.org>
To: "Christian König" <christian.koenig@amd.com>,
phasta@kernel.org, alexdeucher@gmail.com, simona.vetter@ffwll.ch,
faith@gfxstrand.net, sumit.semwal@linaro.org
Cc: linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org,
"Michel Dänzer" <michel.daenzer@mailbox.org>
Subject: Re: [PATCH 1/4] dma-buf/fence: give some reasonable maximum signaling timeout
Date: Tue, 25 Nov 2025 17:03:29 +0100 [thread overview]
Message-ID: <fe25a7fe229c0a150c54a80dd83ac83fc0daa3af.camel@mailbox.org> (raw)
In-Reply-To: <52d484c5-6dfb-4e2f-9caa-a61cf1d94801@amd.com>
+Cc Michel
On Tue, 2025-11-25 at 15:26 +0100, Christian König wrote:
> On 11/25/25 11:56, Philipp Stanner wrote:
> > > > >
> > > > > The GPU scheduler has a very similar define, MAX_WAIT_SCHED_ENTITY_Q_EMPTY which is currently just 1 second.
> > > > >
> > > > > The real question is what is the maximum amount of time we can wait for the HW before we should trigger a timeout?
> > > >
> > > > That's a question only the drivers can answer, which is why I like to
> > > > think that setting global constants constraining all parties is not the
> > > > right thing to do.
> > >
> > > Exactly that's the reason why I bring that up. I think that drivers should be in charge of timeouts is the wrong approach.
> > >
> > > See the reason why we have the timeout (and documented that it is a must have) is because we have both core memory management as well a desktop responsiveness depend on it.
> >
> > Good and well, but then patch 4 becomes even more problematic:
> >
> > So we'd just have drivers fire warnings, and then they would still have
> > the freedom to set timeouts for drm/sched, as long as those timeouts
> > are smaller than your new global constant.
> >
> > Why then not remove drm/sched's timeout parameter API completely and
> > always use your maximum value internally in drm/sched? Or maybe
> > truncate it with a warning?
>
> I have considered that as well, but then thought that we should at least give end users the possibility to override the timeout while still tainting the kernel so that we know about this in bug reports, core dumps etc...
>
> > "Maximum timeout parameter exceeded, truncating to %ld.\n"
> >
> > I suppose some drivers want even higher responsiveness than those 2
> > seconds.
>
> As far as I know some medical use cases for example have timeouts like 100-200ms. But again that is the use case and not the driver.
>
> > I do believe that more of the driver folks should be made aware of this
> > intended change.
>
> I have no real intention of actually pushing those patches, at least not as they are. I just wanted to kick of some discussion.
Can you then please use --rfc when creating such patches in the future?
That way you won't cause my heart rate to increase, searching for
immediate danger :D
>
> > >
> > > > What is even your motivation? What problem does this solve? Is the OOM
> > > > killer currently hanging for anyone? Can you link a bug report?
> > >
> > > I'm not sure if we have an external bug report (we have an internal one), but for amdgpu there were customer complains that 10 seconds is to long.
> > >
> > > So we changed it to 2 seconds for amdgpu, and now there are complains from internal AMD teams that 2 seconds is to short.
> > >
> > > While working on that I realized that the timeout is actually not driver dependent at all.
> > >
> > > What can maybe argued is that a desktop system should have a shorter timeout than some server, but that one driver needs a different timeout than another driver doesn't really makes sense to me.
> > >
> > > I mean what is actually HW dependent on the requirement that I need a responsive desktop system?
> >
> > I suppose some drivers are indeed only used for server hardware. And
> > for compute you might not care about responsiveness as long as your
> > result drops off at some point. But there's cloud gaming, too..
>
> Good point with the cloud gaming.
>
> > I agree that distinguishing the use case that way is not ideal.
> > However, who has the knowledge of how the hardware is being used by
> > customers / users, if not the driver?
>
> Well the end user.
>
> Maybe we should move the whole timeout topic into the DRM layer or the scheduler component.
Who's the "user"? The entire system? One process sitting on top of its
ioctl and file descriptor?
That question plays into answering how and where timeouts should be
configured.
One might ask himself if then a kernel parameter would be the right way
to configure it. I'm not very experienced with the desires of
userspace.
I sumond Michel Dänzer to share his wisdom!
>
> Something like 2 seconds default (which BTW is the default on Windows as well), which can be overridden on a global, per device, per queue name basis.
I mean, the drivers can already set it per device. It seems to me that
what you actually want is finer control?
For Nouveau with its firmware scheduler having a timeout at all just
doesn't make much sense anywayys.
* If a fw ring hangs, it hangs, and a shorter timeout will just have
your app crash sooner.
* If it's laggy and slow, it's laggy and slow, but with a high timeout
at least still usable.
* And if it's compute and slow, you at least get your results at some
point.
But having a lower timeout wouldn't really repair anything, or am I
mistaken?
>
> And 10 seconds maximum with only a warning that a not default timeout is used and everything above 10 seconds taints the kernel and should really only be used for testing/debugging.
>
> Thoughts?
The most important thing for me regarding your RFC is that we don't add
shiny warnings by declaring driver behavior invalid that was
operational for years.
The most conservative way would be to send patches to the respective
drivers, setting their timeouts to the new desired defaults, and then
adding warnings so that future drivers become aware.
P.
next prev parent reply other threads:[~2025-11-25 16:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 14:41 Reasonable maximum signaling timeout for dma_fences Christian König
2025-11-20 14:41 ` [PATCH 1/4] dma-buf/fence: give some reasonable maximum signaling timeout Christian König
2025-11-25 7:55 ` Philipp Stanner
2025-11-25 8:03 ` Christian König
2025-11-25 8:13 ` Philipp Stanner
2025-11-25 8:48 ` Christian König
2025-11-25 10:56 ` Philipp Stanner
2025-11-25 14:26 ` Christian König
2025-11-25 16:03 ` Philipp Stanner [this message]
2025-11-25 17:02 ` Lucas Stach
2025-11-26 12:31 ` Christian König
2025-11-26 12:37 ` Philipp Stanner
2025-11-26 15:03 ` Christian König
2025-11-26 15:44 ` Philipp Stanner
2025-11-26 15:59 ` Lucas Stach
2025-11-26 16:11 ` Lucas Stach
2025-12-05 13:14 ` Christian König
2025-11-20 14:41 ` [PATCH 2/4] dma-buf/sw-sync: always taint the kernel when sw-sync is used Christian König
2025-11-25 2:58 ` Sumit Semwal
2025-11-20 14:41 ` [PATCH 3/4] drm/vgem: use the reasonable maximum timeout defined by the dma_fence Christian König
2025-11-25 7:56 ` Philipp Stanner
2025-11-20 14:41 ` [PATCH 4/4] drm/sched: warn and taint the kernel when maximum timeout is exceeded Christian König
2025-11-25 8:08 ` Philipp Stanner
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=fe25a7fe229c0a150c54a80dd83ac83fc0daa3af.camel@mailbox.org \
--to=phasta@mailbox.org \
--cc=alexdeucher@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith@gfxstrand.net \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=michel.daenzer@mailbox.org \
--cc=phasta@kernel.org \
--cc=simona.vetter@ffwll.ch \
--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.