[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e2037b38-4c20-4f1e-b681-ae3def30823c@tuxon.dev>
Date: Thu, 18 Dec 2025 09:43:54 +0200
From: Claudiu Beznea <claudiu.beznea@...on.dev>
To: Biju Das <biju.das.jz@...renesas.com>, "vkoul@...nel.org"
<vkoul@...nel.org>, Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
"geert+renesas@...der.be" <geert+renesas@...der.be>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>
Cc: "dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Claudiu Beznea <claudiu.beznea.uj@...renesas.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v5 2/6] dmaengine: sh: rz-dmac: Move all CHCTRL updates
under spinlock
Hi, Biju,
On 12/17/25 18:16, Biju Das wrote:
> Hi Claudiu,
>
>> -----Original Message-----
>> From: Claudiu <claudiu.beznea@...on.dev>
>> Sent: 17 December 2025 13:52
>> To: vkoul@...nel.org; Fabrizio Castro <fabrizio.castro.jz@...esas.com>; Biju Das
>> <biju.das.jz@...renesas.com>; geert+renesas@...der.be; Prabhakar Mahadev Lad <prabhakar.mahadev-
>> lad.rj@...renesas.com>
>> Cc: Claudiu.Beznea <claudiu.beznea@...on.dev>; dmaengine@...r.kernel.org; linux-
>> kernel@...r.kernel.org; Claudiu Beznea <claudiu.beznea.uj@...renesas.com>; stable@...r.kernel.org
>> Subject: [PATCH v5 2/6] dmaengine: sh: rz-dmac: Move all CHCTRL updates under spinlock
>>
>> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
>>
>> Both rz_dmac_disable_hw() and rz_dmac_irq_handle_channel() update the CHCTRL registers. To avoid
>> concurrency issues when updating these registers, take the virtual channel lock. All other CHCTRL
>> updates were already protected by the same lock.
>>
>> Previously, rz_dmac_disable_hw() disabled and re-enabled local IRQs, before accessing CHCTRL registers
>> but this does not ensure race-free access.
>
> Maybe I am missing some thing here about race-access:
>
> local_irq_save(flags);
> rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1);
>
> After local_irq_save there won't be any IRQ. So how there
> can be a race in IRQ handler.
My point was to address races that may happen b/w different cores trying
to set CHCTRL. E.g.:
core0: take the IRQ and set CHCTRL
core1: call rz_dmac_issue_pending() -> rz_dmac_xfer_desc() ->
rz_dmac_enable_hw() -> set CHCTRL
However, looking again though the HW manual, the CHCTRL returns zero
when it is read, for each individual bit. Thus, there is no need for any
kind of locking around this register. Also, read-modify-write approach
when updating settings though it is not needed.
I'll adjust it in the next version.
Thank you,
Claudiu
Powered by blists - more mailing lists