[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb41eeca-6a75-44cb-9b95-4f8b7ed052f2@lunn.ch>
Date: Sun, 16 Apr 2023 17:40:12 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Shmuel Hazan <shmuel.h@...lu.com>
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, Apr 16, 2023 at 03:25:55PM +0000, Shmuel Hazan wrote:
> 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.
I cannot comment on what locks should be used, i don't know the code.
Which is why as a reviewer, i just want some indication you have
thought about locking, and you think it is safe, given that there are
not obvious locks in the code.
Andrew
Powered by blists - more mailing lists