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

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Mar 3 18:04:23 CET 2021


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.



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



More information about the libcamera-devel mailing list