[libcamera-devel] [PATCH 0/3] IPU3 Stability

Jacopo Mondi jacopo at jmondi.org
Fri Mar 5 20:45:09 CET 2021


Hi Kieran

On Wed, Mar 03, 2021 at 05:04:23PM +0000, Kieran Bingham wrote:
> While working on the IPU3 IPA, some crashes have been occuring on
> shutdown races.
>
> Patches 2/3 and 3/3 at least presently work around those issues, and
> while they may be suitable for integration now - both suggest that more
> work is needed to ensure that the IPU3 pipeline handler is stable and
> implemented correctly.
>
> Patch 2/3 highlights that we may need to take more concern over the
> lifetime management of a Request and the associated FrameInfo that is
> supported with that.
>
> Patch 3/3 shows that the IPU3 Pipeline handler is queueing buffers after
> it has released the buffers on the video nodes, and needs further
> consideration as well (though I beleive that patch is still worthy of
> integration on it's own).
>
> The issue leading to what would be a crash without patch 3/3 is when
> shutting down, the IPA running in parallel can emit an event from:
>  void IPU3CameraData::queueFrameAction()
> as
>
>   case ipa::ipu3::ActionParamFilled:
>
> which then goes on to queue a buffer to the three relevant V4L2 devices:
>
> 	imgu_->param_->queueBuffer(info->paramBuffer);
> 	imgu_->stat_->queueBuffer(info->statBuffer);
> 	imgu_->input_->queueBuffer(info->rawBuffer);
>
>
> This is occuring after those devices have released their buffers, and
> thus the v4l2 buffer cache (cache_) is deleted and set to nullptr,
> resulting in a segmentation fault within the V4L2VideoDevice otherwise.

I've been running these patches in my tree for a few days and indeed I
haven't noticed the nasty segfaults I've been having before when
running CTS on IPU3.

For the series
Tested-by: Jacopo Mondi <jacopo at jmondi.org>

I'll review patches singularly next

Thanks
  j

>
>
>
> Kieran Bingham (3):
>   libcamera: pipeline: ipu3: Fix spelling error
>   libcamera: pipeline: ipu3: Ensure that IPU3Frames::info is not used
>     after delete
>   libcamera: v4l2_videodevice: Prevent queueing buffers without a cache
>
>  src/libcamera/pipeline/ipu3/frames.cpp |  2 +-
>  src/libcamera/pipeline/ipu3/ipu3.cpp   | 20 ++++++++++++++++++--
>  src/libcamera/v4l2_videodevice.cpp     | 10 ++++++++++
>  3 files changed, 29 insertions(+), 3 deletions(-)
>
> --
> 2.25.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list