Re: [PATCH net v2] ptp: vclock: Switch from RCU to SRCU

From: Sebastian Andrzej Siewior

Date: Fri May 29 2026 - 13:47:13 EST


On 2026-05-29 19:11:47 [+0200], Kurt Kanzenbach wrote:
> The usage of PTP vClocks leads immediately to the following issues with
> ptp4l with LOCKDEP and DEBUG_ATOMIC_SLEEP enabled: "BUG: sleeping function
> called from invalid context".
>
> ptp_convert_timestamp() acquires a mutex_t within a RCU read section. This
> is illegal, because acquiring a mutex_t can result in voluntary scheduling
> request which is not allowed within a RCU read section.
>
> Replace the RCU usage with SRCU where sleeping is allowed.
>
> Reported-by: Florian Zeitz <florian.zeitz@xxxxxxxxxxxx>
> Closes: https://lore.kernel.org/all/00a8cce8-410e-4038-98af-49be6d93d7bd@xxxxxxxxxxxx/
> Fixes: 67d93ffc0f3c ("ptp: vclock: use mutex to fix "sleep on atomic" bug")
> Signed-off-by: Kurt Kanzenbach <kurt@xxxxxxxxxxxxx>

Reviewed-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

Sebastian