mbox series

[v3,0/3] net: mvpp2: tai: add extts support

Message ID 20230419151457.22411-1-shmuel.h@siklu.com
Headers show
Series net: mvpp2: tai: add extts support | expand

Message

Shmuel Hazan April 19, 2023, 3:14 p.m. UTC
This patch series adds support for PTP event capture on the Aramda
80x0/70x0. This feature is mainly used by tools linux ts2phc(3) in order
to synchronize a timestamping unit (like the mvpp2's TAI) and a system
DPLL on the same PCB. 

The patch series includes 3 patches: the second one implements the
actual extts function.

Changes in v2:
	* Fixed a deadlock in the poll worker.
	* Removed tabs from comments.

Changes in v3:
	* Added more explanation about the change in behavior in mvpp22_tai_start.
	* Explain the reason for choosing 95ms as a polling rate.

Shmuel Hazan (3):
  net: mvpp2: tai: add refcount for ptp worker
  net: mvpp2: tai: add extts support
  dt-bindings: net: marvell,pp2: add extts docs

 .../devicetree/bindings/net/marvell,pp2.yaml  |  18 +
 .../net/ethernet/marvell/mvpp2/mvpp2_tai.c    | 334 ++++++++++++++++--
 2 files changed, 317 insertions(+), 35 deletions(-)


base-commit: 3e7bb4f2461710b70887704af7f175383251088e

Comments

Shmuel Hazan April 30, 2023, 5:09 p.m. UTC | #1
On Thu, 2023-04-20 at 20:20 -0700, Jakub Kicinski wrote:
> > Caution: This is an external email. Please take care when clicking
> > links or opening attachments.
> > 
> > 
> > On Wed, 19 Apr 2023 18:14:55 +0300 Shmuel Hazan wrote:
> > > > +static void mvpp22_tai_stop_unlocked(struct mvpp2_tai *tai)
> > > > +{
> > > > +     tai->poll_worker_refcount--;
> > > > +     if (tai->poll_worker_refcount)
> > > > +             return;
> > > > +     ptp_cancel_worker_sync(tai->ptp_clock);
> > 
> > How can you cancel it _sync() when the work takes the same
> > lock you're already holding?
> > 
> > https://elixir.bootlin.com/linux/v6.3-rc7/source/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c#L246


Hi Jakub,

Thanks for finding that. Strange that I have not encountered any
deadlocks while testing; I will apply a fix and resend after testing
it.  

> > 
> > > >  void mvpp22_tai_stop(struct mvpp2_tai *tai)
> > > >  {
> > > > -     ptp_cancel_worker_sync(tai->ptp_clock);
> > > > +     unsigned long flags;
> > > > +
> > > > +     spin_lock_irqsave(&tai->lock, flags);
> > > > +     mvpp22_tai_stop_unlocked(tai);
> > 
> > --
> > pw-bot: cr