mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, poros@redhat.com, min.li@microchip.com,
	vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com,
	jiri@resnulli.us, kuba@kernel.org, Prathosh.Satish@microchip.com,
	pabeni@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v4 5/5] dpll: zl3073x: notify sibling pin when shared output config changes
Date: Sun, 11 Oct 2026 08:08:22 +0200	[thread overview]
Message-ID: <d4e4faab-002b-47c7-b437-0d8f92f8dbf3@redhat.com> (raw)
In-Reply-To: <179166042422.434549.15231909137129079099@kernel.org>



On 10/10/26 21:27, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found more severe
> issue(s) in other patches of this series. This mail is only an FYI, in case
> you want to address the nit picks below when you respin.
> 
> Low priority / nit picks for your consideration:
> 
> - [Low] Pins that are on the list but not registered get passed to
>    __dpll_pin_change_ntf(), and the new NCO comment is wrong.
> 
> --
> 
> dpll: zl3073x: notify sibling pin when shared output config changes
> 
> This patch adds zl3073x_dpll_output_pin_sibling_get(). It sends a change
> notification for the sibling P/N pin from frequency_set(), esync_set() and
> phase_adjust_set() after zldpll->lock is dropped. Pins are now added to
> zldpll->pins before dpll_pin_register() and removed after
> dpll_pin_unregister(), so a registered sibling can always be found.
> 
>> diff --git a/drivers/dpll/zl3073x/dpll.c b/drivers/dpll/zl3073x/dpll.c
>> index 6d9a6d21d30b7..1d61fe5fe5862 100644
>> --- a/drivers/dpll/zl3073x/dpll.c
>> +++ b/drivers/dpll/zl3073x/dpll.c
> 
> [ ... ]
> 
>> @@ -132,11 +134,42 @@ zl3073x_dpll_pin_get_by_ref(struct zl3073x_dpll *zldpll, u8 ref_id)
>>   	return NULL;
>>   }
>>   
>> +/**
>> + * zl3073x_dpll_output_pin_sibling_get - get the other pin of an output pair
>> + * @pin: output pin whose sibling is sought
>> + *
>> + * Output pin ids are allocated in P/N pairs (P even, N odd) that share a
>> + * single HW output. Looks up the other pin of the pair in the pin list
>> + * of this DPLL. A pin is on the list from just before its registration
>> + * until just after its unregistration, so a registered sibling is always
>> + * found, but the returned pin may also be one that is not (yet or any
>> + * longer) registered.
>> + *
>> + * Return: pointer to sibling pin, or NULL if it is not on the pin list
>> + */
> 
> [ ... ]
> 
>> @@ -937,9 +974,24 @@ zl3073x_dpll_output_pin_esync_set(const struct dpll_pin *dpll_pin,
>>   
>>   	/* Enable 1PPS eSync for this pin frequency */
>>   	zl3073x_out_esync_enable(&out, synth_freq / out.div);
>> -
>> +commit:
>>   	/* Commit output configuration */
>> -	return zl3073x_out_state_set(zldev, out_id, &out);
>> +	rc = zl3073x_out_state_set(zldev, out_id, &out);
>> +	if (rc)
>> +		goto unlock;
>> +
>> +	/* The clock type, esync period and esync width are all shared by
>> +	 * both pins of the output pair, so the sibling pin's esync
>> +	 * configuration changes too and userspace has to be notified.
>> +	 */
>> +	sibling = zl3073x_dpll_output_pin_sibling_get(pin);
>> +unlock:
>> +	mutex_unlock(&zldpll->lock);
>> +
>> +	if (!rc && sibling)
>> +		__dpll_pin_change_ntf(sibling->dpll_pin);
> 
> [Severity: Low]
> 
> The kernel-doc for __dpll_pin_change_ntf() in drivers/dpll/dpll_netlink.c
> says its argument is "@pin: registered pin pointer". The kernel-doc for
> zl3073x_dpll_output_pin_sibling_get() above says the returned pin "may
> also be one that is not (yet or any longer) registered".
> 
> Should the sibling's registration state be checked before it is passed to
> __dpll_pin_change_ntf() here? The same question applies to the matching
> calls in zl3073x_dpll_output_pin_frequency_set() and
> zl3073x_dpll_output_pin_phase_adjust_set().
> 
> __dpll_pin_change_ntf() runs the notifier chain before the
> dpll_pin_available() check in dpll_pin_event_send():
> 
> int __dpll_pin_change_ntf(struct dpll_pin *pin)
> {
> 	lockdep_assert_held(&dpll_lock);
> 	dpll_pin_notify(pin, pin->clock_id, DPLL_PIN_CHANGED);
> 	return dpll_pin_event_send(DPLL_CMD_PIN_CHANGE_NTF, pin);
> }
> 
> This means a notifier subscriber can get DPLL_PIN_CHANGED for a pin
> before it got DPLL_PIN_CREATED, or after it got DPLL_PIN_DELETED.
> 
> It looks like this can happen during probe:
> 
> - zl3073x_dpll_device_register() runs before zl3073x_dpll_pins_register().
> - The P pin (even id) is registered before its N sibling.
> - A userspace PIN_SET on the registered P pin holds dpll_lock.
> - That PIN_SET can find N on the list after list_add(), while
>    dpll_pin_register(N) is still waiting for dpll_lock.
> 
> list_add() now runs before dpll_pin_register() for every pin type. So the
> existing callers of zl3073x_dpll_nco_pin_get() and
> zl3073x_dpll_pin_get_by_ref() can also get a pin that is not registered
> yet and pass it to __dpll_pin_change_ntf(). Before this patch, that could
> only happen during teardown, between dpll_pin_unregister() and list_del().
> 
> As the commit message says, no netlink message is sent for such pins, and
> ice_dpll_pin_notify() ignores DPLL_PIN_CHANGED. So nothing visibly breaks
> today.
> 
> Would a per-pin registered flag be cleaner? It could be set and cleared
> under zldpll->lock around dpll_pin_register() and dpll_pin_unregister(),
> and checked before notifying. Another option is to relax the core
> kernel-doc and have dpll_pin_notify() check registration.

Such a pin gets no netlink notification and the only in-tree notifier
ignores DPLL_PIN_CHANGED, so I would rather not add a registered flag
in a net fix.

> Separately, the new comment in zl3073x_dpll_nco_pin_register() says:
> 
> 	/* Add the pin to the list before registering it with the DPLL core so
> 	 * that the list reflects the DPLL registration state.
> 	 */
> 
> Is this accurate? With the early list_add(), the list holds every
> registered pin and also pins that are not registered yet.

Right, will fix the comment in v5.

Thanks,
Ivan


  reply	other threads:[~2026-10-11  6:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 19:25 [PATCH net v4 0/5] dpll: zl3073x: fix output pin frequency, esync and sibling notifications Ivan Vecera
2026-10-09 19:25 ` [PATCH net v4 1/5] dpll: zl3073x: do not offer 0 Hz as a supported pin frequency Ivan Vecera
2026-10-10 19:27   ` netdev-bot+sashiko
2026-10-11  6:01     ` Ivan Vecera
2026-10-09 19:25 ` [PATCH net v4 2/5] dpll: zl3073x: reject output frequencies with too small divisor Ivan Vecera
2026-10-10 19:27   ` netdev-bot+sashiko
2026-10-11  6:03     ` Ivan Vecera
2026-10-09 19:25 ` [PATCH net v4 3/5] dpll: zl3073x: make embedded sync follow the output carrier frequency Ivan Vecera
2026-10-09 19:25 ` [PATCH net v4 4/5] dpll: zl3073x: reject inexact frequencies for N-divided outputs Ivan Vecera
2026-10-10 19:27   ` netdev-bot+sashiko
2026-10-11  6:05     ` Ivan Vecera
2026-10-09 19:25 ` [PATCH net v4 5/5] dpll: zl3073x: notify sibling pin when shared output config changes Ivan Vecera
2026-10-10 19:27   ` netdev-bot+sashiko
2026-10-11  6:08     ` Ivan Vecera [this message]
2026-10-09 19:29 ` [PATCH net v4 0/5] dpll: zl3073x: fix output pin frequency, esync and sibling notifications netdev-bot+sinfo

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=d4e4faab-002b-47c7-b437-0d8f92f8dbf3@redhat.com \
    --to=ivecera@redhat.com \
    --cc=Prathosh.Satish@microchip.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=min.li@microchip.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=poros@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®