Skip to content

media: always call poll_wait() on queues

Alexandre Courbot linux-media lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v11 patch 13 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2media: videobuf2: always call poll_wait() on queuesdrivers/media/common/videobuf2/videobuf2-core.c+9 -20 replies
2/2media: v4l2-mem2mem: always call poll_wait() on queuesdrivers/media/v4l2-core/v4l2-mem2mem.c+12 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] media: always call poll_wait() on queues

do_poll()/do_select() seem to set the _qproc member of poll_table to NULL the first time they are called on a given table, making subsequent calls of poll_wait() on that table no-ops. This behavior causes a bug with the current poll implementations of vb2 and mem2mem, which only call poll_wait() if a queue-related (EPOLLIN or EPOLLOUT) event if
present: if there is none during the first call (e.g. because userspace only wanted to listen to EPOLLPRI), then EPOLLIN and EPOLLOUT will never be signaled, event if they are requested later.

This can be fixed by making the call to poll_wait() unconditional, thus making sure it will also be invoked during the first call.

The issue has been discussed in more detail on
https://www.spinics.net/lists/linux-media/msg179618.html.

Alexandre Courbot (2):
media: videobuf2: always call poll_wait() on queues
media: v4l2-mem2mem: always call poll_wait() on queues

 drivers/media/common/videobuf2/videobuf2-core.c | 11 +++++++++--
 drivers/media/v4l2-core/v4l2-mem2mem.c          | 15 ++++++++++++---
 2 files changed, 21 insertions(+), 5 deletions(-)

--
2.29.2