[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZFDNZ42DmdzrJAdp@shell.armlinux.org.uk>
Date: Tue, 2 May 2023 09:44:23 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Andrew Lunn <andrew@...n.ch>
Cc: Shmuel Hazan <shmuel.h@...lu.com>,
"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 05:40:12PM +0200, Andrew Lunn wrote:
> 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.
... and probably is a good idea to place a comment in the code stating
what the locking for it is.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists