All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>,
	linux-media@vger.kernel.org
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	linux-kernel@codethink.co.uk,
	William Towle <william.towle@codethink.co.uk>,
	Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [RFC PATCH 3/5] media: rcar_vin: Fix race condition terminating stream
Date: Thu, 18 Dec 2014 20:40:57 +0300	[thread overview]
Message-ID: <549311A9.8050909@cogentembedded.com> (raw)
In-Reply-To: <1418914186.22813.16.camel@xylophone.i.decadent.org.uk>

Hello.

On 12/18/2014 05:49 PM, Ben Hutchings wrote:

> From: Ian Molton <ian.molton@codethink.co.uk>

> This patch fixes a race condition whereby a frame being captured may generate an
>   interrupt between requesting capture to halt and freeing buffers.

    No need for the leading space.

> This condition is exposed by the earlier patch that explicitly calls
> vb2_buffer_done() during stop streaming.

    Hm, perhaps for the sake of bisection, these 2 patches need to be merged?

> The solution is to wait for capture to finish prior to finalising these buffers.

> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
> Signed-off-by: William Towle <william.towle@codethink.co.uk>
> ---
>   drivers/media/platform/soc_camera/rcar_vin.c |   43 +++++++++++++++++---------
>   1 file changed, 28 insertions(+), 15 deletions(-)

> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
> index 7069176..b234e57 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
[...]
> @@ -465,7 +488,6 @@ static void rcar_vin_videobuf_release(struct vb2_buffer *vb)
>   	struct rcar_vin_priv *priv = ici->priv;
>   	unsigned int i;
>   	int buf_in_use = 0;
> -

    Unrelated white space change. Moreover, there should be an empty line 
after declarations.

>   	spin_lock_irq(&priv->lock);
>
>   	/* Is the buffer in use by the VIN hardware? */
[...]
> @@ -520,12 +530,15 @@ static void rcar_vin_stop_streaming(struct vb2_queue *vq)
>
>   	spin_lock_irq(&priv->lock);
>
> +	rcar_vin_wait_stop_streaming(priv);
> +
>   	for (i = 0; i < vq->num_buffers; ++i)
>   		if (vq->bufs[i]->state == VB2_BUF_STATE_ACTIVE)
>   			vb2_buffer_done(vq->bufs[i], VB2_BUF_STATE_ERROR);
>
>   	list_for_each_safe(buf_head, tmp, &priv->capture)
>   		list_del_init(buf_head);
> +

    Also seems like unrelated whitespace cleanup.

>   	spin_unlock_irq(&priv->lock);
>   }

WBR, Sergei


  reply	other threads:[~2014-12-18 17:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 14:47 [RFC PATCH 0/5] media: rcar_vin: Fixes for buffer management Ben Hutchings
2014-12-18 14:49 ` [RFC PATCH 1/5] media: rcar_vin: Dont aggressively retire buffers Ben Hutchings
2015-01-18 20:16   ` Guennadi Liakhovetski
2014-12-18 14:49 ` [RFC PATCH 2/5] media: rcar_vin: Ensure all in-flight buffers are returned to error state before stopping Ben Hutchings
2014-12-30 13:14   ` Sakari Ailus
2014-12-18 14:49 ` [RFC PATCH 3/5] media: rcar_vin: Fix race condition terminating stream Ben Hutchings
2014-12-18 17:40   ` Sergei Shtylyov [this message]
2015-01-18 20:34     ` Guennadi Liakhovetski
2014-12-18 14:49 ` [RFC PATCH 4/5] media: rcar_vin: Clean up rcar_vin_irq Ben Hutchings
2014-12-18 14:50 ` [RFC PATCH 5/5] media: rcar_vin: move buffer management to .stop_streaming handler Ben Hutchings
2014-12-18 17:33   ` Sergei Shtylyov
2015-01-18 21:23   ` Guennadi Liakhovetski
2015-01-19 10:50     ` Ben Hutchings
2015-01-19 11:11       ` Guennadi Liakhovetski
2015-01-19 14:11         ` William Towle
2015-01-19 14:25           ` Guennadi Liakhovetski
2015-01-20 12:27             ` William Towle
2015-01-19 14:52           ` Hans Verkuil
2014-12-18 17:36 ` [RFC PATCH 0/5] media: rcar_vin: Fixes for buffer management Sergei Shtylyov

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=549311A9.8050909@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=g.liakhovetski@gmx.de \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@codethink.co.uk \
    --cc=linux-media@vger.kernel.org \
    --cc=william.towle@codethink.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.