Hi Hans, On 5/24/2023 8:14 PM, Hans Verkuil wrote: > On 24/05/2023 16:29, Bryan O'Donoghue wrote: >> On 24/05/2023 15:12, Sergey Senozhatsky wrote: >>> Video device has to provide ->lock so that __video_do_ioctl() >>> can serialize IOCTL calls. Provided dedicated enc/dec mutex-s >>> for that purpose. >>> >>> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> > > Since these are m2m devices, I think this should set vfh->m2m_ctx->q_lock > instead. > > The vb2_queue is per filehandle for such devices, so by just setting > vdev->lock you will have all vb2_queues use the same mutex. > > Instead the struct v4l2_m2m_ctx q_lock pointer, if set, will use that > mutex for all vb2 operations. Recently we came across a race between queryctrl and s_fmt. Above lock would synchronize the operations for IOCTL with flag INFO_FL_QUEUE. Any suggestion on how other IOCTLs can be serialized as well, for ex s_fmt and queryctrl which are of type INFO_FL_PRIO and INFO_FL_CTRL. Thanks, Vikash > I think you can set it to the 'lock' mutex in struct venus_inst. > > Regards, > > Hans