mbox series

[v4,0/3] media: imx: Stop stream before disabling IDMA channels

Message ID 20190121233552.20001-1-slongerbeam@gmail.com (mailing list archive)
Headers show
Series media: imx: Stop stream before disabling IDMA channels | expand

Message

Steve Longerbeam Jan. 21, 2019, 11:35 p.m. UTC
Repeatedly sending a stream off immediately followed by stream on can
eventually cause a complete system hard lockup on the SabreAuto when
streaming from the ADV7180:

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 channels 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.

In the CSI subdevice, this can be done by disabling the CSI before
disabling the CSI IDMA channel, instead of after. In the IC-PRPENVVF
subdevice, this can be done by stopping upstream before disabling the
PRPENC/VF IDMA channel.

History:
v4:
- Disabling SMFC will have no effect if both CSI's are streaming. So
  go back to disabling CSI before channel as in v2, but split up
  csi_idmac_stop such that ipu_csi_disable can still be called within
  csi_stop.

v3:
- Switch to disabling the SMFC before the channel, instead of the CSI
  before the channel.

v2:
- Whitespace fixes
- Add Fixes: and Cc: stable@vger.kernel.org
- No functional changes.


Steve Longerbeam (3):
  media: imx: csi: Disable CSI immediately after last EOF
  media: imx: csi: Stop upstream before disabling IDMA channel
  media: imx: prpencvf: Stop upstream before disabling IDMA channel

 drivers/staging/media/imx/imx-ic-prpencvf.c | 26 ++++++++-----
 drivers/staging/media/imx/imx-media-csi.c   | 42 +++++++++++++--------
 2 files changed, 44 insertions(+), 24 deletions(-)

Comments

Hans Verkuil Jan. 22, 2019, 7:34 a.m. UTC | #1
Hi Steve,

On 01/22/2019 12:35 AM, Steve Longerbeam wrote:
> Repeatedly sending a stream off immediately followed by stream on can
> eventually cause a complete system hard lockup on the SabreAuto when
> streaming from the ADV7180:
> 
> 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 channels 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.
> 
> In the CSI subdevice, this can be done by disabling the CSI before
> disabling the CSI IDMA channel, instead of after. In the IC-PRPENVVF
> subdevice, this can be done by stopping upstream before disabling the
> PRPENC/VF IDMA channel.

Please let me know when you are satisfied with this patch series and I
can make a pull request for this.

Thanks!

	Hans

> 
> History:
> v4:
> - Disabling SMFC will have no effect if both CSI's are streaming. So
>   go back to disabling CSI before channel as in v2, but split up
>   csi_idmac_stop such that ipu_csi_disable can still be called within
>   csi_stop.
> 
> v3:
> - Switch to disabling the SMFC before the channel, instead of the CSI
>   before the channel.
> 
> v2:
> - Whitespace fixes
> - Add Fixes: and Cc: stable@vger.kernel.org
> - No functional changes.
> 
> 
> Steve Longerbeam (3):
>   media: imx: csi: Disable CSI immediately after last EOF
>   media: imx: csi: Stop upstream before disabling IDMA channel
>   media: imx: prpencvf: Stop upstream before disabling IDMA channel
> 
>  drivers/staging/media/imx/imx-ic-prpencvf.c | 26 ++++++++-----
>  drivers/staging/media/imx/imx-media-csi.c   | 42 +++++++++++++--------
>  2 files changed, 44 insertions(+), 24 deletions(-)
>
Gaƫl PORTAY Jan. 22, 2019, 2:45 p.m. UTC | #2
Steve,

On Mon, Jan 21, 2019 at 03:35:49PM -0800, Steve Longerbeam wrote:
> Repeatedly sending a stream off immediately followed by stream on can
> eventually cause a complete system hard lockup on the SabreAuto when
> streaming from the ADV7180:
> 
> 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 channels 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.
> 
> In the CSI subdevice, this can be done by disabling the CSI before
> disabling the CSI IDMA channel, instead of after. In the IC-PRPENVVF
> subdevice, this can be done by stopping upstream before disabling the
> PRPENC/VF IDMA channel.
> 
> History:
> v4:
> - Disabling SMFC will have no effect if both CSI's are streaming. So
>   go back to disabling CSI before channel as in v2, but split up
>   csi_idmac_stop such that ipu_csi_disable can still be called within
>   csi_stop.
> 
> v3:
> - Switch to disabling the SMFC before the channel, instead of the CSI
>   before the channel.
> 
> v2:
> - Whitespace fixes
> - Add Fixes: and Cc: stable@vger.kernel.org
> - No functional changes.
> 
> 
> Steve Longerbeam (3):
>   media: imx: csi: Disable CSI immediately after last EOF
>   media: imx: csi: Stop upstream before disabling IDMA channel
>   media: imx: prpencvf: Stop upstream before disabling IDMA channel
> 
>  drivers/staging/media/imx/imx-ic-prpencvf.c | 26 ++++++++-----
>  drivers/staging/media/imx/imx-media-csi.c   | 42 +++++++++++++--------
>  2 files changed, 44 insertions(+), 24 deletions(-)
> 
> -- 
> 2.17.1
> 

The system is still up and running this morning after a whole night long
of tests.

You have my Tested-by.

Thanks,
Gael
Steve Longerbeam Jan. 27, 2019, 10:41 p.m. UTC | #3
Hi Hans,

On 1/21/19 11:34 PM, Hans Verkuil wrote:
> Hi Steve,
>
> On 01/22/2019 12:35 AM, Steve Longerbeam wrote:
>> Repeatedly sending a stream off immediately followed by stream on can
>> eventually cause a complete system hard lockup on the SabreAuto when
>> streaming from the ADV7180:
>>
>> 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 channels 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.
>>
>> In the CSI subdevice, this can be done by disabling the CSI before
>> disabling the CSI IDMA channel, instead of after. In the IC-PRPENVVF
>> subdevice, this can be done by stopping upstream before disabling the
>> PRPENC/VF IDMA channel.
> Please let me know when you are satisfied with this patch series and I
> can make a pull request for this.

I'm satisfied with it now, it addresses Philipp's concerns from v3.

Also Gael reported successful testing.

Steve


>
> Thanks!
>
> 	Hans
>
>> History:
>> v4:
>> - Disabling SMFC will have no effect if both CSI's are streaming. So
>>    go back to disabling CSI before channel as in v2, but split up
>>    csi_idmac_stop such that ipu_csi_disable can still be called within
>>    csi_stop.
>>
>> v3:
>> - Switch to disabling the SMFC before the channel, instead of the CSI
>>    before the channel.
>>
>> v2:
>> - Whitespace fixes
>> - Add Fixes: and Cc: stable@vger.kernel.org
>> - No functional changes.
>>
>>
>> Steve Longerbeam (3):
>>    media: imx: csi: Disable CSI immediately after last EOF
>>    media: imx: csi: Stop upstream before disabling IDMA channel
>>    media: imx: prpencvf: Stop upstream before disabling IDMA channel
>>
>>   drivers/staging/media/imx/imx-ic-prpencvf.c | 26 ++++++++-----
>>   drivers/staging/media/imx/imx-media-csi.c   | 42 +++++++++++++--------
>>   2 files changed, 44 insertions(+), 24 deletions(-)
>>