🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
8 messages
8 total messages Started by Jakub Kicinski Tue, 17 Nov 2026 02:16
Re: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#17574
Author: Jakub Kicinski
Date: Tue, 17 Nov 2026 02:16
15 lines
9119 bytes
On Wed, 11 Nov 2026 17:40:11 +0100 Ivan Vecera wrote:
> dpll_lock protects topology and object lifetime, but it also serializes
> all driver callbacks in the system, so one slow device stalls every other
> DPLL device, whichever driver it belongs to. mlx5 callbacks issue firmware
> commands with a 60 s default timeout, and zl3073x callbacks can wait
> seconds on a driver lock held across ToD writes and phase steps.

Can you provide some real life data of how much this actually helps?
Real device topology + scenario you hit?

For the cross-domain pins - shouldn't we stretch the domain to cover
all interconnected objects on the system instead of hoping people get
lock ordering right? You documented some rules in the doc, admittedly,
but not sure how enforceable and practical they are.
Re: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#18890
Author: Jakub Kicinski
Date: Thu, 19 Nov 2026 01:44
37 lines
10271 bytes
On Wed, 18 Nov 2026 16:29:23 +0100 Ivan Vecera wrote:
> A step of the zl3073x PHC, which ptp4l and ts2phc do at start and after
> a large offset, waits for the next 1 PPS edge, up to 1 s, with the
> channel lock held. A phase step can hold it for up to 3 s while it
> waits for the previous one. A dpll callback of that channel waits for
> the lock under dpll_lock, and every other DPLL request and notification
> in the system waits behind it. With ToD writes running, requests to an
> ice DPLL took 1448 ms in median and 3.9 s at most. With the series they
> took 0.2 ms and 0.3 ms, the same as idle.
> 
> The bigger reason are zl3073x callbacks we are working on, which have
> to wait for the hardware themselves:
> 
> - a device reset with resync waits for the fast lock, up to 1 s with a
>    1 PPS input
> - a glitchless stop or start of an output completes on an output edge,
>    so it takes up to one period, 1 s for a 1 PPS output
> 
> Holding the global dpll_lock for that long would stall every DPLL
> device in the system. For the output state we tried an asynchronous
> implementation, but then the callback returns success before it knows
> the result. 

Right, for these level of waiting async seems like the right direction,
at least naively/without knowing the HW.  Why does the device wait until
PPS to apply the step change? Is the programmed time supposed to
correspond to the pulse?

> A failure can only be reported by a later notification, and
> the next request gets -EBUSY until the change completes. With a lock
> per chip the callback can simply wait, and one chip cannot do these
> operations in parallel anyway.

Do the failures only happen because of "unforeseen circumstances" / EIO,
or there may be more common errors reported? If it's just the former
a devlink health reporter could be an option.
Re: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#19389
Author: Jakub Kicinski
Date: Thu, 19 Nov 2026 21:38
54 lines
11470 bytes
On Thu, 19 Nov 2026 13:29:11 +0100 Ivan Vecera wrote:
> > Right, for these level of waiting async seems like the right direction,
> > at least naively/without knowing the HW.  Why does the device wait until
> > PPS to apply the step change? Is the programmed time supposed to
> > correspond to the pulse?  
> 
> Yes. The device has no immediate ToD write, it can only write the ToD
> on the next internal 1 Hz edge, the next input sync edge or the next
> internal 0.5 Hz edge. The written value is the time at that edge, so
> the seconds stay aligned with the 1 PPS outputs.
> 
> Looking at it again, the zl3073x holds the channel lock while it waits
> for the edge, although the dpll callbacks do not touch the ToD, TIE or
> phase step registers, and they already run while the device applies
> such an operation, because the PTP ops return right after issuing it.
> I will look at narrowing the lock in the driver.
> 
> For the resync, async is not only about reporting the result. Fast lock
> is a setting of the DPLL, not of a reference, and forcing it makes the
> DPLL ignore its frequency and phase error monitors. While an
> asynchronous resync is pending, everything else done to the DPLL runs
> in forced fast lock. A reference switch, whether from a priority or
> state change, a manual reference or the device itself in automatic
> mode, would follow the fast lock phase rate instead of the configured
> phase slope limit, and the resync would then report success on another
> reference. A switch to NCO would keep the force bit set until the work
> clears it. So every request changing the DPLL configuration would have
> to fail with -EBUSY, cancel the resync, or wait for it. With a lock per
> chip they simply wait, for at most 1 s.
> 
> > Do the failures only happen because of "unforeseen circumstances" / EIO,
> > or there may be more common errors reported? If it's just the former
> > a devlink health reporter could be an option.  
> 
> For the output start and stop, only EIO. The device does not report a
> stopped output and the driver can only wait for one period, so a health
> reporter would work there.
> 
> 
> For the resync, no. The wait ends with -ETIMEDOUT when the DPLL does
> not enter fast lock, for example because the selected reference lost
> its qualification in the meantime. That is a result of the input
> signal the user needs in the reply, not a device fault.
> 
> Beyond the zl3073x, with the global lock any callback that waits for
> its device, for example an mlx5 firmware command with its 60 s timeout,
> stalls the DPLL devices of every other driver in the system.

Well, I'm not convinced. The relations between objects in DPLL are
already quite hard to follow, and objects from one driver routinely
"plug" into objects from another. The explanation of the locking
rules in patch 9 does not look clean or clear. The driver facing
API needs to be much more "dummy-proof".
Re: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#19943
Author: Vadim Fedorenko
Date: Fri, 20 Nov 2026 20:00
113 lines
14562 bytes
On 20/11/2026 07:39, Ivan Vecera wrote:
> On 11/19/26 22:38, Jakub Kicinski wrote:
>> Well, I'm not convinced. The relations between objects in DPLL are
>> already quite hard to follow, and objects from one driver routinely
>> "plug" into objects from another. The explanation of the locking
>> rules in patch 9 does not look clean or clear. The driver facing
>> API needs to be much more "dummy-proof".
> 
> Fair enough. The complicated part of the rules comes exactly from
> that: a pin registered by another driver, like the zl3073x pins that
> ice registers with its TXC DPLL or uses as parents of its RCLK pins.
> A message about such a pin runs callbacks of both drivers. I have
> prototypes of the first four ways below to lock this, each with KUnit
> tests, and would like your opinion before going further.
> 
> In all of them a domain is the set of objects created with the same
> module and clock_id, dpll_lock becomes an rwsem for the topology and
> lifetime, and a mutex per domain serializes the callbacks.
> 
> A) Pin's domain (this series)
> 
>     Callbacks of a pin run under the domain of the pin, whichever
>     driver registered them.
> 
>     Pros:
>     * one domain lock at a time, so no lock order
>     * a request or a message about a pin is atomic
>     Cons:
>     * the callbacks of a foreign pin are serialized with the driver
>       that created the pin, not with the other callbacks of the driver
>       that registered it, so that driver has to protect the shared
>       state itself, and lockdep cannot check it
>     * restrictions for measured_freq_get, reference sync pairs and the
>       private data of a parent pin, which patch 9 has to explain
> 
> B) Registrant's domain, deferred notifications
> 
>     Each callback runs under the domain of the driver that registered
>     it. A message about a pin takes the domain locks one after another,
>     and notifications from callbacks are queued and sent once the
>     domain lock is dropped.
> 
>     Pros:
>     * callbacks registered by one driver instance are always
>       serialized with each other
>     * one domain lock at a time, so no lock order
>     Cons:
>     * a request or a message about a pin registered across domains is
>       not atomic
>     * the most complex core: a notification queue per domain, a lock
>       per object to keep its messages in order, and pin setters split
>       into validation and apply parts
> 
> C) Registrant's domain nested under the pin's domain
> 
>     Pros:
>     * callbacks registered by one driver instance are serialized with
>       each other and with the driver that created the pin
>     * a request or a message about a pin is atomic
>     Cons:
>     * the lock order comes from the topology, so a pin of A registered
>       with a DPLL of B together with a pin of B registered with a DPLL
>       of A deadlocks, and lockdep sees it only with a lockdep class per
>       domain
>     * a stuck foreign registrant stops the domain of the pin
> 
> D) Merged domains (your suggestion)
> 
>     Registering a pin with a DPLL or a parent pin of another domain
>     merges both domains. They are not split again.
> 
>     Pros:
>     * the rules for drivers stay as they are with the global lock
>       today, and lockdep checks them; the only new one is that state
>       shared between chips not connected by a pin needs a driver lock
>     * a request or a message is atomic
>     Cons:
>     * only hardware not connected by pins runs in parallel; on the
>       GNR-D system the zl3073x and all ice PFs end up in one domain
>     * a callback that waits for the hardware, like the planned resync
>       for up to 1 s, or for firmware still stalls all DPLL devices in
>       the merged domain
> 
> E) Global dpll_lock, slow callbacks asynchronous
> 
>     Pros:
>     * no change in the core
>     Cons:
>     * the resync problems from my previous mail, and a callback that
>       waits for firmware still stalls all DPLL devices in the system
> 
> I wrote before that stretching the domains would not improve
> anything on that system. That holds for the ToD stall I measured,
> but the zl3073x does not need to hold its channel lock across the
> edge waits. Without that, the remaining waits are the planned resync
> and output state callbacks, and with D they stall only the devices
> wired to that chip, which depend on it anyway.
> 
> So I lean towards D, as it gives drivers nothing new to get right.
> Would that address your concern, or do you see a better way?
> 
> It would be good to hear from the other DPLL maintainers as well.
> Jiri, Vadim, Arkadiusz, what do you think?

I totally agree with Jakub. Current implementation of DPLL subsystem is
over complicated, and all these complications came just to completely
model what was designed for Intel NICs, basically ice driver. But now we
are again back to the discussion how to complicate things further just
to fit what was implemented in the new generation of the same hardware.

Maybe it's time to step back and think if we really need all this, or
find simpler way to express/model things?
Re: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#20457
Author: Jiri Pirko
Date: Sun, 22 Nov 2026 15:54
116 lines
17097 bytes
Fri, Nov 20, 2026 at 09:00:27PM +0100, vadim.fedorenko@linux.dev wrote:
>On 20/11/2026 07:39, Ivan Vecera wrote:
>> On 11/19/26 22:38, Jakub Kicinski wrote:
>> > Well, I'm not convinced. The relations between objects in DPLL are
>> > already quite hard to follow, and objects from one driver routinely
>> > "plug" into objects from another. The explanation of the locking
>> > rules in patch 9 does not look clean or clear. The driver facing
>> > API needs to be much more "dummy-proof".
>> 
>> Fair enough. The complicated part of the rules comes exactly from
>> that: a pin registered by another driver, like the zl3073x pins that
>> ice registers with its TXC DPLL or uses as parents of its RCLK pins.
>> A message about such a pin runs callbacks of both drivers. I have
>> prototypes of the first four ways below to lock this, each with KUnit
>> tests, and would like your opinion before going further.
>> 
>> In all of them a domain is the set of objects created with the same
>> module and clock_id, dpll_lock becomes an rwsem for the topology and
>> lifetime, and a mutex per domain serializes the callbacks.
>> 
>> A) Pin's domain (this series)
>> 
>>     Callbacks of a pin run under the domain of the pin, whichever
>>     driver registered them.
>> 
>>     Pros:
>>     * one domain lock at a time, so no lock order
>>     * a request or a message about a pin is atomic
>>     Cons:
>>     * the callbacks of a foreign pin are serialized with the driver
>>       that created the pin, not with the other callbacks of the driver
>>       that registered it, so that driver has to protect the shared
>>       state itself, and lockdep cannot check it
>>     * restrictions for measured_freq_get, reference sync pairs and the
>>       private data of a parent pin, which patch 9 has to explain
>> 
>> B) Registrant's domain, deferred notifications
>> 
>>     Each callback runs under the domain of the driver that registered
>>     it. A message about a pin takes the domain locks one after another,
>>     and notifications from callbacks are queued and sent once the
>>     domain lock is dropped.
>> 
>>     Pros:
>>     * callbacks registered by one driver instance are always
>>       serialized with each other
>>     * one domain lock at a time, so no lock order
>>     Cons:
>>     * a request or a message about a pin registered across domains is
>>       not atomic
>>     * the most complex core: a notification queue per domain, a lock
>>       per object to keep its messages in order, and pin setters split
>>       into validation and apply parts
>> 
>> C) Registrant's domain nested under the pin's domain
>> 
>>     Pros:
>>     * callbacks registered by one driver instance are serialized with
>>       each other and with the driver that created the pin
>>     * a request or a message about a pin is atomic
>>     Cons:
>>     * the lock order comes from the topology, so a pin of A registered
>>       with a DPLL of B together with a pin of B registered with a DPLL
>>       of A deadlocks, and lockdep sees it only with a lockdep class per
>>       domain
>>     * a stuck foreign registrant stops the domain of the pin
>> 
>> D) Merged domains (your suggestion)
>> 
>>     Registering a pin with a DPLL or a parent pin of another domain
>>     merges both domains. They are not split again.
>> 
>>     Pros:
>>     * the rules for drivers stay as they are with the global lock
>>       today, and lockdep checks them; the only new one is that state
>>       shared between chips not connected by a pin needs a driver lock
>>     * a request or a message is atomic
>>     Cons:
>>     * only hardware not connected by pins runs in parallel; on the
>>       GNR-D system the zl3073x and all ice PFs end up in one domain
>>     * a callback that waits for the hardware, like the planned resync
>>       for up to 1 s, or for firmware still stalls all DPLL devices in
>>       the merged domain
>> 
>> E) Global dpll_lock, slow callbacks asynchronous
>> 
>>     Pros:
>>     * no change in the core
>>     Cons:
>>     * the resync problems from my previous mail, and a callback that
>>       waits for firmware still stalls all DPLL devices in the system
>> 
>> I wrote before that stretching the domains would not improve
>> anything on that system. That holds for the ToD stall I measured,
>> but the zl3073x does not need to hold its channel lock across the
>> edge waits. Without that, the remaining waits are the planned resync
>> and output state callbacks, and with D they stall only the devices
>> wired to that chip, which depend on it anyway.
>> 
>> So I lean towards D, as it gives drivers nothing new to get right.
>> Would that address your concern, or do you see a better way?
>> 
>> It would be good to hear from the other DPLL maintainers as well.
>> Jiri, Vadim, Arkadiusz, what do you think?
>
>I totally agree with Jakub. Current implementation of DPLL subsystem is
>over complicated, and all these complications came just to completely
>model what was designed for Intel NICs, basically ice driver. But now we
>are again back to the discussion how to complicate things further just
>to fit what was implemented in the new generation of the same hardware.
>
>Maybe it's time to step back and think if we really need all this, or
>find simpler way to express/model things?

Agreed.
RE: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#22637
Author: "Kubalewski, Arkadiusz"
Date: Wed, 25 Nov 2026 15:36
79 lines
28052 bytes
>From: Ivan Vecera <ivecera@redhat.com>
>Sent: Thursday, November 19, 2026 1:29 PM
>
>On 11/19/26 02:44, Jakub Kicinski wrote:
>> On Wed, 18 Nov 2026 16:29:23 +0100 Ivan Vecera wrote:
>>> A step of the zl3073x PHC, which ptp4l and ts2phc do at start and
>>> after a large offset, waits for the next 1 PPS edge, up to 1 s, with
>>> the channel lock held. A phase step can hold it for up to 3 s while
>>> it waits for the previous one. A dpll callback of that channel waits
>>> for the lock under dpll_lock, and every other DPLL request and
>>> notification in the system waits behind it. With ToD writes running,
>>> requests to an ice DPLL took 1448 ms in median and 3.9 s at most.
>>> With the series they took 0.2 ms and 0.3 ms, the same as idle.
>>>
>>> The bigger reason are zl3073x callbacks we are working on, which have
>>> to wait for the hardware themselves:
>>>
>>> - a device reset with resync waits for the fast lock, up to 1 s with a
>>>     1 PPS input
>>> - a glitchless stop or start of an output completes on an output edge,
>>>     so it takes up to one period, 1 s for a 1 PPS output
>>>
>>> Holding the global dpll_lock for that long would stall every DPLL
>>> device in the system. For the output state we tried an asynchronous
>>> implementation, but then the callback returns success before it knows
>>> the result.
>>
>> Right, for these level of waiting async seems like the right
>> direction, at least naively/without knowing the HW.  Why does the
>> device wait until PPS to apply the step change? Is the programmed time
>> supposed to correspond to the pulse?
>
>Yes. The device has no immediate ToD write, it can only write the ToD on
>the next internal 1 Hz edge, the next input sync edge or the next internal
>0.5 Hz edge. The written value is the time at that edge, so the seconds
>stay aligned with the 1 PPS outputs.
>
>Looking at it again, the zl3073x holds the channel lock while it waits for
>the edge, although the dpll callbacks do not touch the ToD, TIE or phase
>step registers, and they already run while the device applies such an
>operation, because the PTP ops return right after issuing it.
>I will look at narrowing the lock in the driver.
>
>For the resync, async is not only about reporting the result. Fast lock is
>a setting of the DPLL, not of a reference, and forcing it makes the DPLL
>ignore its frequency and phase error monitors. While an asynchronous
>resync is pending, everything else done to the DPLL runs in forced fast
>lock. A reference switch, whether from a priority or state change, a
>manual reference or the device itself in automatic mode, would follow the
>fast lock phase rate instead of the configured phase slope limit, and the
>resync would then report success on another reference. A switch to NCO
>would keep the force bit set until the work clears it. So every request
>changing the DPLL configuration would have to fail with -EBUSY, cancel the
>resync, or wait for it. With a lock per chip they simply wait, for at most
>1 s.
>
>>> A failure can only be reported by a later notification, and the next
>>> request gets -EBUSY until the change completes. With a lock per chip
>>> the callback can simply wait, and one chip cannot do these operations
>>> in parallel anyway.
>>
>> Do the failures only happen because of "unforeseen circumstances" /
>> EIO, or there may be more common errors reported? If it's just the
>> former a devlink health reporter could be an option.
>
>For the output start and stop, only EIO. The device does not report a
>stopped output and the driver can only wait for one period, so a health
>reporter would work there.
>
>
>For the resync, no. The wait ends with -ETIMEDOUT when the DPLL does not
>enter fast lock, for example because the selected reference lost its
>qualification in the meantime. That is a result of the input signal the
>user needs in the reply, not a device fault.

