[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <43513e82fcdf84ce363abe31d6998b4f40aaa49f.camel@siklu.com>
Date: Sun, 16 Apr 2023 15:25:55 +0000
From: Shmuel Hazan <shmuel.h@...lu.com>
To: "andrew@...n.ch" <andrew@...n.ch>
CC: "linux@...linux.org.uk" <linux@...linux.org.uk>,
"mw@...ihalf.com" <mw@...ihalf.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: Re: [RFC PATCH] net: mvpp2: tai: add refcount for ptp worker
On Sun, 2023-04-16 at 16:52 +0200, Andrew Lunn wrote:
>
> > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > b/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > index 95862aff49f1..1b57573dd866 100644
> > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > @@ -61,6 +61,7 @@ struct mvpp2_tai {
> > u64 period; // nanosecond period in 32.32 fixed
> > point
> > /* This timestamp is updated every two seconds */
> > struct timespec64 stamp;
> > + u16 poll_worker_refcount;
>
> What lock is protecting this? It would be nice to comment in the
> commit message why it is safe to use a simple u16.
Hi Andrew,
thanks for your response. In theory, the only code path
to these functions (mvpp22_tai_start and mvpp22_tai_stop)
is ioctl (mvpp2_ioctl -> mvpp2_set_ts_config) which should lock
rtnl. However,
It would probably be a good idea to also lock mvpp2_tai->lock too.
As for the integer size, it will be increased once per ethernet device
on that CP, which currently has only maximum of 3 ethernet ports. I
gave it u16 just to be futureproof. However, I can change it to a more
appropriate type if it looks more appropriate to you.
>
> Andrew
Powered by blists - more mailing lists