From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Stone <daniels@collabora.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
stable@vger.kernel.org,
DRI Development <dri-devel@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>,
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Subject: Re: [Intel-gfx] [PATCH] drm: avoid spurious EBUSY due to nonblocking atomic modesets
Date: Tue, 25 Feb 2020 16:48:14 +0200 [thread overview]
Message-ID: <20200225144814.GC13686@intel.com> (raw)
In-Reply-To: <20200225115024.2386811-1-daniel.vetter@ffwll.ch>
On Tue, Feb 25, 2020 at 12:50:24PM +0100, Daniel Vetter wrote:
> When doing an atomic modeset with ALLOW_MODESET drivers are allowed to
> pull in arbitrary other resources, including CRTCs (e.g. when
> reconfiguring global resources).
>
> But in nonblocking mode userspace has then no idea this happened,
> which can lead to spurious EBUSY calls, both:
> - when that other CRTC is currently busy doing a page_flip the
> ALLOW_MODESET commit can fail with an EBUSY
> - on the other CRTC a normal atomic flip can fail with EBUSY because
> of the additional commit inserted by the kernel without userspace's
> knowledge
>
> For blocking commits this isn't a problem, because everyone else will
> just block until all the CRTC are reconfigured. Only thing userspace
> can notice is the dropped frames without any reason for why frames got
> dropped.
>
> Consensus is that we need new uapi to handle this properly, but no one
> has any idea what exactly the new uapi should look like. As a stop-gap
> plug this problem by demoting nonblocking commits which might cause
> issues by including CRTCs not in the original request to blocking
> commits.
>
> v2: Add comments and a WARN_ON to enforce this only when allowed - we
> don't want to silently convert page flips into blocking plane updates
> just because the driver is buggy.
>
> v3: Fix inverted WARN_ON (Pekka).
>
> References: https://lists.freedesktop.org/archives/dri-devel/2018-July/182281.html
> Bugzilla: https://gitlab.freedesktop.org/wayland/weston/issues/24#note_9568
> Cc: Daniel Stone <daniel@fooishbar.org>
> Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
> Cc: stable@vger.kernel.org
> Reviewed-by: Daniel Stone <daniels@collabora.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_atomic.c | 34 +++++++++++++++++++++++++++++++---
> 1 file changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 9ccfbf213d72..4c035abf98b8 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1362,15 +1362,43 @@ EXPORT_SYMBOL(drm_atomic_commit);
> int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
> {
> struct drm_mode_config *config = &state->dev->mode_config;
> - int ret;
> + unsigned requested_crtc = 0;
> + unsigned affected_crtc = 0;
> + struct drm_crtc *crtc;
> + struct drm_crtc_state *crtc_state;
> + bool nonblocking = true;
> + int ret, i;
> +
> + /*
> + * For commits that allow modesets drivers can add other CRTCs to the
> + * atomic commit, e.g. when they need to reallocate global resources.
> + *
> + * But when userspace also requests a nonblocking commit then userspace
> + * cannot know that the commit affects other CRTCs, which can result in
> + * spurious EBUSY failures. Until we have better uapi plug this by
> + * demoting such commits to blocking mode.
> + */
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> + requested_crtc |= drm_crtc_mask(crtc);
>
> ret = drm_atomic_check_only(state);
> if (ret)
> return ret;
>
> - DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> + affected_crtc |= drm_crtc_mask(crtc);
> +
> + if (affected_crtc != requested_crtc) {
> + /* adding other CRTC is only allowed for modeset commits */
> + WARN_ON(!state->allow_modeset);
Not sure that's really true. What if the driver needs to eg.
redistribute FIFO space or something between the pipes? Or do we
expect drivers to now examine state->allow_modeset to figure out
if they're allowed to do certain things?
> +
> + DRM_DEBUG_ATOMIC("demoting %p to blocking mode to avoid EBUSY\n", state);
> + nonblocking = false;
> + } else {
> + DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
> + }
>
> - return config->funcs->atomic_commit(state->dev, state, true);
> + return config->funcs->atomic_commit(state->dev, state, nonblocking);
> }
> EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
>
> --
> 2.24.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Stone <daniels@collabora.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
stable@vger.kernel.org,
DRI Development <dri-devel@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>,
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Subject: Re: [Intel-gfx] [PATCH] drm: avoid spurious EBUSY due to nonblocking atomic modesets
Date: Tue, 25 Feb 2020 16:48:14 +0200 [thread overview]
Message-ID: <20200225144814.GC13686@intel.com> (raw)
In-Reply-To: <20200225115024.2386811-1-daniel.vetter@ffwll.ch>
On Tue, Feb 25, 2020 at 12:50:24PM +0100, Daniel Vetter wrote:
> When doing an atomic modeset with ALLOW_MODESET drivers are allowed to
> pull in arbitrary other resources, including CRTCs (e.g. when
> reconfiguring global resources).
>
> But in nonblocking mode userspace has then no idea this happened,
> which can lead to spurious EBUSY calls, both:
> - when that other CRTC is currently busy doing a page_flip the
> ALLOW_MODESET commit can fail with an EBUSY
> - on the other CRTC a normal atomic flip can fail with EBUSY because
> of the additional commit inserted by the kernel without userspace's
> knowledge
>
> For blocking commits this isn't a problem, because everyone else will
> just block until all the CRTC are reconfigured. Only thing userspace
> can notice is the dropped frames without any reason for why frames got
> dropped.
>
> Consensus is that we need new uapi to handle this properly, but no one
> has any idea what exactly the new uapi should look like. As a stop-gap
> plug this problem by demoting nonblocking commits which might cause
> issues by including CRTCs not in the original request to blocking
> commits.
>
> v2: Add comments and a WARN_ON to enforce this only when allowed - we
> don't want to silently convert page flips into blocking plane updates
> just because the driver is buggy.
>
> v3: Fix inverted WARN_ON (Pekka).
>
> References: https://lists.freedesktop.org/archives/dri-devel/2018-July/182281.html
> Bugzilla: https://gitlab.freedesktop.org/wayland/weston/issues/24#note_9568
> Cc: Daniel Stone <daniel@fooishbar.org>
> Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
> Cc: stable@vger.kernel.org
> Reviewed-by: Daniel Stone <daniels@collabora.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_atomic.c | 34 +++++++++++++++++++++++++++++++---
> 1 file changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 9ccfbf213d72..4c035abf98b8 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1362,15 +1362,43 @@ EXPORT_SYMBOL(drm_atomic_commit);
> int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
> {
> struct drm_mode_config *config = &state->dev->mode_config;
> - int ret;
> + unsigned requested_crtc = 0;
> + unsigned affected_crtc = 0;
> + struct drm_crtc *crtc;
> + struct drm_crtc_state *crtc_state;
> + bool nonblocking = true;
> + int ret, i;
> +
> + /*
> + * For commits that allow modesets drivers can add other CRTCs to the
> + * atomic commit, e.g. when they need to reallocate global resources.
> + *
> + * But when userspace also requests a nonblocking commit then userspace
> + * cannot know that the commit affects other CRTCs, which can result in
> + * spurious EBUSY failures. Until we have better uapi plug this by
> + * demoting such commits to blocking mode.
> + */
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> + requested_crtc |= drm_crtc_mask(crtc);
>
> ret = drm_atomic_check_only(state);
> if (ret)
> return ret;
>
> - DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> + affected_crtc |= drm_crtc_mask(crtc);
> +
> + if (affected_crtc != requested_crtc) {
> + /* adding other CRTC is only allowed for modeset commits */
> + WARN_ON(!state->allow_modeset);
Not sure that's really true. What if the driver needs to eg.
redistribute FIFO space or something between the pipes? Or do we
expect drivers to now examine state->allow_modeset to figure out
if they're allowed to do certain things?
> +
> + DRM_DEBUG_ATOMIC("demoting %p to blocking mode to avoid EBUSY\n", state);
> + nonblocking = false;
> + } else {
> + DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
> + }
>
> - return config->funcs->atomic_commit(state->dev, state, true);
> + return config->funcs->atomic_commit(state->dev, state, nonblocking);
> }
> EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
>
> --
> 2.24.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: DRI Development <dri-devel@lists.freedesktop.org>,
Daniel Stone <daniels@collabora.com>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
stable@vger.kernel.org, Daniel Vetter <daniel.vetter@intel.com>,
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Subject: Re: [Intel-gfx] [PATCH] drm: avoid spurious EBUSY due to nonblocking atomic modesets
Date: Tue, 25 Feb 2020 16:48:14 +0200 [thread overview]
Message-ID: <20200225144814.GC13686@intel.com> (raw)
In-Reply-To: <20200225115024.2386811-1-daniel.vetter@ffwll.ch>
On Tue, Feb 25, 2020 at 12:50:24PM +0100, Daniel Vetter wrote:
> When doing an atomic modeset with ALLOW_MODESET drivers are allowed to
> pull in arbitrary other resources, including CRTCs (e.g. when
> reconfiguring global resources).
>
> But in nonblocking mode userspace has then no idea this happened,
> which can lead to spurious EBUSY calls, both:
> - when that other CRTC is currently busy doing a page_flip the
> ALLOW_MODESET commit can fail with an EBUSY
> - on the other CRTC a normal atomic flip can fail with EBUSY because
> of the additional commit inserted by the kernel without userspace's
> knowledge
>
> For blocking commits this isn't a problem, because everyone else will
> just block until all the CRTC are reconfigured. Only thing userspace
> can notice is the dropped frames without any reason for why frames got
> dropped.
>
> Consensus is that we need new uapi to handle this properly, but no one
> has any idea what exactly the new uapi should look like. As a stop-gap
> plug this problem by demoting nonblocking commits which might cause
> issues by including CRTCs not in the original request to blocking
> commits.
>
> v2: Add comments and a WARN_ON to enforce this only when allowed - we
> don't want to silently convert page flips into blocking plane updates
> just because the driver is buggy.
>
> v3: Fix inverted WARN_ON (Pekka).
>
> References: https://lists.freedesktop.org/archives/dri-devel/2018-July/182281.html
> Bugzilla: https://gitlab.freedesktop.org/wayland/weston/issues/24#note_9568
> Cc: Daniel Stone <daniel@fooishbar.org>
> Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
> Cc: stable@vger.kernel.org
> Reviewed-by: Daniel Stone <daniels@collabora.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_atomic.c | 34 +++++++++++++++++++++++++++++++---
> 1 file changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 9ccfbf213d72..4c035abf98b8 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1362,15 +1362,43 @@ EXPORT_SYMBOL(drm_atomic_commit);
> int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
> {
> struct drm_mode_config *config = &state->dev->mode_config;
> - int ret;
> + unsigned requested_crtc = 0;
> + unsigned affected_crtc = 0;
> + struct drm_crtc *crtc;
> + struct drm_crtc_state *crtc_state;
> + bool nonblocking = true;
> + int ret, i;
> +
> + /*
> + * For commits that allow modesets drivers can add other CRTCs to the
> + * atomic commit, e.g. when they need to reallocate global resources.
> + *
> + * But when userspace also requests a nonblocking commit then userspace
> + * cannot know that the commit affects other CRTCs, which can result in
> + * spurious EBUSY failures. Until we have better uapi plug this by
> + * demoting such commits to blocking mode.
> + */
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> + requested_crtc |= drm_crtc_mask(crtc);
>
> ret = drm_atomic_check_only(state);
> if (ret)
> return ret;
>
> - DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
> + for_each_new_crtc_in_state(state, crtc, crtc_state, i)
> + affected_crtc |= drm_crtc_mask(crtc);
> +
> + if (affected_crtc != requested_crtc) {
> + /* adding other CRTC is only allowed for modeset commits */
> + WARN_ON(!state->allow_modeset);
Not sure that's really true. What if the driver needs to eg.
redistribute FIFO space or something between the pipes? Or do we
expect drivers to now examine state->allow_modeset to figure out
if they're allowed to do certain things?
> +
> + DRM_DEBUG_ATOMIC("demoting %p to blocking mode to avoid EBUSY\n", state);
> + nonblocking = false;
> + } else {
> + DRM_DEBUG_ATOMIC("committing %p nonblocking\n", state);
> + }
>
> - return config->funcs->atomic_commit(state->dev, state, true);
> + return config->funcs->atomic_commit(state->dev, state, nonblocking);
> }
> EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
>
> --
> 2.24.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2020-02-25 14:48 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 11:50 [PATCH] drm: avoid spurious EBUSY due to nonblocking atomic modesets Daniel Vetter
2020-02-25 11:50 ` Daniel Vetter
2020-02-25 11:50 ` [Intel-gfx] " Daniel Vetter
2020-02-25 13:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: avoid spurious EBUSY due to nonblocking atomic modesets (rev3) Patchwork
2020-02-25 14:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-02-25 14:48 ` Ville Syrjälä [this message]
2020-02-25 14:48 ` [Intel-gfx] [PATCH] drm: avoid spurious EBUSY due to nonblocking atomic modesets Ville Syrjälä
2020-02-25 14:48 ` Ville Syrjälä
2020-02-25 15:09 ` Daniel Vetter
2020-02-25 15:09 ` Daniel Vetter
2020-02-25 15:09 ` Daniel Vetter
2020-02-25 15:34 ` Ville Syrjälä
2020-02-25 15:34 ` Ville Syrjälä
2020-02-25 15:34 ` Ville Syrjälä
2020-04-08 14:03 ` Ville Syrjälä
2020-04-08 14:03 ` Ville Syrjälä
2020-04-08 14:03 ` Ville Syrjälä
2020-04-08 15:34 ` Daniel Vetter
2020-04-08 15:34 ` Daniel Vetter
2020-04-08 15:34 ` Daniel Vetter
2020-03-06 22:45 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: avoid spurious EBUSY due to nonblocking atomic modesets (rev4) Patchwork
2020-03-06 23:00 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2020-03-06 23:11 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-03-07 2:45 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: avoid spurious EBUSY due to nonblocking atomic modesets (rev5) Patchwork
2020-03-07 3:00 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2020-03-07 3:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-04-08 16:24 [Intel-gfx] [PATCH] drm: avoid spurious EBUSY due to nonblocking atomic modesets Daniel Vetter
2020-05-14 6:40 ` Daniel Stone
2020-05-14 7:08 ` Daniel Vetter
2020-05-14 7:16 ` Daniel Stone
2020-05-14 7:25 ` Daniel Vetter
2020-05-14 7:40 ` Daniel Stone
2020-05-14 12:32 ` Daniel Vetter
2018-07-05 10:10 Daniel Vetter
2018-07-05 10:21 ` Daniel Vetter
2020-01-31 7:34 ` [Intel-gfx] " Daniel Stone
2020-09-22 13:36 ` Marius Vlad
2020-09-22 14:04 ` Daniel Vetter
2020-09-22 14:14 ` Daniel Stone
2020-09-22 16:01 ` Daniel Vetter
2020-09-22 19:02 ` Daniel Stone
2020-09-23 10:58 ` Daniel Vetter
2020-09-23 11:14 ` Marius Vlad
2020-09-23 11:16 ` Daniel Vetter
2020-09-23 11:31 ` Marius Vlad
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=20200225144814.GC13686@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=pekka.paalanen@collabora.co.uk \
--cc=stable@vger.kernel.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.