Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6131680imu; Mon, 21 Jan 2019 03:50:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN7XrGv9nYTR63NDN6lWqlOt/A2+Lej+cMknlZIpJwDMe6V9al8iHPRT3oJmYLq7/8Uvx2Bk X-Received: by 2002:a63:680a:: with SMTP id d10mr28037686pgc.396.1548071439184; Mon, 21 Jan 2019 03:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548071439; cv=none; d=google.com; s=arc-20160816; b=P+JjoYWuICfs5fwXD+xVTDjM9sKsAw1BZmPpSPTgM9wVZLmr2tn1IVvGqEznLP+atw yiSe3lAo+KG2IExPQHqCURNG9Z/FaaN15HZp7I+zBgFprME2RwQlv0H/h37nkwyg2xvd PRuWRKvNgEs74URLbc2s9OmxwQDq4QwBvm/LKy4mBsrUWKCx2gw5oinM7tnWlrERPdTz pkRPfGdTwFfNCbEsEJxDQkitBpPMJP6HFBRXBW/5S11P2IqSsIjsCOWAPZWliHLRQyee 0PtbMs7KDwOyVcyoGlyyMqSsnI/98MKdlP7i15G8KWIHUX/kQW4BqA2PJJn2hzT/6H+i V99w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=/Q/HkbD8YiYy72sx2/V8PZdX0kIYHicBmtnVPxJvkuI=; b=PVwyfciflWeyjlnDGPxCnUxYeWncELNLYgoCGriyGw72ScJK2h9qQL/A2HC1SPhErS JuBkOXh5MhAVlSZZwCyy6SFlsbg6R7Ue5l1bLJ9O41YXkezjwRuKOIWrOW7gl3DZUC0Y mpNMFXmMNggZT+UidPC8fE+IGd7imoK3YRzWoG2sVAY1FUanh/nq4AJtyLRqJzwIKgA3 IvbVGMaGrTE0u0WZ6EhCmKt6xoYznaB7+OU9v6J0+Kur37waIG42JW/iLZ7zIBCOqd12 zQorAISlaBC8oepRraYe0ULJJn7OaT2RtpH+zch1yu8tar+HFSRECHa2CKA0FCbC6vls 2Ezw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si12968450pgh.469.2019.01.21.03.50.23; Mon, 21 Jan 2019 03:50:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728150AbfAULtT (ORCPT + 99 others); Mon, 21 Jan 2019 06:49:19 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:37645 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727909AbfAULtT (ORCPT ); Mon, 21 Jan 2019 06:49:19 -0500 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1glY4n-0002wv-BW; Mon, 21 Jan 2019 12:49:13 +0100 Message-ID: <1548071350.3287.3.camel@pengutronix.de> Subject: Re: [PATCH v3 1/2] media: imx: csi: Disable SMFC before disabling IDMA channel From: Philipp Zabel To: Steve Longerbeam , linux-media@vger.kernel.org Cc: Gael PORTAY , Peter Seiderer , stable@vger.kernel.org, Mauro Carvalho Chehab , Greg Kroah-Hartman , "open list:STAGING SUBSYSTEM" , open list Date: Mon, 21 Jan 2019 12:49:10 +0100 In-Reply-To: <20190119010457.2623-2-slongerbeam@gmail.com> References: <20190119010457.2623-1-slongerbeam@gmail.com> <20190119010457.2623-2-slongerbeam@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, 2019-01-18 at 17:04 -0800, Steve Longerbeam wrote: > Disable the SMFC before disabling the IDMA channel, instead of after, > in csi_idmac_unsetup(). > > This fixes a complete system hard lockup on the SabreAuto when streaming > from the ADV7180, by repeatedly sending a stream off immediately followed > by stream on: > > while true; do v4l2-ctl -d4 --stream-mmap --stream-count=3; done > > Eventually this either causes the system lockup or EOF timeouts at all > subsequent stream on, until a system reset. > > The lockup occurs when disabling the IDMA channel at stream off. Stopping > the video data stream entering the IDMA channel before disabling the > channel itself appears to be a reliable fix for the hard lockup. That can > be done either by disabling the SMFC or the CSI before disabling the > channel. Disabling the SMFC before the channel is the easiest solution, > so do that. > > Fixes: 4a34ec8e470cb ("[media] media: imx: Add CSI subdev driver") > > Suggested-by: Peter Seiderer > Reported-by: Gaël PORTAY > Signed-off-by: Steve Longerbeam Gaël, could we get a Tested-by: for this as well? > Cc: stable@vger.kernel.org > --- > Changes in v3: > - switch from disabling the CSI before the channel to disabling the > SMFC before the channel. > Changes in v2: > - restore an empty line > - Add Fixes: and Cc: stable > --- > drivers/staging/media/imx/imx-media-csi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c > index e18f58f56dfb..8610027eac97 100644 > --- a/drivers/staging/media/imx/imx-media-csi.c > +++ b/drivers/staging/media/imx/imx-media-csi.c > @@ -560,8 +560,8 @@ static int csi_idmac_setup_channel(struct csi_priv *priv) > static void csi_idmac_unsetup(struct csi_priv *priv, > enum vb2_buffer_state state) > { > - ipu_idmac_disable_channel(priv->idmac_ch); > ipu_smfc_disable(priv->smfc); > + ipu_idmac_disable_channel(priv->idmac_ch); Steve, do you have any theory why this helps? It's a bit weird to disable the SMFC module while the DMA channel is still enabled. I think this warrants a big comment, given that enable order is SMFC_EN before IDMAC channel enable. Also ipu_smfc_disable is refcounted, so if the other CSI is capturing simultaneously, this change has no effect. FWIW, I don't see any regressions though. regards Philipp