From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92ABEC28D13 for ; Mon, 22 Aug 2022 08:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sMeZ3x2FhzYs7+3LXOmbg9oNXEKOm8dk8MdbbbN+1M0=; b=vHB7tkaVJ9H9iFoG4JeLGX95yN bO63b/0MVKcKy6Hh+E3/Bh+tvtSbKbI/QP4kmoMv2Y2lHyA48CikmigpVP0Oh7c1/6fbqrmZBkNH1 jlFSzUhrqO4fs78N+RjyX8Ya8LUZA5SKT4yMXfvkjad2EsmLF0q5Kh9P2SclwdEHzDgo7USCe85a8 QgCAwdRjMDBMImWSum152o/GBAS1G0aYs3K48WczX3zjmv/ESXkx+doxP4b1utvAXSeUdqCfxL1LJ W98JlyJIobWJNEM16ZSaQR8lXhtwo5vJehKz/fub2EgPAACWGbmrlZyp2xo0bC4u/wP74g7+9wqY2 my4F1XXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ2X3-006Juf-DT; Mon, 22 Aug 2022 08:11:38 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ2Q2-006FPg-JC for linux-arm-kernel@lists.infradead.org; Mon, 22 Aug 2022 08:04:28 +0000 Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 915AE40002; Mon, 22 Aug 2022 08:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661155456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Af8UEwDVr1WeGoIs7qSh0v1VGOmRYqe15mtkRmwM7uI=; b=F6wrILK6/Vtb/q8w5hOXTvAsOa3WjkHRwEnPve2X3KrHfH1qA61FhjSKDyZrYWPg/yj3hV HFTOtY/Qu8Oi/VWaorVVxt+27huAxDuUSodv34SjWC99G4DvSZsti2lCCk6e5iuFlaGmVI CC/4b6m2ZoRNFAgueszlc7rX4iTGBqthYkeqISeAR63AkgPINL78Z39GLMOZ8E48S6xDDX r0LdNf7sudzs+grPZ4SfAQ/EyhF1WsoDGHH0DEri8U2IBF0eN26CSmi9MUPkfVJ9PrGcLy 6a98B4isZpl/21k/Gu+HCnMnXl05BE2SSMjW5YzQFVacOl+NsOMh9tsh291t5A== Date: Mon, 22 Aug 2022 10:04:09 +0200 From: Paul Kocialkowski To: Nicolas Dufresne Cc: linux-media@vger.kernel.org, Maxime Ripard , Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Ezequiel Garcia , Hans Verkuil , kernel@collabora.com, stable@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/3] media: cedrus: Fix watchdog race condition Message-ID: References: <20220818203308.439043-1-nicolas.dufresne@collabora.com> <20220818203308.439043-2-nicolas.dufresne@collabora.com> MIME-Version: 1.0 In-Reply-To: <20220818203308.439043-2-nicolas.dufresne@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220822_010423_490197_6A2FEEEA X-CRM114-Status: GOOD ( 23.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2020468067014723946==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2020468067014723946== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9C9XXDtt+KGo1SiH" Content-Disposition: inline --9C9XXDtt+KGo1SiH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Nicolas, On Thu 18 Aug 22, 16:33, Nicolas Dufresne wrote: > The watchdog needs to be schedule before we trigger the decode > operation, otherwise there is a risk that the decoder IRQ will be > called before we have schedule the watchdog. As a side effect, the > watchdog would never be cancelled and its function would be called > at an inappropriate time. >=20 > This was observed while running Fluster with GStreamer as a backend. > Some programming error would cause the decoder IRQ to be call very > quickly after the trigger. Later calls into the driver would deadlock > due to the unbalanced state. Good catch, thanks! Reviewed-by: Paul Kocialkowski Cheers, Paul > Cc: stable@vger.kernel.org > Fixes: 7c38a551bda1 ("media: cedrus: Add watchdog for job completion") > Signed-off-by: Nicolas Dufresne > --- > drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/st= aging/media/sunxi/cedrus/cedrus_dec.c > index 3b6aa78a2985f..e7f7602a5ab40 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c > @@ -106,11 +106,11 @@ void cedrus_device_run(void *priv) > =20 > /* Trigger decoding if setup went well, bail out otherwise. */ > if (!error) { > - dev->dec_ops[ctx->current_codec]->trigger(ctx); > - > /* Start the watchdog timer. */ > schedule_delayed_work(&dev->watchdog_work, > msecs_to_jiffies(2000)); > + > + dev->dec_ops[ctx->current_codec]->trigger(ctx); > } else { > v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, > ctx->fh.m2m_ctx, > --=20 > 2.37.2 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --9C9XXDtt+KGo1SiH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmMDOHgACgkQ3cLmz3+f v9ENKwf+JRXzzEmrQxZWhfCKskt7uuVhWKW/HBMQrYb3guv4d6PGcqi52+9lyStB 49tTvjlH655bRsQKMEC3DT6Md1inbO6G7CZhH8uAaX43iLx3UgXbI13OCTEfz2V2 CF1UK+Rm/Cv6eZhS7jCml/bOTA058ScUkemASDt61IhDcsjNo1rmKWulkGtiKhl4 Fj+Hq4ut9YLfyb/l5RAVPixiXgsMUye4J0z0ANN8XADhL5pkjLIh+wU9BT4jB3Y6 u9KVVjjwRsux5p78R5jZ9PKhWIbtySCtWWmjK+vsl/+X6jUwcgWUW3tPnxB/JYSI FRlmnT/A5hJvZu8f2xD+DF23Oyv1HA== =7kSt -----END PGP SIGNATURE----- --9C9XXDtt+KGo1SiH-- --===============2020468067014723946== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2020468067014723946==--