Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7B73606A689 for ; Thu, 3 Dec 2026 15:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l4wYq7CL Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D0A610E4C9; Thu, 3 Dec 2026 15:03:03 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC30110E701 for ; Thu, 3 Dec 2026 15:02:56 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D665C629F9 for ; Thu, 3 Dec 2026 15:02:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 724571F000C1; Thu, 3 Dec 2026 15:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796310175; bh=PQPfcPn5dUE0Sdlwy/TNT6WS55xFEWVbTfybHIFWB4c=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=l4wYq7CL8TOAcPgzKwptOF4BnxZkqB9OzJHYTvvZypHnBmgG3M8/YOTkJTiRwNr0j Q/FvJgDF9sJ7bzx1ItIdtQrUC0KyF3RIyaUhFnyWAXc9jrmFQdCaqM7MGZV7+zHpFy 08ngJMlyMifpTNZKGHlb/8+e8Obnaf+jmj5HiD4LPDpR/bYsyOK/YvYQvrhnNDFBLh 8/KRcEOO1g9psOKCM1zdlB/NEPZERPsH1y9g1wpFTYPwuza8gHht2mC7TsiIz8YZo3 e0IAa1I7BJVuOD2M4WsaAr/E2c0v/EDMNeYr1+qSQjFykfXWs23laUHj8fo6jJxi8G VfwWjwW40GSjw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v13 3/9] drm/atomic: Allow filling a commit with pristine object states To: "Maxime Ripard" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261203-drm-reset-state-flag-v13-3-b09f19f64e64@kernel.org> References: <20261203-drm-reset-state-flag-v13-0-b09f19f64e64@kernel.org> <20261203-drm-reset-state-flag-v13-3-b09f19f64e64@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 15:02:55 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/atomic: lost driver state in drm_atomic_commit_fill_with_defaults() - [Low] drm/atomic: commit message says -ENOENT instead of -EACCES for split leases - [Low] drm/atomic: incomplete kernel-doc contract for drm_atomic_commit_fill_with_defaults() -- commit e865390bfad964b059339362263f954229009ccf Author: Maxime Ripard drm/atomic: Allow filling a commit with pristine object states This commit adds drm_atomic_commit_fill_with_defaults() to populate an atomic commit with freshly created default states for CRTCs, planes, connectors, and color operations, scoped to the caller's lease. > A lessee only gets the objects of its lease reset, the other ones > keeping their current state. Partial pipelines aren't supported > though: detaching a plane or a connector from its CRTC, and disabling > a CRTC driving them, both need the two sides in the commit, so a lease > that splits a pipeline is rejected with -ENOENT. [Severity: Low] As reported by Thomas Zimmermann on v12 [1], the code and kernel-doc now return -EACCES for split leases rather than -ENOENT. Should the commit message be updated to match? > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 5036beb2762ad..84af0b6e9bb07 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -1708,6 +1708,327 @@ bool drm_atomic_implements_create_state(struct dr= m_device *dev) > } > EXPORT_SYMBOL(drm_atomic_implements_create_state); > =20 > +/** > + * drm_atomic_commit_fill_with_defaults - populate a commit with pristin= e states > + * @file_priv: DRM file the reset was requested from, or NULL > + * @commit: atomic commit to fill [ ... ] > + * Returns: > + * 0 on success, -EACCES if a leased plane or connector is bound to a > + * CRTC that isn't leased or if the lease was revoked, or a negative > + * error code on failure. > + */ > +int drm_atomic_commit_fill_with_defaults(struct drm_file *file_priv, > + struct drm_atomic_commit *commit) [Severity: Low] Since drm_atomic_commit_fill_with_defaults() is exported, should its kernel-doc spell out the caller contract and return values? Callers must pass an empty commit with an initialized acquire_ctx and verify drm_atomic_implements_create_state() beforehand, as the CRTC and plane atomic_create_state hooks are called without NULL checks and existing slots would be overwritten without cleanup. The function also acquires modeset locks that stay held on both success and failure, so callers need to clear partial state on error and handle -EDEADLK backoff. The Returns section omits -EDEADLK, -EOPNOTSUPP (for a hotplugged connector without atomic_create_state), and the -EACCES cases where a leased CRTC drives an unleased plane or connector. [ ... ] > + crtc_state =3D crtc->funcs->atomic_create_state(crtc); > + if (IS_ERR(crtc_state)) > + return PTR_ERR(crtc_state); [ ... ] > + drm_mode_copy(&crtc_state->adjusted_mode, > + &crtc->state->adjusted_mode); [ ... ] > + plane_state =3D plane->funcs->atomic_create_state(plane); > + if (IS_ERR(plane_state)) > + return PTR_ERR(plane_state); [ ... ] > + connector_state->best_encoder =3D connector->state->best_encoder; [Severity: High] Can populating a live commit with atomic_create_state() while carrying over adjusted_mode and best_encoder leave driver-private state zeroed in drivers that satisfy drm_atomic_implements_create_state()? Drivers assume a live atomic commit starts from duplicated state, so skipping a modeset on a reset commit leaves subclass fields unpopulated even after the amdgpu_dm, vc4, and msm/dpu1 adjustments later in the series: - msm/mdp5: keeping a CRTC active with no visible planes sets mdp5_cstate->ctl in mdp5_encoder_atomic_check(), while mdp5_crtc_atomic_check() returns early before setting up pipeline.mixer, causing a NULL pointer dereference on mixer->lm in blend_setup(). mdp5_plane_atomic_check_with_state() also releases hwpipe and r_hwpipe from the new plane state, which are NULL after mdp5_plane_create_state(), leaking the previously assigned pipes. - nouveau dispnv50: on a no-modeset reset keeping the same framebuffer, nv50_wndw_atomic_check_acquire() skips populating asyw->image, causing curs507a_acquire() to fail with -EINVAL and leaving window handles zeroed. nv50_head_atomic_check() similarly leaves head fields zeroed, and resetting connector properties to defaults leaves asyc->set.mask clear so hardware reprogramming is skipped. - arm/komeda: komeda_crtc_create_state() zeroes affected_pipes, clock_ratio, and max_slave_zorder instead of copying them from the old state, so a no-modeset reset leaves clock_ratio zero and passes a zeroed affected_pipes to komeda_release_unclaimed_resources(). [1] https://lore.kernel.org/r/4653f381-cee3-4407-b393-5fc3352b3a39@suse.de --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-drm-reset-= state-flag-v13-0-b09f19f64e64@kernel.org?part=3D3