Nevertheless we need mechanic to do it async? Or add a timeout for callback
on dpll side? This global lock was never intended to wait a second (or below
pointed 60 seconds) for the HW to respond.

Thanks,
Arkadiusz
 
>
>Beyond the zl3073x, with the global lock any callback that waits for its
>device, for example an mlx5 firmware command with its 60 s timeout, stalls
>the DPLL devices of every other driver in the system.
>
>Thanks,
>Ivan
RE: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#22636
Author: "Kubalewski, Arkadiusz"
Date: Wed, 25 Nov 2026 15:46
89 lines
28752 bytes
>From: Ivan Vecera <ivecera@redhat.com>
>Sent: Friday, November 20, 2026 8:39 AM
>
>On 11/19/26 22:38, Jakub Kicinski wrote:
>> Well, I'm not convinced. The relations between objects in DPLL are
>> already quite hard to follow, and objects from one driver routinely
>> "plug" into objects from another. The explanation of the locking rules
>> in patch 9 does not look clean or clear. The driver facing API needs
>> to be much more "dummy-proof".
>
>Fair enough. The complicated part of the rules comes exactly from
>that: a pin registered by another driver, like the zl3073x pins that ice
>registers with its TXC DPLL or uses as parents of its RCLK pins.
>A message about such a pin runs callbacks of both drivers. I have
>prototypes of the first four ways below to lock this, each with KUnit
>tests, and would like your opinion before going further.
>
>In all of them a domain is the set of objects created with the same module
>and clock_id, dpll_lock becomes an rwsem for the topology and lifetime,
>and a mutex per domain serializes the callbacks.
>
>A) Pin's domain (this series)
>
>    Callbacks of a pin run under the domain of the pin, whichever
>    driver registered them.
>
>    Pros:
>    * one domain lock at a time, so no lock order
>    * a request or a message about a pin is atomic
>    Cons:
>    * the callbacks of a foreign pin are serialized with the driver
>      that created the pin, not with the other callbacks of the driver
>      that registered it, so that driver has to protect the shared
>      state itself, and lockdep cannot check it
>    * restrictions for measured_freq_get, reference sync pairs and the
>      private data of a parent pin, which patch 9 has to explain
>
>B) Registrant's domain, deferred notifications
>
>    Each callback runs under the domain of the driver that registered
>    it. A message about a pin takes the domain locks one after another,
>    and notifications from callbacks are queued and sent once the
>    domain lock is dropped.
>
>    Pros:
>    * callbacks registered by one driver instance are always
>      serialized with each other
>    * one domain lock at a time, so no lock order
>    Cons:
>    * a request or a message about a pin registered across domains is
>      not atomic
>    * the most complex core: a notification queue per domain, a lock
>      per object to keep its messages in order, and pin setters split
>      into validation and apply parts
>
>C) Registrant's domain nested under the pin's domain
>
>    Pros:
>    * callbacks registered by one driver instance are serialized with
>      each other and with the driver that created the pin
>    * a request or a message about a pin is atomic
>    Cons:
>    * the lock order comes from the topology, so a pin of A registered
>      with a DPLL of B together with a pin of B registered with a DPLL
>      of A deadlocks, and lockdep sees it only with a lockdep class per
>      domain
>    * a stuck foreign registrant stops the domain of the pin
>
>D) Merged domains (your suggestion)
>
>    Registering a pin with a DPLL or a parent pin of another domain
>    merges both domains. They are not split again.
>
>    Pros:
>    * the rules for drivers stay as they are with the global lock
>      today, and lockdep checks them; the only new one is that state
>      shared between chips not connected by a pin needs a driver lock
>    * a request or a message is atomic
>    Cons:
>    * only hardware not connected by pins runs in parallel; on the
>      GNR-D system the zl3073x and all ice PFs end up in one domain
>    * a callback that waits for the hardware, like the planned resync
>      for up to 1 s, or for firmware still stalls all DPLL devices in
>      the merged domain
>
>E) Global dpll_lock, slow callbacks asynchronous
>
>    Pros:
>    * no change in the core
>    Cons:
>    * the resync problems from my previous mail, and a callback that
>      waits for firmware still stalls all DPLL devices in the system
>
>I wrote before that stretching the domains would not improve anything on
>that system. That holds for the ToD stall I measured, but the zl3073x does
>not need to hold its channel lock across the edge waits. Without that, the
>remaining waits are the planned resync and output state callbacks, and
>with D they stall only the devices wired to that chip, which depend on it
>anyway.
>
>So I lean towards D, as it gives drivers nothing new to get right.
>Would that address your concern, or do you see a better way?
>
>It would be good to hear from the other DPLL maintainers as well.
>Jiri, Vadim, Arkadiusz, what do you think?
>
>Thanks,
>Ivan

