mbox series

[v6,0/5] media: uvcvideo: Two +1 fixes for async controls

Message ID 20241203-uvc-fix-async-v6-0-26c867231118@chromium.org (mailing list archive)
Headers show
Series media: uvcvideo: Two +1 fixes for async controls | expand

Message

Ricardo Ribalda Dec. 3, 2024, 9:20 p.m. UTC
This patchset fixes two +1 bugs with the async controls for the uvc driver.

They were found while implementing the granular PM, but I am sending
them as a separate patches, so they can be reviewed sooner. They fix
real issues in the driver that need to be taken care.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v6:
- Swap order of patches
- Use uvc_ctrl_set_handle again
- Move loaded=0 to uvc_ctrl_status_event()
- Link to v5: https://lore.kernel.org/r/20241202-uvc-fix-async-v5-0-6658c1fe312b@chromium.org

Changes in v5:
- Move set handle to the entity_commit
- Replace uvc_ctrl_set_handle with get/put_handle.
- Add a patch to flush the cache of async controls.
- Link to v4: https://lore.kernel.org/r/20241129-uvc-fix-async-v4-0-f23784dba80f@chromium.org

Changes in v4:
- Fix implementation of uvc_ctrl_set_handle.
- Link to v3: https://lore.kernel.org/r/20241129-uvc-fix-async-v3-0-ab675ce66db7@chromium.org

Changes in v3:
- change again! order of patches.
- Introduce uvc_ctrl_set_handle.
- Do not change ctrl->handle if it is not NULL.

Changes in v2:
- Annotate lockdep
- ctrl->handle != handle
- Change order of patches
- Move documentation of mutex
- Link to v1: https://lore.kernel.org/r/20241127-uvc-fix-async-v1-0-eb8722531b8c@chromium.org

---
Ricardo Ribalda (5):
      media: uvcvideo: Only save async fh if success
      media: uvcvideo: Remove redundant NULL assignment
      media: uvcvideo: Remove dangling pointers
      media: uvcvideo: Annotate lock requirements for uvc_ctrl_set
      media: uvcvideo: Flush the control cache when we get an event

 drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++++++++++++++++++------
 drivers/media/usb/uvc/uvc_v4l2.c |  2 +
 drivers/media/usb/uvc/uvcvideo.h |  9 ++++-
 3 files changed, 82 insertions(+), 12 deletions(-)
---
base-commit: 291a8d98186f0a704cb954855d2ae3233971f07d
change-id: 20241127-uvc-fix-async-2c9d40413ad8

Best regards,

Comments

Hans de Goede Dec. 9, 2024, 11:01 a.m. UTC | #1
Hi,

On 3-Dec-24 10:20 PM, Ricardo Ribalda wrote:
> This patchset fixes two +1 bugs with the async controls for the uvc driver.
> 
> They were found while implementing the granular PM, but I am sending
> them as a separate patches, so they can be reviewed sooner. They fix
> real issues in the driver that need to be taken care.
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Ricardo, Thank you for your patches.

I have merged patches 1-4 into:

https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/next/

now.

Regards,

Hans



