Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3743719imu; Fri, 18 Jan 2019 16:40:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN49VgSlJIi+d1Iy8uBFXPTTCcunc/38e/XKre+pnKtomSGCV2BNeHFShzBEKM/gmCtnG3h7 X-Received: by 2002:a17:902:346:: with SMTP id 64mr21677675pld.337.1547858442338; Fri, 18 Jan 2019 16:40:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547858442; cv=none; d=google.com; s=arc-20160816; b=X7nYvitT8g9wlfBRL1ztTt4DrxdfCURDQ9k7q5hJs5zBdmI9/fP2T1xj3fKQhtJRQX Mcn4SOCVDFxGTMohm++8KLRmbQkxfwrL2Ef5CJLW0NKAWYDKs4czZnZEV74VeJ+9xMPA ppKGmIsQotBoZr3VNW7KiTyH75OTIBmJjvyK+wvnvpwe83a0iWSCY1Tg3eb18zoeo5CI cChAbJIGjX1lVfXAZwm3DRrTm9hkTcpHP+LIDZWDRaBKorliIDBVzqsRDLcbnMge9GBM TA+rrh20HI91sd0LiCNRtAMzXLJfEFicob0q7AeOqIVLRRDzFmWhFLUF6RGJdbTXXJaU YIbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=pGtv4QsqOw+uu7zVP/Z08n0sfIMqmOsdBWC5cFt1gTA=; b=DiyhLjHblLVYPQXzAWheoiSf+eGHtmkVmVNfdTHrUXq1S3Qa3+B0BVR/RxtZVBQsCQ 0qyZeQuQ9KCJ2tXYYZJnGiFAZky9Cy74ve4zqh3fbzZzrLy9mm/NvYzhI1p9COXzyVd3 KdL6B0cXEP1Gv5jdiaAwyK1M88rPsQ7M9UmgpZxSjPpEJ2L2NC8s+PCYu5X8ApHR5EYz Yam/rKFY6UoqyppL/xnOyrEOhOutgvpkIsy8uWlnAZKOYc65BWMAYcWD7EXXPwVWsFlv kiGNI6GAYtqyb1NuLTanpKON6DcdinYteJD0Afkz3nAW8ZsGoDwGuomH+vLq56I48pcT mOmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sqaT+u7K; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l129si1199214pfl.284.2019.01.18.16.40.26; Fri, 18 Jan 2019 16:40:42 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sqaT+u7K; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730293AbfASAiV (ORCPT + 99 others); Fri, 18 Jan 2019 19:38:21 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37303 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730114AbfASAiU (ORCPT ); Fri, 18 Jan 2019 19:38:20 -0500 Received: by mail-wm1-f66.google.com with SMTP id g67so6062195wmd.2; Fri, 18 Jan 2019 16:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=pGtv4QsqOw+uu7zVP/Z08n0sfIMqmOsdBWC5cFt1gTA=; b=sqaT+u7K8tAJ2vrCTWLAmAVZkn2u3ILIqbAb/xhK0WFUGJqHkd71CL8LaKf+6EM3GR C0LvuQ43exOsm+89vDA3k5krOrbpcVogwBCiuEnWKsy44Bb79bP5eH2iUSnXZX2AK6xd NlwN6xN6jOrfoQJa7NxANYaMzuH/ajiWyrC00ng7RHmxDZ0ZGkTcF8uOoaBJsEXi3srT zAgHsJI4NxiHYAv8Q0AlCdUIJQMcBijyQOe2Y5GqJ621AOscp6fix9ZCcG8hLDJXh45u 1kHGQ+yc+C5YEG006JyCoLj47AEqCY9OyunL49hLugoj8k87LDUj3TeaV/JXaRSLsBIO BO+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=pGtv4QsqOw+uu7zVP/Z08n0sfIMqmOsdBWC5cFt1gTA=; b=RIoVu5pmbcTVOG7PjTFA57JsjZKnJkjabED1XtAyad5jh/Ehlo3cWQgS6tbBqfDea4 XlXrJbyNjHsHKKbRLR+0cLbKl+Sjs432zuSbujwMGQU8ajFcN+23asSnU63PaoNX952z mJfx+NXAnr4Gcrdufrn6cSzfS9hjsT2xG6SkzHTfanntR7DajTam0hBLqbXw2ZIdoRoU QknZBu97j+domL/GygU6X5uysPJsFh8IPzF3OnoTge8//HhCt3HK5cRFfDx3ToAHkL+J rkQXbU1WcUM5m9ggfj9NO0JLzb5Y01HCDM4buPPgVwZMneUYzPcul21+sQFuDGPgRG/D 0DAw== X-Gm-Message-State: AJcUukf2nTp2oi3+wD43D+Z3HAIKQkUsYaKXnsIhbMb3bbzdNzd1cLIJ aH6Is+iqxfAdDXa6mmFJtPU= X-Received: by 2002:a1c:dd04:: with SMTP id u4mr17159449wmg.84.1547858298418; Fri, 18 Jan 2019 16:38:18 -0800 (PST) Received: from [172.30.88.68] (sjewanfw1-nat.mentorg.com. [139.181.7.34]) by smtp.gmail.com with ESMTPSA id y34sm235363566wrd.68.2019.01.18.16.38.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 16:38:17 -0800 (PST) Subject: Re: [PATCH v2 1/2] media: imx: csi: Disable CSI immediately after last EOF From: Steve Longerbeam To: Philipp Zabel , linux-media@vger.kernel.org Cc: stable@vger.kernel.org, Mauro Carvalho Chehab , Greg Kroah-Hartman , "open list:STAGING SUBSYSTEM" , open list , Peter Seiderer , =?UTF-8?Q?Ga=c3=abl_PORTAY?= References: <20190117204912.28456-1-slongerbeam@gmail.com> <20190117204912.28456-2-slongerbeam@gmail.com> <1547807043.3375.3.camel@pengutronix.de> <56b43909-136b-fce0-e743-26cd6afd0eea@gmail.com> Message-ID: <77c399a3-4b21-385f-9d62-aa30f5c89d2f@gmail.com> Date: Fri, 18 Jan 2019 16:38:13 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <56b43909-136b-fce0-e743-26cd6afd0eea@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/18/19 11:01 AM, Steve Longerbeam wrote: > > > On 1/18/19 2:24 AM, Philipp Zabel wrote: >> On Thu, 2019-01-17 at 12:49 -0800, Steve Longerbeam wrote: >>> Disable the CSI immediately after receiving the last EOF before stream >>> off (and thus before disabling the IDMA channel). >>> >>> 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. >>> Disabling >>> the CSI before disabling the IDMA channel appears to be a reliable >>> fix for >>> the hard lockup. >>> >>> Fixes: 4a34ec8e470cb ("[media] media: imx: Add CSI subdev driver") >>> >>> Reported-by: Gaël PORTAY >>> Signed-off-by: Steve Longerbeam >>> Cc: stable@vger.kernel.org >>> --- >>> Changes in v2: >>> - restore an empty line >>> - Add Fixes: and Cc: stable >>> --- >>>   drivers/staging/media/imx/imx-media-csi.c | 6 ++++-- >>>   1 file changed, 4 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/staging/media/imx/imx-media-csi.c >>> b/drivers/staging/media/imx/imx-media-csi.c >>> index e18f58f56dfb..e0f6f88e2e70 100644 >>> --- a/drivers/staging/media/imx/imx-media-csi.c >>> +++ b/drivers/staging/media/imx/imx-media-csi.c >>> @@ -681,6 +681,8 @@ static void csi_idmac_stop(struct csi_priv *priv) >>>       if (ret == 0) >>>           v4l2_warn(&priv->sd, "wait last EOF timeout\n"); >>>   +    ipu_csi_disable(priv->csi); >>> + >> Can you add a short comment why this call is here? Since now >> csi_idmac_stop is kind of a misnomer and symmetry with csi(_idmac)_start >> is broken, I think this is a bit un-obvious. > > Yeah. I think a cleaner, more symmetric solution would be to split up > csi_idmac_stop. > >> >> Also note that now the error path of csi_start() will now call >> ipu_csi_disable() while the CSI is disabled. This happens to work >> because that just calls ipu_module_disable(), which is not refcounted. > > Thanks for catching. Splitting up csi_idmac_stop will fix this. > Working on that. Well turns out Peter Seiderer kindly provided a solution they have been using for some time on custom imx6 hardware. His solution is to disable the SMFC before the IDMA channel, which I have tested on the SabreAuto and also works. This is a much simpler change, so I will post v3 that does this instead. Steve