Re: [PATCH v2 2/2] media: i2c: Add driver for IMX519 sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Kieran Bingham (2022-11-03 17:27:56)
> Hi Lee,
> 
> Quoting lee (2022-11-03 03:14:27)
> > Adds a driver for the 16MPix IMX519 CSI2 sensor.
> > Whilst the sensor supports 2 or 4 CSI2 data lanes, this driver
> > currently only supports 2 lanes.
> > 
> > The following Bayer modes are currently available:
> > 
> > 4656x3496 10-bit @ 10fps
> > 3840x2160 10-bit (cropped) @ 21fps
> > 2328x1748 10-bit (binned) @ 30fps
> > 1920x1080 10-bit (cropped/binned) @ 60fps
> > 1280x720 10-bit (cropped/binned) @ 120fps
> > 
> > Signed-off-by: Lee Jackson <lee@xxxxxxxxxxx>

<snip>

> > +static const struct v4l2_ctrl_ops imx519_ctrl_ops = {
> > +       .s_ctrl = imx519_set_ctrl,
> > +};
> > +
> > +static int imx519_enum_mbus_code(struct v4l2_subdev *sd,
> > +                                struct v4l2_subdev_state *sd_state,
> > +                                struct v4l2_subdev_mbus_code_enum *code)
> > +{
> > +       struct imx519 *imx519 = to_imx519(sd);
> > +
> > +       mutex_lock(&imx519->mutex);
> > +
> > +       if (code->index > 0)
> > +               return -EINVAL;

In fact, this code path returns keeping the lock held ...

I suspect this is the cause of the deadlocks I've seen...

> > +
> > +       code->code = imx519_get_format_code(imx519);
> > +
> > +       mutex_unlock(&imx519->mutex);
> > +
> > +       return 0;
> > +}
> > +
> > +static int imx519_enum_frame_size(struct v4l2_subdev *sd,
> > +                                 struct v4l2_subdev_state *sd_state,
> > +                                 struct v4l2_subdev_frame_size_enum *fse)
> > +{
> > +       struct imx519 *imx519 = to_imx519(sd);
> > +
> > +       mutex_lock(&imx519->mutex);
> 
> I've hit a deadlock here.
> 
> [  139.389907] other info that might help us debug this:
> [  139.396435]  Possible unsafe locking scenario:
> [  139.396435]
> [  139.402353]        CPU0
> [  139.404797]        ----
> [  139.407243]   lock(&imx519->mutex);
> [  139.410737]   lock(&imx519->mutex);
> [  139.414230]
> [  139.414230]  *** DEADLOCK ***
> [  139.414230]
> [  139.420148]  May be due to missing lock nesting notation
> [  139.420148]
> [  139.426936] 1 lock held by cam/924:
> [  139.430425]  #0: ffff000003feb460 (&imx519->mutex){+.+.}-{3:3}, at: imx519_enum_mbus_code+0x3

Which should have been obvious if I just read ^^^ that line ;-)

--
Kieran




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux