public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran@ksquared.org.uk>
Cc: linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v11 01/10] media: v4l: vsp1: Release buffers for each video node
Date: Fri, 18 May 2018 23:53:02 +0300	[thread overview]
Message-ID: <2666334.YPxzfcQE7O@avalon> (raw)
In-Reply-To: <f05e7c227e8ab1f0c5d65ccdcb92c7c20c00594a.1526675940.git-series.kieran.bingham+renesas@ideasonboard.com>

Hi Kieran,

Thank you for the patch.

On Friday, 18 May 2018 23:41:54 EEST Kieran Bingham wrote:
> From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> 
> Commit 372b2b0399fc ("media: v4l: vsp1: Release buffers in
> start_streaming error path") introduced a helper to clean up buffers on
> error paths, but inadvertently changed the code such that only the
> output WPF buffers were cleaned, rather than the video node being
> operated on.
> 
> Since then vsp1_video_cleanup_pipeline() has grown to perform both video
> node cleanup, as well as pipeline cleanup. Split the implementation into
> two distinct functions that perform the required work, so that each
> video node can release it's buffers correctly on streamoff. The pipe

s/it's/its/

> cleanup that was performed in the vsp1_video_stop_streaming() (releasing
> the pipe->dl) is moved to the function for clarity.
> 
> Fixes: 372b2b0399fc ("media: v4l: vsp1: Release buffers in start_streaming
> error path")
> Cc: stable@vger.kernel.org # v4.13+

Commit 372b2b0399fc was introduced in v4.14, should this be v4.14+ ?

> 
> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

No need to resubmit for this, I'll fix the commit message when applying.

> ---
>  drivers/media/platform/vsp1/vsp1_video.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c
> b/drivers/media/platform/vsp1/vsp1_video.c index c8c12223a267..ba89dd176a13
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -842,9 +842,8 @@ static int vsp1_video_setup_pipeline(struct
> vsp1_pipeline *pipe) return 0;
>  }
> 
> -static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
> +static void vsp1_video_release_buffers(struct vsp1_video *video)
>  {
> -	struct vsp1_video *video = pipe->output->video;
>  	struct vsp1_vb2_buffer *buffer;
>  	unsigned long flags;
> 
> @@ -854,12 +853,18 @@ static void vsp1_video_cleanup_pipeline(struct
> vsp1_pipeline *pipe) vb2_buffer_done(&buffer->buf.vb2_buf,
> VB2_BUF_STATE_ERROR);
>  	INIT_LIST_HEAD(&video->irqqueue);
>  	spin_unlock_irqrestore(&video->irqlock, flags);
> +}
> +
> +static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
> +{
> +	lockdep_assert_held(&pipe->lock);
> 
>  	/* Release our partition table allocation */
> -	mutex_lock(&pipe->lock);
>  	kfree(pipe->part_table);
>  	pipe->part_table = NULL;
> -	mutex_unlock(&pipe->lock);
> +
> +	vsp1_dl_list_put(pipe->dl);
> +	pipe->dl = NULL;
>  }
> 
>  static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int
> count) @@ -874,8 +879,9 @@ static int vsp1_video_start_streaming(struct
> vb2_queue *vq, unsigned int count) if (pipe->stream_count ==
> pipe->num_inputs) {
>  		ret = vsp1_video_setup_pipeline(pipe);
>  		if (ret < 0) {
> -			mutex_unlock(&pipe->lock);
> +			vsp1_video_release_buffers(video);
>  			vsp1_video_cleanup_pipeline(pipe);
> +			mutex_unlock(&pipe->lock);
>  			return ret;
>  		}
> 
> @@ -925,13 +931,12 @@ static void vsp1_video_stop_streaming(struct vb2_queue
> *vq) if (ret == -ETIMEDOUT)
>  			dev_err(video->vsp1->dev, "pipeline stop timeout\n");
> 
> -		vsp1_dl_list_put(pipe->dl);
> -		pipe->dl = NULL;
> +		vsp1_video_cleanup_pipeline(pipe);
>  	}
>  	mutex_unlock(&pipe->lock);
> 
>  	media_pipeline_stop(&video->video.entity);
> -	vsp1_video_cleanup_pipeline(pipe);
> +	vsp1_video_release_buffers(video);
>  	vsp1_video_pipeline_put(pipe);
>  }

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2018-05-18 20:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 20:41 [PATCH v11 00/10] vsp1: TLB optimisation and DL caching Kieran Bingham
2018-05-18 20:41 ` [PATCH v11 01/10] media: v4l: vsp1: Release buffers for each video node Kieran Bingham
2018-05-18 20:53   ` Laurent Pinchart [this message]
2018-05-18 20:55     ` Kieran Bingham
2018-05-18 20:41 ` [PATCH v11 02/10] media: vsp1: Move video suspend resume handling to video object Kieran Bingham
2018-05-18 20:53   ` Laurent Pinchart
2018-05-18 20:41 ` [PATCH v11 03/10] media: vsp1: Reword uses of 'fragment' as 'body' Kieran Bingham
2018-05-18 20:41 ` [PATCH v11 04/10] media: vsp1: Protect bodies against overflow Kieran Bingham
2018-05-18 20:41 ` [PATCH v11 05/10] media: vsp1: Provide a body pool Kieran Bingham
2018-05-18 20:41 ` [PATCH v11 06/10] media: vsp1: Convert display lists to use new " Kieran Bingham
2018-05-18 20:42 ` [PATCH v11 07/10] media: vsp1: Use reference counting for bodies Kieran Bingham
2018-05-18 20:42 ` [PATCH v11 08/10] media: vsp1: Refactor display list configure operations Kieran Bingham
2018-05-18 20:42 ` [PATCH v11 09/10] media: vsp1: Adapt entities to configure into a body Kieran Bingham
2018-05-18 20:42 ` [PATCH v11 10/10] media: vsp1: Move video configuration to a cached dlb Kieran Bingham
2018-05-18 21:05   ` Laurent Pinchart

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=2666334.YPxzfcQE7O@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kieran@ksquared.org.uk \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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