From: Sean Young <sean@mess.org>
To: hverkuil-cisco@xs4all.nl
Cc: linux-media@vger.kernel.org,
Michael Ira Krufky <mkrufky@linuxtv.org>,
Brad Love <brad@nextdimension.cc>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [RFC PATCH 8/8] dvb-core: fix epoll() by calling poll_wait first
Date: Fri, 8 Feb 2019 21:12:30 +0000 [thread overview]
Message-ID: <20190208211230.xznkkm7ucw7jn3h4@gofer.mess.org> (raw)
In-Reply-To: <20190207114948.37750-9-hverkuil-cisco@xs4all.nl>
On Thu, Feb 07, 2019 at 12:49:48PM +0100, hverkuil-cisco@xs4all.nl wrote:
> From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>
> The epoll function expects that whenever the poll file op is
> called, the poll_wait function is also called. That didn't
> always happen in dvb_demux_poll(), dvb_dvr_poll() and
> dvb_ca_en50221_io_poll(). Fix this, otherwise epoll()
> can timeout when it shouldn't.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sean Young <sean@mess.org>
> ---
> drivers/media/dvb-core/dmxdev.c | 8 ++++----
> drivers/media/dvb-core/dvb_ca_en50221.c | 5 ++---
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
> index 1544e8cef564..f14a872d1268 100644
> --- a/drivers/media/dvb-core/dmxdev.c
> +++ b/drivers/media/dvb-core/dmxdev.c
> @@ -1195,13 +1195,13 @@ static __poll_t dvb_demux_poll(struct file *file, poll_table *wait)
> struct dmxdev_filter *dmxdevfilter = file->private_data;
> __poll_t mask = 0;
>
> + poll_wait(file, &dmxdevfilter->buffer.queue, wait);
> +
> if ((!dmxdevfilter) || dmxdevfilter->dev->exit)
> return EPOLLERR;
> if (dvb_vb2_is_streaming(&dmxdevfilter->vb2_ctx))
> return dvb_vb2_poll(&dmxdevfilter->vb2_ctx, file, wait);
>
> - poll_wait(file, &dmxdevfilter->buffer.queue, wait);
> -
> if (dmxdevfilter->state != DMXDEV_STATE_GO &&
> dmxdevfilter->state != DMXDEV_STATE_DONE &&
> dmxdevfilter->state != DMXDEV_STATE_TIMEDOUT)
> @@ -1346,13 +1346,13 @@ static __poll_t dvb_dvr_poll(struct file *file, poll_table *wait)
>
> dprintk("%s\n", __func__);
>
> + poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
> +
> if (dmxdev->exit)
> return EPOLLERR;
> if (dvb_vb2_is_streaming(&dmxdev->dvr_vb2_ctx))
> return dvb_vb2_poll(&dmxdev->dvr_vb2_ctx, file, wait);
>
> - poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
> -
> if (((file->f_flags & O_ACCMODE) == O_RDONLY) ||
> dmxdev->may_do_mmap) {
> if (dmxdev->dvr_buffer.error)
> diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
> index 4d371cea0d5d..ebf1e3b03819 100644
> --- a/drivers/media/dvb-core/dvb_ca_en50221.c
> +++ b/drivers/media/dvb-core/dvb_ca_en50221.c
> @@ -1797,6 +1797,8 @@ static __poll_t dvb_ca_en50221_io_poll(struct file *file, poll_table *wait)
>
> dprintk("%s\n", __func__);
>
> + poll_wait(file, &ca->wait_queue, wait);
> +
> if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1)
> mask |= EPOLLIN;
>
> @@ -1804,9 +1806,6 @@ static __poll_t dvb_ca_en50221_io_poll(struct file *file, poll_table *wait)
> if (mask)
> return mask;
>
> - /* wait for something to happen */
> - poll_wait(file, &ca->wait_queue, wait);
> -
> if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1)
> mask |= EPOLLIN;
>
> --
> 2.20.1
prev parent reply other threads:[~2019-02-08 21:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 11:49 [RFC PATCH 0/8] cec/mc/vb2/dvb: fix epoll support hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 1/8] cec: fix epoll() by calling poll_wait first hverkuil-cisco
2019-02-08 20:53 ` Sean Young
2019-02-07 11:49 ` [RFC PATCH 2/8] media-request: " hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 3/8] vb2: " hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 4/8] v4l2-ctrls.c: " hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 5/8] v4l2-mem2mem: " hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 6/8] v4l2-mem2mem: add q->error check to v4l2_m2m_poll() hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 7/8] videobuf: fix epoll() by calling poll_wait first hverkuil-cisco
2019-02-07 11:49 ` [RFC PATCH 8/8] dvb-core: " hverkuil-cisco
2019-02-08 21:12 ` Sean Young [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190208211230.xznkkm7ucw7jn3h4@gofer.mess.org \
--to=sean@mess.org \
--cc=brad@nextdimension.cc \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mkrufky@linuxtv.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).