From: Hans Verkuil <hverkuil@xs4all.nl>
To: Helen Koike <helen.koike@collabora.com>,
Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
linux-media@vger.kernel.org
Cc: mchehab@kernel.org, dafna3@gmail.com, tfiga@chromium.org,
linux-rockchip@lists.infradead.org,
laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com,
kernel@collabora.com, ezequiel@collabora.com
Subject: Re: [PATCH v2 05/14] media: staging: rkisp1: params: upon stream stop, iterate a local list to return the buffers
Date: Thu, 20 Aug 2020 11:27:51 +0200 [thread overview]
Message-ID: <33ed026c-f014-0fff-2f19-afc1548e80f2@xs4all.nl> (raw)
In-Reply-To: <695451da-c7af-a12c-f308-c45675b8f3aa@collabora.com>
On 17/08/2020 23:47, Helen Koike wrote:
> Hi Dafna,
>
> On 8/15/20 7:37 AM, Dafna Hirschfeld wrote:
>> The code in '.stop_streaming' callback releases and acquire the lock
>> at each iteration when returning the buffers.
>> Holding the lock disables interrupts so it should be minimized.
>> To make the code cleaner and still minimize holding the lock,
>> the buffer list is first moved to a local list and
>> then can be iterated without the lock.
>>
>> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
>
> lgtm
>
> Helen Koike <helen.koike@collabora.com>
Missing 'Acked-by:' tag?
Hans
>
> Thanks
> Helen
>
>> ---
>> drivers/staging/media/rkisp1/rkisp1-params.c | 31 +++++++-------------
>> 1 file changed, 11 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
>> index 0c2bb2eefb22..6a76c586e916 100644
>> --- a/drivers/staging/media/rkisp1/rkisp1-params.c
>> +++ b/drivers/staging/media/rkisp1/rkisp1-params.c
>> @@ -1477,32 +1477,23 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq)
>> {
>> struct rkisp1_params *params = vq->drv_priv;
>> struct rkisp1_buffer *buf;
>> + struct list_head tmp_list;
>> unsigned long flags;
>> - unsigned int i;
>>
>> - /* stop params input firstly */
>> + INIT_LIST_HEAD(&tmp_list);
>> +
>> + /*
>> + * we first move the buffers into a local list 'tmp_list'
>> + * and then we can iterate it and call vb2_buffer_done
>> + * without holding the lock
>> + */
>> spin_lock_irqsave(¶ms->config_lock, flags);
>> params->is_streaming = false;
>> + list_cut_position(&tmp_list, ¶ms->params, params->params.prev);
>> spin_unlock_irqrestore(¶ms->config_lock, flags);
>>
>> - for (i = 0; i < RKISP1_ISP_PARAMS_REQ_BUFS_MAX; i++) {
>> - spin_lock_irqsave(¶ms->config_lock, flags);
>> - if (!list_empty(¶ms->params)) {
>> - buf = list_first_entry(¶ms->params,
>> - struct rkisp1_buffer, queue);
>> - list_del(&buf->queue);
>> - spin_unlock_irqrestore(¶ms->config_lock,
>> - flags);
>> - } else {
>> - spin_unlock_irqrestore(¶ms->config_lock,
>> - flags);
>> - break;
>> - }
>> -
>> - if (buf)
>> - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
>> - buf = NULL;
>> - }
>> + list_for_each_entry(buf, &tmp_list, queue)
>> + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
>> }
>>
>> static int
>>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2020-08-20 9:28 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-15 10:37 [PATCH v2 00/14] media: staging: rkisp1: various bug fixes Dafna Hirschfeld
2020-08-15 10:37 ` [PATCH v2 01/14] media: staging: rkisp1: call params isr only upon frame out Dafna Hirschfeld
2020-08-17 21:46 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 02/14] media: staging: rkisp1: params: use rkisp1_param_set_bits to set reg in isr Dafna Hirschfeld
2020-08-17 21:46 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 03/14] media: staging: rkisp1: params: use the new effect value in cproc config Dafna Hirschfeld
2020-08-17 21:46 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 04/14] media: staging: rkisp1: params: don't release lock in isr before buffer is done Dafna Hirschfeld
2020-08-17 21:47 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 05/14] media: staging: rkisp1: params: upon stream stop, iterate a local list to return the buffers Dafna Hirschfeld
2020-08-17 21:47 ` Helen Koike
2020-08-20 9:27 ` Hans Verkuil [this message]
2020-08-20 12:16 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 06/14] media: staging: rkisp1: params: in the isr, return if buffer list is empty Dafna Hirschfeld
2020-08-17 21:47 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 07/14] media: staging: rkisp1: params: avoid using buffer if params is not streaming Dafna Hirschfeld
2020-08-16 4:28 ` kernel test robot
2020-08-17 21:47 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 08/14] media: staging: rkisp1: params: set vb.sequence to be the isp's frame_sequence + 1 Dafna Hirschfeld
2020-08-17 21:47 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 09/14] media: staging: rkisp1: remove atomic operations for frame sequence Dafna Hirschfeld
2020-08-17 21:48 ` Helen Koike
2020-09-17 16:41 ` Dafna Hirschfeld
2020-08-15 10:37 ` [PATCH v2 10/14] media: staging: rkisp1: isp: add a warning and debugfs var for irq delay Dafna Hirschfeld
2020-08-17 21:48 ` Helen Koike
2020-08-18 6:46 ` Dafna Hirschfeld
2020-08-15 10:37 ` [PATCH v2 11/14] media: staging: rkisp1: isp: don't enable signal RKISP1_CIF_ISP_FRAME_IN Dafna Hirschfeld
2020-08-17 21:48 ` Helen Koike
2020-08-18 6:37 ` Dafna Hirschfeld
2020-08-15 10:37 ` [PATCH v2 12/14] media: staging: rkisp1: stats: protect write to 'is_streaming' in start_streaming cb Dafna Hirschfeld
2020-08-17 21:48 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 13/14] media: staging: rkisp1: call media_pipeline_start/stop from stats and params Dafna Hirschfeld
2020-08-17 21:48 ` Helen Koike
2020-08-15 10:37 ` [PATCH v2 14/14] media: staging: rkisp1: params: no need to lock default config Dafna Hirschfeld
2020-08-17 21:48 ` Helen Koike
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=33ed026c-f014-0fff-2f19-afc1548e80f2@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=dafna.hirschfeld@collabora.com \
--cc=dafna3@gmail.com \
--cc=ezequiel@collabora.com \
--cc=helen.koike@collabora.com \
--cc=kernel@collabora.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tfiga@chromium.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;
as well as URLs for NNTP newsgroup(s).