Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1035843rwe; Thu, 25 Aug 2022 14:08:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ufQueKrKwkTsRDFgEfohKQ4o5AjaMbjUoAtLlVERGZrf++BxKvAX7eGRuhL9fy7X7IAjl X-Received: by 2002:a17:906:4787:b0:734:1ad4:aff0 with SMTP id cw7-20020a170906478700b007341ad4aff0mr3484928ejc.317.1661461709427; Thu, 25 Aug 2022 14:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661461709; cv=none; d=google.com; s=arc-20160816; b=jGRKjPTCBqYM9upgmkndAWb/1GhJ179AEWk7aXoX6yJt/3kMp0s3IdMZ+VxRue1/sq u6Amlot1xWPgwd9CVj+NnoVYWuIoCx2xoT4EEWTYz+kcvapFWSAjs0gLfcrhuOgaPuZ9 hwkZZ0wh4eJTJ9UTghSwDn89ruNjGYqj6Q8byhE/Ti4e42We2vK3FaSPuFpfBYPRsu1r OKnggnzOlvkaTYPmp2DBbiSMWGAJy4f+I+NaLCiaMj3TFFOGrnatXVbg3wtAlJW1JTj8 Tf/eivGBUhcHzsvHK+al4xiDPECmqvWQkpeyJLVMtWcCaMhy3ZtVqHmb/lZrGeYCBs5b Tf1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oLKhkirV3w4L2ZpLtqGDyVCrVsxu0uPLz0/+c0FrP44=; b=0KLUV21Ez9aNNE82gcpfH5R54q/YeWjcyVKTvEF02WCVUOtQntVkCyhQomO15W4HfE hfO/BUdKX5csPzNtS8Jwn3k7UB/IdHsjNdP67ILLB3k7dcnb28jv1g9piVBXFcbZM2ah 6VCtyllL6+boxvvaxzVbXvTVHSJCvmf2tT2RDQbDz1sZa0CRCLdeM/OIGvMdlb4qzXVI i6Ka3aIwUCK6QWqW5d2OI/naE8Ot+xxKlwesMRUgGiqeWKO7p8aRtIoidJnLOvVwOWqx 8Dv88VIOHMIJhkMbxocV/uZOdgvN6p1dlfimW7tKcdtnvc//iNSRiPzikwfw8L473LeG bzQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cvHGeIXH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402270c00b00445dc9e0dbbsi283220edd.425.2022.08.25.14.08.00; Thu, 25 Aug 2022 14:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cvHGeIXH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbiHYVC4 (ORCPT + 99 others); Thu, 25 Aug 2022 17:02:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243575AbiHYVCk (ORCPT ); Thu, 25 Aug 2022 17:02:40 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEAECB14F1; Thu, 25 Aug 2022 14:02:39 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id h204-20020a1c21d5000000b003a5b467c3abso3356025wmh.5; Thu, 25 Aug 2022 14:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=oLKhkirV3w4L2ZpLtqGDyVCrVsxu0uPLz0/+c0FrP44=; b=cvHGeIXHYzFMNUpkQTBDkSniG2v59mghDuSFV0tkUtvEoW+OcczMmvv9OQ5xC4rS56 fr2ynukpR+2LGPbaDEjzEZi1uCf2uyrHgIHbfOYpNuZ7oiHMCIRUNzgucdgHA6fHxZ75 OvITw0Knx5/j+DXdZtiM+w9cHWUZmGCZpf7Lw3pkX7ATiUElQsCDQnhIGsmbZqIadcT5 tsLiGmdYSrgbcJVNXPDbFTdmF/dqFqQMjKpug6IPbzHNnoohsn0YNGM3Nfo9huB1ECeS DmYZ5NBmjiEO12CdKSnS+AjHjxSojhdbWVQbCelhDnlNafwUSVCCIRSsvkDkmq2m3b3W Ndjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=oLKhkirV3w4L2ZpLtqGDyVCrVsxu0uPLz0/+c0FrP44=; b=KaVRAAO2QJ0tpe00u1tr6eV4S5rvsc2EPkcr5MD+WpJLNJEC1jCgBxjwh33R98X2OW w6gc7Zy1drmgaEMI0UUL13u1o65YiRMZEufTiMsrsQ9aBB16qyKl5uF8IPA4oraNfT9U CL0mr2YjguO7rogfxHrZximx+T07ArclEa4C9j9F0i1lm+H3Q7AD+KH4YKEUIeQIUm83 dNqgkYCz493Km6gA6HP6RtBfqUG2FSsEnln4/XLyeMmY5vFDjQ2NsBffcJqV6fw3+Si/ dJrWa/K48ULrTYtrIGHf9dtNiyOzPhv9pV5F+tJ+1ZqXtEuWQJfyej1U/rNLrZUxyHXl yxGA== X-Gm-Message-State: ACgBeo3cBwqtIqUVLBlkD8buXef2MhM3e+79Ay8vK4tnd0mVujd4uYeB m8kRi2j3PrjhyR0veXAmlcvNgykUErkH/A== X-Received: by 2002:a05:600c:a09:b0:3a6:8900:c651 with SMTP id z9-20020a05600c0a0900b003a68900c651mr3343962wmp.145.1661461358339; Thu, 25 Aug 2022 14:02:38 -0700 (PDT) Received: from kista.localnet (82-149-1-172.dynamic.telemach.net. [82.149.1.172]) by smtp.gmail.com with ESMTPSA id ib6-20020a05600ca14600b003a62400724bsm534290wmb.0.2022.08.25.14.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 14:02:37 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: linux-media@vger.kernel.org, Maxime Ripard , Paul Kocialkowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Samuel Holland , Ezequiel Garcia , Hans Verkuil , Nicolas Dufresne Cc: kernel@collabora.com, Nicolas Dufresne , 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 Date: Thu, 25 Aug 2022 23:02:36 +0200 Message-ID: <7418676.EvYhyI6sBW@kista> In-Reply-To: <20220818203308.439043-2-nicolas.dufresne@collabora.com> References: <20220818203308.439043-1-nicolas.dufresne@collabora.com> <20220818203308.439043-2-nicolas.dufresne@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dne =C4=8Detrtek, 18. avgust 2022 ob 22:33:06 CEST je Nicolas Dufresne napi= sal(a): > 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. >=20 > Cc: stable@vger.kernel.org > Fixes: 7c38a551bda1 ("media: cedrus: Add watchdog for job completion") > Signed-off-by: Nicolas Dufresne Reviewed-by: Jernej Skrabec Best regards, Jernej > --- > 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/staging/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, > -- > 2.37.2