Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1073426rdd; Wed, 10 Jan 2024 07:57:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOYfSJPjc4vee6bTNPETF2DoLky4AZoLZGYucDahvuFCgrhoXJkGKTsfpuxyOPOgXYuFEn X-Received: by 2002:a17:90b:f91:b0:28b:f739:7c2a with SMTP id ft17-20020a17090b0f9100b0028bf7397c2amr839063pjb.92.1704902235679; Wed, 10 Jan 2024 07:57:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704902235; cv=none; d=google.com; s=arc-20160816; b=Tw8G9BHKrdH0rG2Y9t9E5JWOc18pWfA3keSWEgf9x8Q2k+u/jkBkabzWkH5YmIl6gI 25BBOKZvd+Su2IPypgoaB/eXiq1l5rXRnn4r1SL0ctHwqIqxTv3ztbjDDGKsst48pBNC p2rlDfzoM4VxMgJCcyWsdFI14w78i1bLpiwvkm2CYkMJSR8g5Odsh4g29jzD1nh/Ol2Q BTkP2Q84xuOFc/hLRmV10uF0lgkUF/ftMpTfyYBk0xMq2bq44ac4rSqqGegqbCzgMb0B TjeYSIAP3+tf3s55v6Pl+Om/JGp5YeoppvCfqyzn3gIXPFYkI+jaHQ8Oeq/jsPV83sdP 62vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BxXwV3/4UrF4VH/LIe2OS2+mwTGeDmtle9sVrffHRzs=; fh=Tg+iK/mtBMU5WI6r3+3lxZk/Qs91S9FQJyDwmQJPOUs=; b=TdDZUGnfidzDULaurZKYvZP2u/dYtdwv1KyKya/Y9drDT0n7a3RxKf5xf/M1WEnXFE XGowczwnuEF0BXaa2Cz3kwCtYae6W9oh32uPsf3vBtQz/rvuiTPEatg+GKEzvHFmhB6r zJEXH26ZCNcPmx6+h3dqRMmqfIORSIZhnLxY1QnEWxmWELy/Tq6jL1d9+OmJQq54Y6do SMYAnNDQPrP37O+Qe4o0/FAyL5sp6nfFTxny+4pSYm+8Z0+XR3V50KMoSkqnStz1c+DT QbR0vXHzqpMhAm7zkNGEbvi+sphMeApS62a8wgPTXYmpmf96nU2RAQdZL04HzyZUutfK gY7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IeDcPZYq; spf=pass (google.com: domain of linux-kernel+bounces-22464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z4-20020a17090abd8400b0028c9e3fefd0si1626278pjr.11.2024.01.10.07.57.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 07:57:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IeDcPZYq; spf=pass (google.com: domain of linux-kernel+bounces-22464-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22464-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A5FC328A9C1 for ; Wed, 10 Jan 2024 15:57:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B0404C3D1; Wed, 10 Jan 2024 15:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IeDcPZYq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 914B84C3C6 for ; Wed, 10 Jan 2024 15:56:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B85F1C433C7; Wed, 10 Jan 2024 15:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704902190; bh=Mev9R+M1cLaYjYBU2ZgT5jQ2ZNfBaieaMpJ0LyeLUqQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IeDcPZYqZH/yosqHy6J0lKKIXTr87XKELYPhOa4vt9rK8HdOlohar0v95Bx8OTdGH qFkCOu0OtN6mz/BohFHwbJekpq/cRig3FNJMy81gq7ZjCx4Q+GqZRFbdFk2LWKfLwU UqW8AC16aRfgHhoGD+CVoZibaW2tuPgF5iuMbzilseJNpgvVjFgYAZrwuFPgEB78OG WV0NkkyJ+qt57r+azS6oThayuTFamklZZWYXTFl52aiYMK+5hVeAsy/CZ3k7mu4Zvw gsotv0QM55jZHaZKlclvTSBRs5wPTZS/GgIMp2z1pttlcZwrYyX+zCDFpfpMi3TWWO PcI2MR49Yy+Rw== Date: Wed, 10 Jan 2024 16:56:27 +0100 From: Maxime Ripard To: =?utf-8?Q?Micha=C5=82?= Winiarski Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Rodrigo Vivi , Michal Wajdeczko , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Javier Martinez Canillas , =?utf-8?B?TWHDrXJh?= Canal Subject: Re: [PATCH v4 6/6] drm/tests: managed: Add a simple test for drmm_managed_release Message-ID: <2mgrb5lrm5oskkcauhdbegdb5jwhqx6unzlaltz6e2bzaqrzyr@dnkbsr3ykj7k> References: <20240105101324.26811-1-michal.winiarski@intel.com> <20240105101324.26811-7-michal.winiarski@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="low44rvsz3fnl7ut" Content-Disposition: inline In-Reply-To: <20240105101324.26811-7-michal.winiarski@intel.com> --low44rvsz3fnl7ut Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 05, 2024 at 11:13:24AM +0100, Micha=C5=82 Winiarski wrote: > Add a simple test that checks whether the action is indeed called right > away and that it is not called on the final drm_dev_put(). >=20 > Signed-off-by: Micha=C5=82 Winiarski > --- > drivers/gpu/drm/tests/drm_managed_test.c | 28 ++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) >=20 > diff --git a/drivers/gpu/drm/tests/drm_managed_test.c b/drivers/gpu/drm/t= ests/drm_managed_test.c > index c1fc1f0aac9b2..91863642efc13 100644 > --- a/drivers/gpu/drm/tests/drm_managed_test.c > +++ b/drivers/gpu/drm/tests/drm_managed_test.c > @@ -41,6 +41,33 @@ static void drm_test_managed_run_action(struct kunit *= test) > KUNIT_EXPECT_TRUE_MSG(test, priv->action_done, "Release action was not = called"); > } > =20 > +/* > + * The test verifies that the release action is called immediately when > + * drmm_release_action is called and that it is not called for a second = time > + * when the device is released. > + */ > +static void drm_test_managed_release_action(struct kunit *test) > +{ > + struct managed_test_priv *priv =3D test->priv; > + int ret; > + > + ret =3D drmm_add_action_or_reset(priv->drm, drm_action, priv); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + ret =3D drm_dev_register(priv->drm, 0); > + KUNIT_ASSERT_EQ(test, ret, 0); > + > + drmm_release_action(priv->drm, drm_action, priv); > + KUNIT_EXPECT_TRUE_MSG(test, priv->action_done, "Release action was not = called"); > + priv->action_done =3D false; > + > + drm_dev_unregister(priv->drm); > + drm_kunit_helper_free_device(test, priv->drm->dev); > + > + KUNIT_EXPECT_FALSE_MSG(test, priv->action_done, > + "Unexpected release action call during cleanup"); > +} > + I guess we can have something simpler if we switch action_done to a counter and just check that the counter didn't increase. And I think the custom messages should be removed there too. Maxime --low44rvsz3fnl7ut Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZZ6+KwAKCRDj7w1vZxhR xTSyAP9WBatDxCR53O+71y/N+u/TGRvmdsq04Tz8iV4qA/vs8wD9E/+kUzgF0hBT sPyni9+ICPNJdDcxH9Yh9B/2rk4Z6AY= =1Mfc -----END PGP SIGNATURE----- --low44rvsz3fnl7ut--