> ---
> Changes in v6:
> - Swap order of patches
> - Use uvc_ctrl_set_handle again
> - Move loaded=0 to uvc_ctrl_status_event()
> - Link to v5: https://lore.kernel.org/r/20241202-uvc-fix-async-v5-0-6658c1fe312b@chromium.org
> 
> Changes in v5:
> - Move set handle to the entity_commit
> - Replace uvc_ctrl_set_handle with get/put_handle.
> - Add a patch to flush the cache of async controls.
> - Link to v4: https://lore.kernel.org/r/20241129-uvc-fix-async-v4-0-f23784dba80f@chromium.org
> 
> Changes in v4:
> - Fix implementation of uvc_ctrl_set_handle.
> - Link to v3: https://lore.kernel.org/r/20241129-uvc-fix-async-v3-0-ab675ce66db7@chromium.org
> 
> Changes in v3:
> - change again! order of patches.
> - Introduce uvc_ctrl_set_handle.
> - Do not change ctrl->handle if it is not NULL.
> 
> Changes in v2:
> - Annotate lockdep
> - ctrl->handle != handle
> - Change order of patches
> - Move documentation of mutex
> - Link to v1: https://lore.kernel.org/r/20241127-uvc-fix-async-v1-0-eb8722531b8c@chromium.org
> 
> ---
> Ricardo Ribalda (5):
>       media: uvcvideo: Only save async fh if success
>       media: uvcvideo: Remove redundant NULL assignment
>       media: uvcvideo: Remove dangling pointers
>       media: uvcvideo: Annotate lock requirements for uvc_ctrl_set
>       media: uvcvideo: Flush the control cache when we get an event
> 
>  drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++++++++++++++++++------
>  drivers/media/usb/uvc/uvc_v4l2.c |  2 +
>  drivers/media/usb/uvc/uvcvideo.h |  9 ++++-
>  3 files changed, 82 insertions(+), 12 deletions(-)
> ---
> base-commit: 291a8d98186f0a704cb954855d2ae3233971f07d
> change-id: 20241127-uvc-fix-async-2c9d40413ad8
> 
> Best regards,
Laurent Pinchart Dec. 19, 2024, 12:37 a.m. UTC | #2
On Mon, Dec 09, 2024 at 12:01:16PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 3-Dec-24 10:20 PM, Ricardo Ribalda wrote:
> > This patchset fixes two +1 bugs with the async controls for the uvc driver.
> > 
> > They were found while implementing the granular PM, but I am sending
> > them as a separate patches, so they can be reviewed sooner. They fix
> > real issues in the driver that need to be taken care.
> > 
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> 
> Ricardo, Thank you for your patches.
> 
> I have merged patches 1-4 into:
> 
> https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/next/

At least patch 5/5 was applied incorrectly. Does that result from a
merge conflict ? Or did you apply v5 by mistake ? There doesn't seem to
be any other issue.

I've rebased the uvc/next branch to fix this. Once CI passes, I'll send
a pull request.

> > ---
> > Changes in v6:
> > - Swap order of patches
> > - Use uvc_ctrl_set_handle again
> > - Move loaded=0 to uvc_ctrl_status_event()
> > - Link to v5: https://lore.kernel.org/r/20241202-uvc-fix-async-v5-0-6658c1fe312b@chromium.org
> > 
> > Changes in v5:
> > - Move set handle to the entity_commit
> > - Replace uvc_ctrl_set_handle with get/put_handle.
> > - Add a patch to flush the cache of async controls.
> > - Link to v4: https://lore.kernel.org/r/20241129-uvc-fix-async-v4-0-f23784dba80f@chromium.org
> > 
> > Changes in v4:
> > - Fix implementation of uvc_ctrl_set_handle.
> > - Link to v3: https://lore.kernel.org/r/20241129-uvc-fix-async-v3-0-ab675ce66db7@chromium.org
> > 
> > Changes in v3:
> > - change again! order of patches.
> > - Introduce uvc_ctrl_set_handle.
> > - Do not change ctrl->handle if it is not NULL.
> > 
> > Changes in v2:
> > - Annotate lockdep
> > - ctrl->handle != handle
> > - Change order of patches
> > - Move documentation of mutex
> > - Link to v1: https://lore.kernel.org/r/20241127-uvc-fix-async-v1-0-eb8722531b8c@chromium.org
> > 
> > ---
> > Ricardo Ribalda (5):
> >       media: uvcvideo: Only save async fh if success
> >       media: uvcvideo: Remove redundant NULL assignment
> >       media: uvcvideo: Remove dangling pointers
> >       media: uvcvideo: Annotate lock requirements for uvc_ctrl_set
> >       media: uvcvideo: Flush the control cache when we get an event
> > 
> >  drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++++++++++++++++++------
> >  drivers/media/usb/uvc/uvc_v4l2.c |  2 +
> >  drivers/media/usb/uvc/uvcvideo.h |  9 ++++-
> >  3 files changed, 82 insertions(+), 12 deletions(-)
> > ---
> > base-commit: 291a8d98186f0a704cb954855d2ae3233971f07d
> > change-id: 20241127-uvc-fix-async-2c9d40413ad8
Hans de Goede Dec. 19, 2024, 9:27 a.m. UTC | #3
Hi,

