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 DB3ABC00140 for ; Thu, 18 Aug 2022 20:42:12 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/5pF2LKJY7X7rGLWr/gAWENXyTqKVyACw4DREdcus0Y=; b=DMBt9P+vsBHnL9 0F73zl96h2ru+7bj9Pb06FQ4m8W3VeLQKy1C8AR3c6y4Z/Kn2yg1AAIMKBzlD2sf0dUuOMt6nRQMo k5yyg/hHao0cMBDz8Ickt8rXs4Tj7RxX+a5ZYGS+tFm1FTXk2ps4+1RmiHrxtZqyKhPAJwtP4wl5R PhOQtM3PbpoAyl5qPhw566S0WrEH7zfPU7eJJESzKRNKXBec9BIj6rPUrpneuavM3tXC5TIh36gCh hw6s3AgeXC4PKz38O0UpaeatAIkn9rX5Svu9LRDoqMoaAystxvxqYalLhrGT3bTOm9GP5yZEKVIMq ArcO9j87pumLx15ka1cw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOmK6-009L9P-5X; Thu, 18 Aug 2022 20:41:02 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOmJ3-009KM8-Pc for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2022 20:39:59 +0000 Received: from [192.168.2.145] (109-252-119-13.nat.spd-mgts.ru [109.252.119.13]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4BF276601B7A; Thu, 18 Aug 2022 21:39:53 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1660855194; bh=Emk87kB1bYtzutO6QswP9IPNXnW89sucuVH09hsng5k=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Z7Pw0o0gnWPWmZc6NGY0rwGVgWxEM8Ox/f0Qru6PEcbXfg/hpT4nECwSEvaHNKWcN PCtD7bI01TG92ZmmgESKi8+aWT5bnRDIwQKiIaBJf7Vh+GrSJCyJ/YKma3nCKrqnss JGWIYuupLKiRqrFb6IbpeF92NR364iucQjlajtAjTlli/e/gkJbUfqHH9oytV6HNQ0 T6MovmAhiaSuR4nhkiveLcQrfcyE1RazFKffiDoNbKZJtc+ePQLnEBnhxwkCsd5a5z j7uwLfTmid70TJ2r/ayvb9JiKiNj7iuUsxg0nZ+PmeQ708Q2aCSNNgD35MvEjK+Jbi AW/6meAPhrgmQ== Message-ID: <2182ae07-4c0a-5937-7acc-3fad68d28baa@collabora.com> Date: Thu, 18 Aug 2022 23:39:50 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v1 3/3] media: cedrus: Fix endless loop in cedrus_h265_skip_bits() Content-Language: en-US To: Nicolas Dufresne , linux-media@vger.kernel.org, Maxime Ripard , Paul Kocialkowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: 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 References: <20220818203308.439043-1-nicolas.dufresne@collabora.com> <20220818203308.439043-4-nicolas.dufresne@collabora.com> From: Dmitry Osipenko In-Reply-To: <20220818203308.439043-4-nicolas.dufresne@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_133958_077850_5F5EB974 X-CRM114-Status: GOOD ( 21.44 ) 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/18/22 23:33, Nicolas Dufresne wrote: > From: Dmitry Osipenko > > The busy status bit may never de-assert if number of programmed skip > bits is incorrect, resulting in a kernel hang because the bit is polled > endlessly in the code. Fix it by adding timeout for the bit-polling. > This problem is reproducible by setting the data_bit_offset field of > the HEVC slice params to a wrong value by userspace. > > Cc: stable@vger.kernel.org > Reported-by: Nicolas Dufresne > Signed-off-by: Dmitry Osipenko > Signed-off-by: Nicolas Dufresne > --- > drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c > index f703c585d91c5..f0bc118021b0a 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c > @@ -227,6 +227,7 @@ static void cedrus_h265_pred_weight_write(struct cedrus_dev *dev, > static void cedrus_h265_skip_bits(struct cedrus_dev *dev, int num) > { > int count = 0; > + u32 reg; This "reg" variable isn't needed anymore after switching to cedrus_wait_for(). Sorry, I missed it :) > while (count < num) { > int tmp = min(num - count, 32); > @@ -234,8 +235,9 @@ static void cedrus_h265_skip_bits(struct cedrus_dev *dev, int num) > cedrus_write(dev, VE_DEC_H265_TRIGGER, > VE_DEC_H265_TRIGGER_FLUSH_BITS | > VE_DEC_H265_TRIGGER_TYPE_N_BITS(tmp)); > - while (cedrus_read(dev, VE_DEC_H265_STATUS) & VE_DEC_H265_STATUS_VLD_BUSY) > - udelay(1); > + > + if (cedrus_wait_for(dev, VE_DEC_H265_STATUS, VE_DEC_H265_STATUS_VLD_BUSY)) > + dev_err_ratelimited(dev->dev, "timed out waiting to skip bits\n"); > > count += tmp; > } -- Best regards, Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel