Netdev List
 help / color / mirror / Atom feed
From: Ali Rouhi <arouhi@sitime.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "jiri@resnulli.us" <jiri@resnulli.us>,
	"vadim.fedorenko@linux.dev" <vadim.fedorenko@linux.dev>,
	"arkadiusz.kubalewski@intel.com" <arkadiusz.kubalewski@intel.com>,
	"ivecera@redhat.com" <ivecera@redhat.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"cjubran@nvidia.com" <cjubran@nvidia.com>,
	"Oleg.Zadorozhnyi@devoxsoftware.com"
	<Oleg.Zadorozhnyi@devoxsoftware.com>,
	"prabhakar.mahadev-lad.rj@bp.renesas.com"
	<prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v15 08/13] dpll: sit9531x: add support to get and set priority on input pins
Date: Thu, 19 Nov 2026 21:20:18 +0000	[thread overview]
Message-ID: <20261119212014.13180-5-arouhi@sitime.com> (raw)
In-Reply-To: <20261117021816.2220207-1-kuba@kernel.org>

On Mon, 16 Nov 2026 18:18:16 -0800, Jakub Kicinski wrote:

> > Keep a priority per input and PLL, seeded from the table the part
> > loaded, and rebuild the table from it on a set. Priority and state are
> > separate: a priority set on a disconnected input applies when it is
> > connected. The range is 0 to 255 over eleven slots; inputs of equal
> > priority keep their table order.
>
> [Severity: Low]
> Most of what this paragraph describes seems to be in the parent commit,
> "dpll: sit9531x: implement input pin state on a DPLL". That commit's
> message doesn't mention priority.
>
> The parent already has these:
>
>   - cfg_prio, cfg_known, seen_srcs and seen_valid in struct sit9531x_chan
>   - sit9531x_prio_cfg_seed()
>   - the reseed in sit9531x_chan_state_fetch()
>   - sit9531x_prio_table_build() ordering by cfg_prio
>   - sit9531x_input_prio_set(), which has no caller there
>
> This patch only adds sit9531x_input_prio_get(), the prio callbacks and the
> capability bits.
>
> Could the priority code move into this patch, so it is reviewed in the
> patch whose message describes it?

Partly agreed. Patch 07 already writes the table when an input is
connected or disconnected, and it has to write it in priority order, so
the ordering stays there and its message will say so.
sit9531x_input_prio_set() has no caller before patch 08 and moves there.

> > A table rewritten outside the driver, by a profile reload or an I2C
> > tool, becomes the new configuration, and the poll notifies the pins
> > whose priority moved.
>
> [Severity: Medium]
> The diff seems to change more than the message says:
>
>   (a) sit9531x_prio_activesel_pick() takes a new routed argument from
>       sit9531x_prio_table_commit(). This changes which source is latched
>       into the active-select nibble on every table commit. That includes
>       the add/remove commits made by the existing state_on_dpll_set path.
>
>   (b) sit9531x_dpll_changes_check() now also notifies on operstate
>       changes. The parent exported operstate_on_dpll_get but never sent a
>       notification when operstate changed.
>
>   (c) The seen first-poll suppression is replaced by
>       sit9531x_dpll_pin_baseline(), which sit9531x_dpll_pins_register()
>       calls before the pin is registered. Changes made between
>       registration and the first poll are now notified.
>
>   (d) Failed pin notifications are now retried through pin->ntf_pending.
>       The poll also no longer goes through ops->state_on_dpll_get.
>
> Could these be described in the commit message, or split into separate
> patches so they can be reviewed and backported on their own?

Agreed, the message now describes all four.

> > +			routed = sit9531x_input_hw_src(chan->routed_ref);
> >  		sel = sit9531x_prio_activesel_pick(sitdev, chan->prio_srcs,
> > -						   srcs, sel);
> > +						   srcs, sel, routed);
> >  		val = sit9531x_prio_slot_set(val, slot + 1, sel);
> >  	}
>
> [Severity: Medium]
> The monitors are re-read live here. chan->routed_ref, however, is the value
> cached by the last sit9531x_chan_state_fetch(), from the previous poll or
> the end of the previous commit. Can it be stale at this point?
>
> The driver's comments say the device falls back between listed sources on
> its own when a source loses signal. The new check in
> sit9531x_prio_activesel_pick() prefers a usable, live, listed routed
> source over the nibble. A stale value could therefore latch a source other
> than the one the PLL is tracking. For example:
>
>   A is latched
>   A loses signal, PLL falls back to B
>   a poll records routed_ref = B
>   A returns
>   B loses signal, PLL falls back to A
>   B returns
>   the priority of an unrelated input C is set before the next poll
>
> The old code keeps A from the nibble. The new code would latch B and move
> the PLL from A to B, on a request that only touched C.
>
> Would reading the routed reference live here, next to
> sit9531x_input_mon_fetch(), avoid this?
>
> There is also the sit9531x_chan_state_fetch() call at the end of a commit.
> It runs right after HO_FORCE is released and only reads the routed
> reference while the PLL is tracking. Does that mean a quick second request
> often sees SIT9531X_REF_INVALID and gets no routed hint at all?