On 19-Dec-24 1:37 AM, Laurent Pinchart wrote:
> On Mon, Dec 09, 2024 at 12:01:16PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 3-Dec-24 10:20 PM, Ricardo Ribalda wrote:
>>> This patchset fixes two +1 bugs with the async controls for the uvc driver.
>>>
>>> They were found while implementing the granular PM, but I am sending
>>> them as a separate patches, so they can be reviewed sooner. They fix
>>> real issues in the driver that need to be taken care.
>>>
>>> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
>>
>> Ricardo, Thank you for your patches.
>>
>> I have merged patches 1-4 into:
>>
>> https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/next/
> 
> At least patch 5/5 was applied incorrectly. Does that result from a
> merge conflict ? Or did you apply v5 by mistake ? There doesn't seem to
> be any other issue.

I think I applied v5 by mistake, sorry about that.

> I've rebased the uvc/next branch to fix this. Once CI passes, I'll send
> a pull request.

Great, thank you.

Regards,

Hans



>>> ---
>>> Changes in v6:
>>> - Swap order of patches
>>> - Use uvc_ctrl_set_handle again
>>> - Move loaded=0 to uvc_ctrl_status_event()
>>> - Link to v5: https://lore.kernel.org/r/20241202-uvc-fix-async-v5-0-6658c1fe312b@chromium.org
>>>
>>> Changes in v5:
>>> - Move set handle to the entity_commit
>>> - Replace uvc_ctrl_set_handle with get/put_handle.
>>> - Add a patch to flush the cache of async controls.
>>> - Link to v4: https://lore.kernel.org/r/20241129-uvc-fix-async-v4-0-f23784dba80f@chromium.org
>>>
>>> Changes in v4:
>>> - Fix implementation of uvc_ctrl_set_handle.
>>> - Link to v3: https://lore.kernel.org/r/20241129-uvc-fix-async-v3-0-ab675ce66db7@chromium.org
>>>
>>> Changes in v3:
>>> - change again! order of patches.
>>> - Introduce uvc_ctrl_set_handle.
>>> - Do not change ctrl->handle if it is not NULL.
>>>
>>> Changes in v2:
>>> - Annotate lockdep
>>> - ctrl->handle != handle
>>> - Change order of patches
>>> - Move documentation of mutex
>>> - Link to v1: https://lore.kernel.org/r/20241127-uvc-fix-async-v1-0-eb8722531b8c@chromium.org
>>>
>>> ---
>>> Ricardo Ribalda (5):
>>>       media: uvcvideo: Only save async fh if success
>>>       media: uvcvideo: Remove redundant NULL assignment
>>>       media: uvcvideo: Remove dangling pointers
>>>       media: uvcvideo: Annotate lock requirements for uvc_ctrl_set
>>>       media: uvcvideo: Flush the control cache when we get an event
>>>
>>>  drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++++++++++++++++++------
>>>  drivers/media/usb/uvc/uvc_v4l2.c |  2 +
>>>  drivers/media/usb/uvc/uvcvideo.h |  9 ++++-
>>>  3 files changed, 82 insertions(+), 12 deletions(-)
>>> ---
>>> base-commit: 291a8d98186f0a704cb954855d2ae3233971f07d
>>> change-id: 20241127-uvc-fix-async-2c9d40413ad8
>