From: Tomasz Figa <tfiga@chromium.org>
To: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Cc: mchehab@kernel.org, dafna3@gmail.com, hverkuil@xs4all.nl,
linux-rockchip@lists.infradead.org, helen.koike@collabora.com,
laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com,
kernel@collabora.com, ezequiel@collabora.com,
linux-media@vger.kernel.org
Subject: Re: [PATCH v3 01/12] media: staging: rkisp1: params: upon stream stop, iterate a local list to return the buffers
Date: Fri, 25 Sep 2020 19:08:23 +0000 [thread overview]
Message-ID: <20200925190823.GE3607091@chromium.org> (raw)
In-Reply-To: <20200922113402.12442-2-dafna.hirschfeld@collabora.com>
Hi Dafna,
On Tue, Sep 22, 2020 at 01:33:51PM +0200, 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>
> Acked-by: Helen Koike <helen.koike@collabora.com>
> ---
> drivers/staging/media/rkisp1/rkisp1-params.c | 31 +++++++-------------
> 1 file changed, 11 insertions(+), 20 deletions(-)
>
Thank you for the patch. Please see my comments inline.
> diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
> index 3ca2afc51ead..85f3b340c3bf 100644
> --- a/drivers/staging/media/rkisp1/rkisp1-params.c
> +++ b/drivers/staging/media/rkisp1/rkisp1-params.c
> @@ -1469,32 +1469,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);
nit: This could be done at declaration time by using the LIST_HEAD()
macro to declare the list head.
> +
> + /*
> + * 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);
nit: This is equivalent to list_splice_init(¶ms->params, &tmp_list);
with a simpler interface and without the need to dereference
params->params.prev manually.
Best regards,
Tomasz
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: Tomasz Figa <tfiga@chromium.org>
To: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
helen.koike@collabora.com, ezequiel@collabora.com,
hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com,
sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org,
mchehab@kernel.org
Subject: Re: [PATCH v3 01/12] media: staging: rkisp1: params: upon stream stop, iterate a local list to return the buffers
Date: Fri, 25 Sep 2020 19:08:23 +0000 [thread overview]
Message-ID: <20200925190823.GE3607091@chromium.org> (raw)
In-Reply-To: <20200922113402.12442-2-dafna.hirschfeld@collabora.com>
Hi Dafna,
On Tue, Sep 22, 2020 at 01:33:51PM +0200, 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>
> Acked-by: Helen Koike <helen.koike@collabora.com>
> ---
> drivers/staging/media/rkisp1/rkisp1-params.c | 31 +++++++-------------
> 1 file changed, 11 insertions(+), 20 deletions(-)
>
Thank you for the patch. Please see my comments inline.
> diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
> index 3ca2afc51ead..85f3b340c3bf 100644
> --- a/drivers/staging/media/rkisp1/rkisp1-params.c
> +++ b/drivers/staging/media/rkisp1/rkisp1-params.c
> @@ -1469,32 +1469,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);
nit: This could be done at declaration time by using the LIST_HEAD()
macro to declare the list head.
> +
> + /*
> + * 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);
nit: This is equivalent to list_splice_init(¶ms->params, &tmp_list);
with a simpler interface and without the need to dereference
params->params.prev manually.
Best regards,
Tomasz
next prev parent reply other threads:[~2020-09-25 19:08 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 11:33 [PATCH v3 00/12] media: staging: rkisp1: various bug fixes Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-22 11:33 ` [PATCH v3 01/12] media: staging: rkisp1: params: upon stream stop, iterate a local list to return the buffers Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-25 19:08 ` Tomasz Figa [this message]
2020-09-25 19:08 ` Tomasz Figa
2020-09-22 11:33 ` [PATCH v3 02/12] media: staging: rkisp1: params: in the isr, return if buffer list is empty Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-22 11:33 ` [PATCH v3 03/12] media: staging: rkisp1: params: use the new effect value in cproc config Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-22 11:33 ` [PATCH v3 04/12] media: staging: rkisp1: params: avoid using buffer if params is not streaming Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-25 20:16 ` Tomasz Figa
2020-09-25 20:16 ` Tomasz Figa
2020-09-22 11:33 ` [PATCH v3 05/12] media: staging: rkisp1: params: set vb.sequence to be the isp's frame_sequence + 1 Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-22 11:33 ` [PATCH v3 06/12] media: staging: rkisp1: remove atomic operations for frame sequence Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-25 20:42 ` Tomasz Figa
2020-09-25 20:42 ` Tomasz Figa
2020-10-02 9:16 ` Dafna Hirschfeld
2020-10-02 9:16 ` Dafna Hirschfeld
2020-10-02 15:30 ` Tomasz Figa
2020-10-02 15:30 ` Tomasz Figa
2020-11-06 14:43 ` Helen Koike
2020-11-06 14:43 ` Helen Koike
2020-11-10 10:40 ` Tomasz Figa
2020-11-10 10:40 ` Tomasz Figa
2020-09-22 11:33 ` [PATCH v3 07/12] media: staging: rkisp1: isp: add a warning and debugfs var for irq delay Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-22 11:33 ` [PATCH v3 08/12] media: staging: rkisp1: isp: don't enable signal RKISP1_CIF_ISP_FRAME_IN Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-22 11:33 ` [PATCH v3 09/12] media: staging: rkisp1: stats: protect write to 'is_streaming' in start_streaming cb Dafna Hirschfeld
2020-09-22 11:33 ` Dafna Hirschfeld
2020-09-25 20:47 ` Tomasz Figa
2020-09-25 20:47 ` Tomasz Figa
2020-09-22 11:34 ` [PATCH v3 10/12] media: staging: rkisp1: params: no need to lock default config Dafna Hirschfeld
2020-09-22 11:34 ` Dafna Hirschfeld
2020-09-22 11:34 ` [PATCH v3 11/12] media: staging: rkisp1: use the right variants of spin_lock Dafna Hirschfeld
2020-09-22 11:34 ` Dafna Hirschfeld
2020-09-25 20:51 ` Tomasz Figa
2020-09-25 20:51 ` Tomasz Figa
2020-09-22 11:34 ` [PATCH v3 12/12] media: staging: rkisp1: cap: protect access to buf with the spin lock Dafna Hirschfeld
2020-09-22 11:34 ` Dafna Hirschfeld
2020-09-25 20:53 ` Tomasz Figa
2020-09-25 20:53 ` Tomasz Figa
2020-09-27 9:43 ` Mauro Carvalho Chehab
2020-09-27 9:43 ` Mauro Carvalho Chehab
2020-09-27 9:54 ` Dafna Hirschfeld
2020-09-27 9:54 ` Dafna Hirschfeld
2020-09-27 11:05 ` Mauro Carvalho Chehab
2020-09-27 11:05 ` Mauro Carvalho Chehab
2020-09-28 15:29 ` Dafna Hirschfeld
2020-09-28 15:29 ` Dafna Hirschfeld
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=20200925190823.GE3607091@chromium.org \
--to=tfiga@chromium.org \
--cc=dafna.hirschfeld@collabora.com \
--cc=dafna3@gmail.com \
--cc=ezequiel@collabora.com \
--cc=helen.koike@collabora.com \
--cc=hverkuil@xs4all.nl \
--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 \
/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.