Correct that the routed source is the last poll's sample, at most 500 ms
old, while the monitors are read live; the sequence above needs two
fallbacks inside one poll period. A live read at that point adds a
debug-window transaction to the priority commit while the PLL is held in
forced holdover, so I keep the sampled value in this submission and note
the window in the comment. A request that finds no routed sample, as
right after a commit, keeps the source in the nibble, which is what the
code did before this patch.

> >  /*
> >   * Send notifications for changed lock status and pin state; called from
> >   * sit9531x_dev_periodic_work().
>
> [Severity: Low]
> This isn't a bug, but this comment still mentions only lock status and pin
> state. sit9531x_dpll_changes_check() now also notifies on operstate and
> priority changes, and it retries failed notifications. Should the comment
> cover those as well?

Agreed, comment updated.

> >  		props->dpll_props.type = DPLL_PIN_TYPE_EXT;
> >  		props->dpll_props.capabilities =
> > +			DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE |
> >  			DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;
> >  		curr_freq = sitdev->ref[index].freq;
> >  	} else {
>
> [Severity: Medium]
> Is this capability right for PLLs on manual input select? For those PLLs,
> sit9531x_dpll_pin_ops_get() returns sit9531x_dpll_input_pin_manual_ops.
> That table has no prio_get or prio_set, and its comment says these pins
> have no priority.
>
> The dpll_pin is shared by all four PLLs, so the capability can't differ
> per PLL. On a manual-mode PLL, dpll_pin_prio_set() passes the capability
> check, finds ops->prio_set is NULL and returns -EOPNOTSUPP with no extack
> message.
>
> There is also the poll. sit9531x_dpll_changes_check() still tracks prio
> for these pins through sit9531x_dpll_pin_snapshot(). Would an external
> table rewrite that reseeds cfg_prio then send a dpll_pin_change_ntf()
> whose message has no priority attribute?

The capability is a property of the pin, which the four PLLs share, and
the ops are per pin on a DPLL, so the pin keeps the capability for the
PLLs that arbitrate, and the core returns -EOPNOTSUPP on the manual one.
The poll part is right: the next revision does not track the priority of
a pin on a manual-select PLL, so no notification without a priority
attribute is sent.

  reply	other threads:[~2026-11-19 21:20 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 20:26 [PATCH net-next v15 00/13] dpll: add SiTime SiT9531x DPLL clock driver Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 01/13] dpll: omit pin phase attributes the driver has no value for Ali Rouhi
2026-11-11 15:35   ` Ivan Vecera
2026-11-10 20:26 ` [PATCH net-next v15 02/13] dt-bindings: vendor-prefixes: add SiTime Corporation Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 03/13] dt-bindings: dpll: add SiTime SiT95316 clock generator Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 04/13] dpll: add basic SiTime SiT9531x support Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 05/13] dpll: sit9531x: read DPLL types and pin properties from system firmware Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 06/13] dpll: sit9531x: register DPLL devices and pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 07/13] dpll: sit9531x: implement input pin state on a DPLL Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 08/13] dpll: sit9531x: add support to get and set priority on input pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi [this message]
2026-11-10 20:26 ` [PATCH net-next v15 09/13] dpll: sit9531x: add support to get and set frequency on pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 10/13] dpll: sit9531x: implement output pin state on a DPLL Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 12/13] dpll: sit9531x: add support to get phase offset on the connected input pin Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 11/13] dpll: sit9531x: add support to adjust output phase Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-10 20:26 ` [PATCH net-next v15 13/13] dpll: sit9531x: model the inter-PLL sync line as a pair of pins Ali Rouhi
2026-11-17  2:18   ` Jakub Kicinski
2026-11-19 21:20     ` Ali Rouhi
2026-11-17  9:27 ` [PATCH net-next v15 00/13] dpll: add SiTime SiT9531x DPLL clock driver Paolo Abeni

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=20261119212014.13180-5-arouhi@sitime.com \
    --to=arouhi@sitime.com \
    --cc=Oleg.Zadorozhnyi@devoxsoftware.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=cjubran@nvidia.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --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