[RFC PATCH 0/8] cec/mc/vb2/dvb: fix epoll support

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

 



From: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>

As was reported by Yi Qingliang (http://lkml.iu.edu/hypermail/linux/kernel/1812.3/02144.html)
the epoll support in v4l2 is broken.

After researching this some more it turns out that we never
really understood when poll_wait() should be called, and that in
fact it is broken in quite a few places in our media tree, and not
just v4l2.

The select() call is fairly simplistic: it calls the poll fop
first, then waits for an event if the poll fop returned 0.

The epoll() call is more complicated: epoll_ctl(EPOLL_CTL_ADD) will
call the poll fop which calls poll_wait in turn.

But epoll_wait() just waits for events to arrive on the registered
waitqueues, and does not call the poll fop until it is woken up.

So not calling poll_wait() in the poll fop will cause epoll_wait()
to wait forever (or until the timeout is reached).

This patch series just calls poll_wait() regardless of whether there
is an event pending.

It does this for all the various frameworks that did this wrong.

Note that there is also an extra mem2mem patch that adds a check for
q->error, which I noticed was missing.

I have not tested the videobuf and esp. the dvb-core changes. They
look sane, but it doesn't hurt to give those extra attention.

There are also older drivers that call poll_wait themselves. While
I have some patches for those (look in
https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=poll), they
need more review. I prefer to do the core frameworks first.

Several of the patches in this series should probably be CC-ed to
stable. I'll take a look at that once this RFC series gets the
green light.

Regards,

	Hans

Hans Verkuil (8):
  cec: fix epoll() by calling poll_wait first
  media-request: fix epoll() by calling poll_wait first
  vb2: fix epoll() by calling poll_wait first
  v4l2-ctrls.c: fix epoll() by calling poll_wait first
  v4l2-mem2mem: fix epoll() by calling poll_wait first
  v4l2-mem2mem: add q->error check to v4l2_m2m_poll()
  videobuf: fix epoll() by calling poll_wait first
  dvb-core: fix epoll() by calling poll_wait first

 drivers/media/cec/cec-api.c                   |  2 +-
 .../media/common/videobuf2/videobuf2-core.c   |  4 +--
 .../media/common/videobuf2/videobuf2-v4l2.c   |  4 +--
 drivers/media/dvb-core/dmxdev.c               |  8 +++---
 drivers/media/dvb-core/dvb_ca_en50221.c       |  5 ++--
 drivers/media/media-request.c                 |  3 +--
 drivers/media/v4l2-core/v4l2-ctrls.c          |  2 +-
 drivers/media/v4l2-core/v4l2-mem2mem.c        | 25 ++++++++-----------
 drivers/media/v4l2-core/videobuf-core.c       |  6 ++---
 9 files changed, 26 insertions(+), 33 deletions(-)

-- 
2.20.1




[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