All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Xaver Hugl <xaver.hugl@kde.org>
Cc: Arun R Murthy <arun.r.murthy@intel.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	harry.wentland@amd.com, uma.shankar@intel.com,
	louis.chauvet@bootlin.com, naveen1.kumar@intel.com,
	ramya.krishna.yella@intel.com, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	Suraj Kandpal <suraj.kandpal@intel.com>
Subject: Re: [PATCH v11 1/7] drm: Define user readable error codes for atomic ioctl
Date: Mon, 5 Oct 2026 14:22:23 +0200	[thread overview]
Message-ID: <636a3dc2-fe17-463e-806a-056818656692@suse.de> (raw)
In-Reply-To: <CAFZQkGzSkUZTodjUudhLsYtset=EqviZeqrfv6gj6XmG+ZJOPQ@mail.gmail.com>

Hi

Am 05.10.26 um 13:39 schrieb Xaver Hugl:
> Am Mo., 5. Okt. 2026 um 11:08 Uhr schrieb Thomas Zimmermann
> <tzimmermann@suse.de>:
>> I have serious doubts about these failure codes. The core issue to me is
>> that when the kernel driver detects an impossible commit, it probably
>> knows best how to fix it.
> There's lots of different ways you could fix any specific error, with
> different tradeoffs and it all depends a lot on what the compositor is
> actually trying to do. The kernel can't make those kinds of policy
> decisions.

That's not a policy decision. User space is free to do what ever it 
wants.  What I have in mind is a hint from the kernel what to do next.


>
>>> + * @DRM_MODE_ATOMIC_UNSPECIFIED_ERROR: this is the default/unspecified error.
>> This one does not give a hint to what happens. Should userspace abort or
>> fall back to TEST_ONLY?
> That's up to userspace. It's the same as ret=-EINVAL today.

IMHO most of these errors are fancy variants of EINVAL; except for 
NEED_FULL_MODESET.


>
>>> + * @DRM_MODE_ATOMIC_INVALID_API_USAGE: invallid API usage(DRM_ATOMIC not
>>> + *                                  enabled, invalid falg, page_flip event
>>> + *                                  with test-only, etc)
>> I've seen this being used in the i915 patch for a async flip.  Could
>> mean anything there (format, driver specifics).
> Its purpose is to catch anything that the compositor is supposed to
> know it can't do - using unsupported formats, invalid combinations of
> properties (crtc active=1 without a connector), that sort of thing. It
> should never be anything driver specific though.

I don't see how this could be useful except for the prototype that come 
with this series.  It's so broad in meaning that it's almost meaningless.

And error codes don't have to be driver specific to be meaningful. I 
already brought up DRM's mode-status code as example. They are not 
specific to any mode, display or hardware. Yet they clearly state what 
went wrong with the mode.


>
>>> + * @DRM_MODE_ATOMIC_ASYNC_PROP_CHANGED: Property changed in async flip
>>> + * @DRM_MODE_ATOMIC_SCANOUT_BW: For a given resolution, refresh rate and the
>>> + *                              color depth cannot be accomodated. Resolution
>>> + *                              is to lower the refresh rate or color depth.
>>> + * @DRM_MODE_ATOMIC_CONNECTOR_BW: Refers to the limitation on the link rate on
>>> + *                                a given connector.
>>> + * @DRM_MODE_ATOMIC_PIPE_BW: Limitation on the pipe, either pipe not available
>>> + *                           or the pipe scaling factor limitation.
>>> + * @DRM_MODE_ATOMIC_MEMORY_DOMAIN: Any other memory/bandwidth related limitation
>>> + *                                 other then the ones specified above.
>>> + * @DRM_MODE_ATOMIC_SPEC_VIOLOATION: Limitation of a particular feature on that
>>> + *                                   hardware. To get to know the feature, the
>>> + *                                   property/object causing this is being sent
>>> + *                                   back to user @failure_objs_ptr in the
>>> + *                                   struct drm_mode_atomic_err_code
>> There codes don't seem actionable to me.
> Scanout and connector bandwidth are very directly actionable. I agree

Fair point.


> about the others though, adding these error codes should wait until
> there's a compositor actually using them for something.
>
>>> +     char failure_string[DRM_MODE_ATOMIC_FAILURE_STRING_LEN];
>> I'd don't think we should return error strings from the kernel. If we
>> do, these strings will become uAPI. And I guarantee that someone will
>> start parsing them for information. We'll be in a situation where we
>> cannot ever change the strings.
>>
>> For error logging, we can put messages directly in the kernel log
> The error string is half the reason we need the API: When things fail
> on an end user system, we need to be able to find out what happened
> after the fact, without the user needing to have drm debug logging
> enabled and without them having to trigger the bug again (which can be
> very difficult to do).

