All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Shmuel Hazan <shmuel.h@siklu.com>,
	"mw@semihalf.com" <mw@semihalf.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [RFC PATCH] net: mvpp2: tai: add refcount for ptp worker
Date: Tue, 2 May 2023 09:44:23 +0100	[thread overview]
Message-ID: <ZFDNZ42DmdzrJAdp@shell.armlinux.org.uk> (raw)
In-Reply-To: <fb41eeca-6a75-44cb-9b95-4f8b7ed052f2@lunn.ch>

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!

      reply	other threads:[~2023-05-02  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16 14:30 [RFC PATCH] net: mvpp2: tai: add refcount for ptp worker Shmuel Hazan
2023-04-16 14:52 ` Andrew Lunn
2023-04-16 15:25   ` Shmuel Hazan
2023-04-16 15:40     ` Andrew Lunn
2023-05-02  8:44       ` Russell King (Oracle) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZFDNZ42DmdzrJAdp@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    --cc=shmuel.h@siklu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.