From mboxrd@z Thu Jan 1 00:00:00 1970 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 D8791606A335 for ; Thu, 3 Dec 2026 15:21:40 +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=OjQgZ9DU Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4ADF611299E; Thu, 3 Dec 2026 15:21:35 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CBC311299E for ; Thu, 3 Dec 2026 15:21:29 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 44DFE43B56 for ; Thu, 3 Dec 2026 15:21:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 101BA1F00934; Thu, 3 Dec 2026 15:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796311289; bh=lkZFmwkNXweVoni44qPRmWn1xnKVneS6JJw9EYzbMso=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=OjQgZ9DUiRAp/5NTjR5YtCMMC+j2y4alLCTlokdrUN3IIk/j0SxiAmpiZMXx3BtVk sutuol4q0/jKodGdaDl0KeLaGvYnu8URkOXXouYrhcxv4Y+4LUIoKZYhQwf3+vXh1h 9cvMn19/ELqW8NwRb0QEpWVzQTNxyBxnjqqUGKmBcN7l7nW3wElkod+ZEm0Y1GOEYR 85PuFYDZERQwtlQk/+fGyYrsJDM6kw0W4gCf9aaAgdg8DO+8N8VNoxqWnv8VMa484a tolk9YVexi1NJCEkZ7BqpfRhuxk1W5CbIbpSejvXd/R1qttvlrgKJEYUUDblUVwbV+ eCJRBxIOlnk+Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v13 4/9] drm/tests: atomic: Add tests for drm_atomic_commit_fill_with_defaults() To: "Maxime Ripard" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261203-drm-reset-state-flag-v13-4-b09f19f64e64@kernel.org> References: <20261203-drm-reset-state-flag-v13-0-b09f19f64e64@kernel.org> <20261203-drm-reset-state-flag-v13-4-b09f19f64e64@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 15:21:28 +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: - [Medium] drm/tests: KUNIT_ASSERT aborts while holding modeset locks in new tests - [Low] drm/tests: remove unused drm_auth.h and drm_file.h includes - [Low] drm/tests: colorop leaked on early init failure in color_pipeline test -- commit 40e2b43507596f3808aa229d7ee7b0f6dbdc124d Author: Maxime Ripard drm/tests: atomic: Add tests for drm_atomic_commit_fill_with_defaults() This commit adds six KUnit tests for drm_atomic_commit_fill_with_defaults(), covering resetting an active output, committing the reset state, derived color management and zpos flags, and avoiding modesets when re-applying the same configuration. > diff --git a/drivers/gpu/drm/tests/drm_atomic_test.c b/drivers/gpu/drm/te= sts/drm_atomic_test.c > index 5e156d09e56f1..69f9071fc2d39 100644 > --- a/drivers/gpu/drm/tests/drm_atomic_test.c > +++ b/drivers/gpu/drm/tests/drm_atomic_test.c > @@ -2,12 +2,17 @@ > /* > * Kunit test for drm_atomic functions > */ > + > #include > #include > #include > +#include > +#include > #include > +#include > #include > #include > +#include [Severity: Low] Are the drm_auth.h and drm_file.h includes needed here? Nothing in drm_atomic_test.c uses anything from either header, and struct drm_file is already forward-declared by drm_atomic.h. [ ... ] > +static void drm_test_check_fill_with_defaults(struct kunit *test) > +{ [ ... ] > + drm_modeset_acquire_init(&ctx, 0); > + > +retry_enable: > + ret =3D drm_kunit_helper_enable_crtc_connector(test, drm, > + priv->crtc, > + &priv->connector, > + mode, &ctx); > + if (ret =3D=3D -EDEADLK) { > + ret =3D drm_modeset_backoff(&ctx); > + if (!ret) > + goto retry_enable; > + } > + KUNIT_ASSERT_EQ(test, ret, 0); > + > + state =3D drm_kunit_helper_atomic_state_alloc(test, drm, &ctx); > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); > + > +retry_fill: > + ret =3D drm_atomic_commit_fill_with_defaults(NULL, state); > + if (ret =3D=3D -EDEADLK) { > + drm_atomic_commit_clear(state); > + ret =3D drm_modeset_backoff(&ctx); > + if (!ret) > + goto retry_fill; > + } > + KUNIT_ASSERT_EQ(test, ret, 0); > + > + new_crtc_state =3D drm_atomic_get_new_crtc_state(state, priv->crtc); > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_crtc_state); [Severity: Medium] Can a failing KUNIT_ASSERT_* here abort the test thread while modeset locks are still held? The same pattern appears in all six new tests. KUNIT_ASSERT_* exits the test kthread via kunit_try_catch_throw() -> kthread_exit() without unwinding the stack, skipping drm_modeset_drop_locks(&ctx) and drm_modeset_acquire_fini(&ctx). If an assertion fails after locks are acquired, do_exit() triggers debug_check_no_locks_held() and disables lockdep, and KUnit teardown hits WARN_ON(!list_empty(&lock->head)) in drm_modeset_lock_fini() because the locks remain linked on the exited thread's ctx.locked list. Dropping the locks and finalizing ctx before invoking KUNIT_ASSERT_* (for example via an unlock cleanup path) would avoid exiting with locks held. [ ... ] > +static void drm_test_check_fill_with_defaults_color_pipeline(struct kuni= t *test) > +{ [ ... ] > + /* Freed through the funcs destroy hook by drm_mode_config_cleanup() */ > + colorop =3D kzalloc_obj(*colorop); > + KUNIT_ASSERT_NOT_NULL(test, colorop); > + > + ret =3D drm_plane_colorop_curve_1d_init(drm, colorop, priv->plane, > + &drm_atomic_test_colorop_funcs, > + BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF), > + DRM_COLOROP_FLAG_ALLOW_BYPASS); > + KUNIT_ASSERT_EQ(test, ret, 0); [Severity: Low] Can this leak colorop if drm_plane_colorop_curve_1d_init() fails early? If drm_mode_object_add() fails inside drm_plane_colorop_init(), it returns before linking colorop onto dev->mode_config.colorop_list. KUNIT_ASSERT_EQ= () then aborts the test, and drm_mode_config_cleanup() never calls colorop->funcs->destroy() for it. Allocating colorop with kunit_kzalloc() or drmm_kzalloc() and using a destr= oy hook that only calls drm_colorop_cleanup() would avoid both the leak and a double free if init fails after registration. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-drm-reset-= state-flag-v13-0-b09f19f64e64@kernel.org?part=3D4