You could to this with detailed and precise error codes plus the object 
on which it failed.

If the error cannot be expressed in abstract terms then users will begin 
parsing the error string, which is a no-go IMHO.


>
> I think making the error string something more abstract like the file
> + line number of the failure would also be okay, if that solves the
> concerns about uAPI. We just need some way to figure out what happened
> after something goes wrong, which would usually involve diving through
> kernel sources anyways.

Filename + line is even worse.  None of this is even close to stable. 
I'll nak this as much as possible.

I also don't buy the argument about diving through kernel sources. Not 
doing that should be the goal here because it is what we currently do.


I don't want to leave it at this for this series, so here's my suggestion.

Pick 5 common mode-setting failures and go through all of the kernel 
drivers and report them as detailed as possible. This will give a good 
understanding of the characteristics of the errors involved and what 
could be done in the kernel. The simple i915 patch doesn't seem to grasp 
the effects of this change.

You may also want to play with an in-kernel interface that does the 
actual testing. Something like this.

   int drm_check_crtc_max_pixel_bandwidth(...)
   {
       // do the test and encode the error if any
   }

   if (!drm_check_crtc_max_pixel_(crtc, 
SOME_EXTRA_HINT_WHAT_WE_RE_DOING, (value < max_value))
       return -EINVAL.

do the same for other DRM objects and try to find a good API. Because if 
we're not careful, we'll end up with different kernel drivers 
implementing the failure reporting in different ways. It wouldn't be the 
first time.

Best regards
Thomas


>
>> or you can build them in user space from within libdrm.
> libdrm doesn't have any of the information returned in the error string.
>
> - Xaver

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2026-10-05 12:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31  9:03 [PATCH v11 0/7] User readable error codes on atomic_ioctl failure Arun R Murthy
2026-03-31  9:03 ` [PATCH v11 1/7] drm: Define user readable error codes for atomic ioctl Arun R Murthy
2026-06-25 23:09   ` Xaver Hugl
2026-07-20  7:03     ` Murthy, Arun R
2026-10-05  9:08   ` Thomas Zimmermann
2026-10-05 11:39     ` Xaver Hugl
2026-10-05 12:22       ` Thomas Zimmermann [this message]
2026-10-05 14:00         ` Xaver Hugl
2026-10-07  7:03           ` Murthy, Arun R
2026-10-07  8:41           ` Thomas Zimmermann
2026-10-05 12:07     ` Jani Nikula
2026-03-31  9:03 ` [PATCH v11 2/7] drm/atomic: Add error_code element in atomic_state Arun R Murthy
2026-04-02  6:17   ` kernel test robot
2026-03-31  9:03 ` [PATCH v11 3/7] drm/atomic: Call complete_signaling only if prepare_signaling is done Arun R Murthy
2026-03-31  9:03 ` [PATCH v11 4/7] drm/atomic: Allocate atomic_state at the beginning of atomic_ioctl Arun R Murthy
2026-03-31  9:03 ` [PATCH v11 5/7] drm/atomic: Return user readable error in atomic_ioctl Arun R Murthy
2026-03-31  9:03 ` [PATCH v11 6/7] drm/i915/display: Error codes for async flip failures Arun R Murthy
2026-03-31  9:03 ` [PATCH v11 7/7] drm: Introduce DRM_CAP_ATOMIC_ERROR_REPORTING Arun R Murthy
2026-03-31  9:12 ` ✗ CI.checkpatch: warning for User readable error codes on atomic_ioctl failure (rev10) Patchwork
2026-03-31  9:13 ` ✓ CI.KUnit: success " Patchwork
2026-03-31  9:51 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-03-31  9:59 ` ✓ i915.CI.BAT: success " Patchwork
2026-03-31 13:57 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-31 20:51 ` ✗ i915.CI.Full: " Patchwork
2026-04-20  8:32 ` [PATCH v11 0/7] User readable error codes on atomic_ioctl failure Kumar, Naveen1
2026-04-21  8:53   ` Michel Dänzer
2026-04-24 11:37     ` Kumar, Naveen1
2026-04-24 14:00       ` Michel Dänzer
2026-10-07  8:51 ` Thomas Zimmermann

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=636a3dc2-fe17-463e-806a-056818656692@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=arun.r.murthy@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=naveen1.kumar@intel.com \
    --cc=ramya.krishna.yella@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=suraj.kandpal@intel.com \
    --cc=tursulin@ursulin.net \
    --cc=uma.shankar@intel.com \
    --cc=xaver.hugl@kde.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.