AFAIU,
Global lock is not a problem here, the dpll subsystem shall not wait
for the callback return that long, as mentioned, it has impact for
different devices, so no one shall selfishly take it for that long.

Thank you!
Arkadiusz.
RE: [PATCH net-next v2 0/9] dpll: do not serialize driver callbacks under global dpll_lock
#22661
Author: "Kubalewski, Arkadiusz"
Date: Wed, 25 Nov 2026 15:56
115 lines
31090 bytes
>From: Ivan Vecera <ivecera@redhat.com>
>Sent: Wednesday, November 25, 2026 3:32 PM
>
>On 11/22/26 16:54, Jiri Pirko wrote:
>> Fri, Nov 20, 2026 at 09:00:27PM +0100, vadim.fedorenko@linux.dev wrote:
>>> On 20/11/2026 07:39, Ivan Vecera wrote:
>>>> On 11/19/26 22:38, Jakub Kicinski wrote:
>>>>> Well, I'm not convinced. The relations between objects in DPLL are
>>>>> already quite hard to follow, and objects from one driver routinely
>>>>> "plug" into objects from another. The explanation of the locking
>>>>> rules in patch 9 does not look clean or clear. The driver facing
>>>>> API needs to be much more "dummy-proof".
>>>>
>>>> Fair enough. The complicated part of the rules comes exactly from
>>>> that: a pin registered by another driver, like the zl3073x pins that
>>>> ice registers with its TXC DPLL or uses as parents of its RCLK pins.
>>>> A message about such a pin runs callbacks of both drivers. I have
>>>> prototypes of the first four ways below to lock this, each with
>>>> KUnit tests, and would like your opinion before going further.
>>>>
>>>> In all of them a domain is the set of objects created with the same
>>>> module and clock_id, dpll_lock becomes an rwsem for the topology and
>>>> lifetime, and a mutex per domain serializes the callbacks.
>>>>
>>>> A) Pin's domain (this series)
>>>>
>>>>      Callbacks of a pin run under the domain of the pin, whichever
>>>>      driver registered them.
>>>>
>>>>      Pros:
>>>>      * one domain lock at a time, so no lock order
>>>>      * a request or a message about a pin is atomic
>>>>      Cons:
>>>>      * the callbacks of a foreign pin are serialized with the driver
>>>>        that created the pin, not with the other callbacks of the
>>>>driver
>>>>        that registered it, so that driver has to protect the shared
>>>>        state itself, and lockdep cannot check it
>>>>      * restrictions for measured_freq_get, reference sync pairs and
>>>>the
>>>>        private data of a parent pin, which patch 9 has to explain
>>>>
>>>> B) Registrant's domain, deferred notifications
>>>>
>>>>      Each callback runs under the domain of the driver that registered
>>>>      it. A message about a pin takes the domain locks one after
>>>>another,
>>>>      and notifications from callbacks are queued and sent once the
>>>>      domain lock is dropped.
>>>>
>>>>      Pros:
>>>>      * callbacks registered by one driver instance are always
>>>>        serialized with each other
>>>>      * one domain lock at a time, so no lock order
>>>>      Cons:
>>>>      * a request or a message about a pin registered across domains is
>>>>        not atomic
>>>>      * the most complex core: a notification queue per domain, a lock
>>>>        per object to keep its messages in order, and pin setters split
>>>>        into validation and apply parts
>>>>
>>>> C) Registrant's domain nested under the pin's domain
>>>>
>>>>      Pros:
>>>>      * callbacks registered by one driver instance are serialized with
>>>>        each other and with the driver that created the pin
>>>>      * a request or a message about a pin is atomic
>>>>      Cons:
>>>>      * the lock order comes from the topology, so a pin of A
>>>>registered
>>>>        with a DPLL of B together with a pin of B registered with a
>>>>DPLL
>>>>        of A deadlocks, and lockdep sees it only with a lockdep class
>>>>per
>>>>        domain
>>>>      * a stuck foreign registrant stops the domain of the pin
>>>>
>>>> D) Merged domains (your suggestion)
>>>>
>>>>      Registering a pin with a DPLL or a parent pin of another domain
>>>>      merges both domains. They are not split again.
>>>>
>>>>      Pros:
>>>>      * the rules for drivers stay as they are with the global lock
>>>>        today, and lockdep checks them; the only new one is that state
>>>>        shared between chips not connected by a pin needs a driver lock
>>>>      * a request or a message is atomic
>>>>      Cons:
>>>>      * only hardware not connected by pins runs in parallel; on the
>>>>        GNR-D system the zl3073x and all ice PFs end up in one domain
>>>>      * a callback that waits for the hardware, like the planned resync
>>>>        for up to 1 s, or for firmware still stalls all DPLL devices in
>>>>        the merged domain
>>>>
>>>> E) Global dpll_lock, slow callbacks asynchronous
>>>>
>>>>      Pros:
>>>>      * no change in the core
>>>>      Cons:
>>>>      * the resync problems from my previous mail, and a callback that
>>>>        waits for firmware still stalls all DPLL devices in the
>>>> system
>>>>
>>>> I wrote before that stretching the domains would not improve
>>>> anything on that system. That holds for the ToD stall I measured,
>>>> but the zl3073x does not need to hold its channel lock across the
>>>> edge waits. Without that, the remaining waits are the planned resync
>>>> and output state callbacks, and with D they stall only the devices
>>>> wired to that chip, which depend on it anyway.
>>>>
>>>> So I lean towards D, as it gives drivers nothing new to get right.
>>>> Would that address your concern, or do you see a better way?
>>>>
>>>> It would be good to hear from the other DPLL maintainers as well.
>>>> Jiri, Vadim, Arkadiusz, what do you think?
>>>
>>> I totally agree with Jakub. Current implementation of DPLL subsystem
>>> is over complicated, and all these complications came just to
>>> completely model what was designed for Intel NICs, basically ice
>>> driver. But now we are again back to the discussion how to complicate
>>> things further just to fit what was implemented in the new generation
>>>of the same hardware.
>>>
>>> Maybe it's time to step back and think if we really need all this, or
>>> find simpler way to express/model things?
>>
>> Agreed.
>
>I fully agree with you guys... I also don't like the way how the ice
>implemented pin sharing 

Could you elaborate on that?

Thank you!
Arkadiusz

>and thinking more about Vadim's "Maybe it's time
>to step back...".
>I have started an effort how to model this differently without any inter-
>driver DPLL object sharing.
>
>I will send a RFC patch-set that should address hopefully all painful
>points.
>
>Thanks,
>Ivan

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads