From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
"Biju Das" <biju.das.jz@bp.renesas.com>,
"Hans Verkuil" <hverkuil+cisco@kernel.org>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Daniel Scally" <dan.scally@ideasonboard.com>,
"Barnabás Pőcze" <pobrn@protonmail.com>,
"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
"Jacopo Mondi" <jacopo.mondi+renesas@ideasonboard.com>
Subject: Re: [PATCH 08/14] media: rz2gl-cru: Introduce a spinlock for hw operations
Date: Mon, 30 Mar 2026 18:17:14 +0200 [thread overview]
Message-ID: <acqiClc70UTck27b@tom-desktop> (raw)
In-Reply-To: <20260327-b4-cru-rework-v1-8-3b7d0430f538@ideasonboard.com>
Hi Jacopo,
Thanks for your patch.
On Fri, Mar 27, 2026 at 06:10:13PM +0100, Jacopo Mondi wrote:
> From: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
>
> The CRU driver uses a single spinlock to protect the buffers queue and
> the hardware operations.
>
> This single spinlock is held for the whole duration of the interrupt
> handler, causing all other driver's operations to freeze.
>
> Under heavy system stress conditions with userspace not providing
> buffers fast enough, this causes loss of frames.
>
> Prepare to re-work the driver locking by introducing (but not using yet)
> a new spinlock to protect the hardware registers programming.
>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Kind Regards,
Tommaso
> Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
> ---
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 10 +++++++---
> drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 1 +
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> index 3a200db15730..b46696a0012b 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> @@ -109,7 +109,6 @@ struct rzg2l_cru_info {
> * @v4l2_dev: V4L2 device
> * @num_buf: Holds the current number of buffers enabled
> * @svc_channel: SVC0/1/2/3 to use for RZ/G3E
> - * @buf_addr: Memory addresses where current video data is written.
> * @notifier: V4L2 asynchronous subdevs notifier
> *
> * @ip: Image processing subdev info
> @@ -118,6 +117,10 @@ struct rzg2l_cru_info {
> * @mdev_lock: protects the count, notifier and csi members
> * @pad: media pad for the video device entity
> *
> + * @hw_lock: protects the slot counter, hardware programming of
> + * slot addresses and the @buf_addr[] list
> + * @buf_addr: Memory addresses where current video data is written
> + *
> * @lock: protects @queue
> * @queue: vb2 buffers queue
> * @scratch: cpu address for scratch buffer
> @@ -147,8 +150,6 @@ struct rzg2l_cru_dev {
> u8 num_buf;
>
> u8 svc_channel;
> - dma_addr_t buf_addr[RZG2L_CRU_HW_BUFFER_DEFAULT];
> -
> struct v4l2_async_notifier notifier;
>
> struct rzg2l_cru_ip ip;
> @@ -157,6 +158,9 @@ struct rzg2l_cru_dev {
> struct mutex mdev_lock;
> struct media_pad pad;
>
> + spinlock_t hw_lock;
> + dma_addr_t buf_addr[RZG2L_CRU_HW_BUFFER_DEFAULT];
> +
> struct mutex lock;
> struct vb2_queue queue;
> void *scratch;
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index 27079c17a54c..a79b17e146bf 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -844,6 +844,7 @@ int rzg2l_cru_dma_register(struct rzg2l_cru_dev *cru)
> mutex_init(&cru->lock);
> INIT_LIST_HEAD(&cru->buf_list);
>
> + spin_lock_init(&cru->hw_lock);
> spin_lock_init(&cru->qlock);
>
> cru->state = RZG2L_CRU_DMA_STOPPED;
>
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-03-30 16:17 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 17:10 [PATCH 00/14] media: rzg2l-cru: Rework slot programming for V2H/G3E Jacopo Mondi
2026-03-27 17:10 ` [PATCH 01/14] media: rzg2l-cru: Skip ICnMC configuration when ICnSVC is used Jacopo Mondi
2026-03-30 15:51 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 02/14] media: rzg2l-cru: Use only frame end interrupts Jacopo Mondi
2026-03-30 15:55 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 03/14] media: rzg2l-cru: Modernize spin_lock usage with cleanup.h Jacopo Mondi
2026-03-30 7:30 ` Dan Scally
2026-03-30 11:12 ` Tommaso Merciai
2026-03-30 11:41 ` Biju Das
2026-03-31 7:18 ` Jacopo Mondi
2026-03-30 18:43 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 04/14] media: rzg2l-cru: Use proper guard() in irq handler Jacopo Mondi
2026-03-30 7:32 ` Dan Scally
2026-03-30 11:15 ` Tommaso Merciai
2026-03-30 19:00 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 05/14] media: rzg2l-cru: Remove locking from start/stop routines Jacopo Mondi
2026-03-30 13:29 ` Tommaso Merciai
2026-03-30 13:47 ` Dan Scally
2026-03-30 19:04 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 06/14] media: rzg2l-cru: Do not use irqsave when not needed Jacopo Mondi
2026-03-30 7:50 ` Dan Scally
2026-03-30 13:52 ` Tommaso Merciai
2026-03-31 7:46 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 07/14] media: rzg2l-cru: Remove wrong locking comment Jacopo Mondi
2026-03-30 7:38 ` Dan Scally
2026-03-30 13:54 ` Tommaso Merciai
2026-03-31 7:47 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 08/14] media: rz2gl-cru: Introduce a spinlock for hw operations Jacopo Mondi
2026-03-30 10:46 ` Dan Scally
2026-03-30 16:17 ` Tommaso Merciai [this message]
2026-03-31 8:11 ` Lad, Prabhakar
2026-03-27 17:10 ` [PATCH 09/14] media: rzg2l-cru: Split hw locking from buffers Jacopo Mondi
2026-03-30 11:19 ` Dan Scally
2026-03-30 16:09 ` Tommaso Merciai
2026-03-27 17:10 ` [PATCH 10/14] media: rzg2l-cru: Manually track active slot number Jacopo Mondi
2026-03-30 13:39 ` Dan Scally
2026-03-30 16:25 ` Tommaso Merciai
2026-03-31 7:43 ` Jacopo Mondi
2026-03-31 8:30 ` Lad, Prabhakar
2026-03-31 10:03 ` Jacopo Mondi
2026-03-31 10:05 ` Jacopo Mondi
2026-03-27 17:10 ` [PATCH 11/14] media: rz2gl-cru: Return pending buffers in order Jacopo Mondi
2026-03-30 13:52 ` Dan Scally
2026-03-30 17:14 ` Tommaso Merciai
2026-03-27 17:10 ` [PATCH 12/14] media: rzg2l-cru: Rework rzg2l_cru_fill_hw_slot() Jacopo Mondi
2026-03-27 17:10 ` [PATCH 13/14] media: rzg2l-cru: Remove the 'state' variable Jacopo Mondi
2026-03-30 11:55 ` Dan Scally
2026-03-31 7:45 ` Jacopo Mondi
2026-03-27 17:10 ` [PATCH 14/14] media: rzg2l-cru: Simplify irq return value handling Jacopo Mondi
2026-03-30 11:55 ` Dan Scally
2026-03-30 17:24 ` Tommaso Merciai
2026-03-27 17:25 ` [PATCH 00/14] media: rzg2l-cru: Rework slot programming for V2H/G3E Lad, Prabhakar
2026-03-28 11:55 ` Jacopo Mondi
2026-03-28 12:56 ` Lad, Prabhakar
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=acqiClc70UTck27b@tom-desktop \
--to=tommaso.merciai.xr@bp.renesas.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=dan.scally@ideasonboard.com \
--cc=hverkuil+cisco@kernel.org \
--cc=jacopo.mondi+renesas@ideasonboard.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pobrn@protonmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--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.