Re: [PATCH net v2] dpll: zl3073x: do not block DPLL callbacks while PTP ops wait

From: Petr Oros

Date: Tue Dec 01 2026 - 03:42:53 EST




On 11/25/26 4:42 PM, Ivan Vecera wrote:
The PTP clock operations hold the channel lock while they wait for the
device: up to 1 s for a pending ToD write to be applied on the next
1 Hz edge, up to 1 s for a previous TIE write and up to 3 s for a
previous output phase step. The DPLL callbacks and the periodic state
check of the channel take the same lock, so they wait as well. The DPLL
callbacks wait under the global dpll_lock, which stalls the requests
for all DPLL devices in the system.

On a GNR-D system with a ZL30732, device-get requests for both DPLL
channels and for a DPLL device of ice took 950 ms in median while
settime() ran in a loop on the PTP clock of channel 0, and 2955 ms
while adjtime() did output phase steps in NCO mode. With this change
they take 2 ms in both cases.

Only the PTP clock operations use the ToD, TIE and phase step
registers. They need the channel lock only for the channel mode and
the list of output pins.

Serialize the PTP clock operations with a new per-channel ptp_lock and
take the channel lock only to read the mode and the output pins and to
issue a TIE write or the first phase step of an adjustment, which also
steps the ToD. Wait for the previous TIE write or phase step before
taking the channel lock, with tie_lock or phase_step_lock held, and
check the mode again under it, so they are issued only in a mode that
supports them. The phase steps for the other synthesizers move only
the outputs and are issued in any mode, so all outputs get the same
step even if the channel leaves NCO mode meanwhile. The lock order is
ptp_lock, then tie_lock or phase_step_lock, then the channel lock.

Reviewed-by: Petr Oros <poros@xxxxxxxxxx>