public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: davem@davemloft.net,
	Pantelis Antoniou <pantelis.antoniou@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com,
	Herve Codina <herve.codina@bootlin.com>,
	Simon Horman <horms@kernel.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH net-next v2 3/7] net: ethernet: fs_enet: drop the .adjust_link custom fs_ops
Date: Wed, 4 Sep 2024 17:50:43 +0200	[thread overview]
Message-ID: <20240904175043.0f198836@fedora.home> (raw)
In-Reply-To: <58cf7db3-4321-4bd9-a422-3642ce59f21f@lunn.ch>

On Wed, 4 Sep 2024 14:36:58 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> On Wed, Sep 04, 2024 at 10:27:11AM +0200, Maxime Chevallier wrote:
> > Hi Andrew,
> > 
> > On Fri, 30 Aug 2024 23:06:08 +0200
> > Andrew Lunn <andrew@lunn.ch> wrote:
> >   
> > > > --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> > > > +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> > > > @@ -649,12 +649,7 @@ static void fs_adjust_link(struct net_device *dev)
> > > >  	unsigned long flags;
> > > >  
> > > >  	spin_lock_irqsave(&fep->lock, flags);
> > > > -
> > > > -	if (fep->ops->adjust_link)
> > > > -		fep->ops->adjust_link(dev);
> > > > -	else
> > > > -		generic_adjust_link(dev);
> > > > -
> > > > +	generic_adjust_link(dev);
> > > >  	spin_unlock_irqrestore(&fep->lock, flags);    
> > > 
> > > Holding a spinlock is pretty unusual. We are in thread context, and
> > > the phydev mutex is held. Looking at generic_adjust_link, do any of
> > > the fep->foo variables actually need protecting, particularly from
> > > changes in interrupts context?  
> > 
> > Yes there are, the interrupt mask/event registers are being accessed
> > from the interrupt handler and the ->restart() hook. I can try to
> > rework this a bit for a cleaner interrupt handling, but I don't have
> > means to test this on all mac flavors (fec/fcc/scc) :(  
> 
> As far as i can see, none of the fep->old* members are accessed
> outside of fs_enet-main.c. There values are not important for the
> restart call. So the spinlock has nothing to do with adjust_link as
> such, but restart. So maybe narrow down the lock to just the restart
> call? But it is not a big issues, just unusual.

I agree with you on that, and this is actually what end-up happening in
the final phylink conversion patch (only the restart() call gets called
wthin the spinlock).

I'll however include a patch that does exactly what you suggest as part
of the phylink conversion, both to make the big port-to-phylink patch
smaller, but also to better document why we only need to care about the
restart() part, if that's ok :)

Thanks,

Maxime

  reply	other threads:[~2024-09-04 15:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 16:15 [PATCH net-next v2 0/7] net: ethernet: fs_enet: Cleanup and phylink conversion Maxime Chevallier
2024-08-29 16:15 ` [PATCH net-next v2 1/7] net: ethernet: fs_enet: convert to SPDX Maxime Chevallier
2024-08-30 20:56   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 2/7] net: ethernet: fs_enet: cosmetic cleanups Maxime Chevallier
2024-08-30 21:00   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 3/7] net: ethernet: fs_enet: drop the .adjust_link custom fs_ops Maxime Chevallier
2024-08-30 21:06   ` Andrew Lunn
2024-09-04  8:27     ` Maxime Chevallier
2024-09-04 12:36       ` Andrew Lunn
2024-09-04 15:50         ` Maxime Chevallier [this message]
2024-08-29 16:15 ` [PATCH net-next v2 4/7] net: ethernet: fs_enet: drop unused phy_info and mii_if_info Maxime Chevallier
2024-08-30 21:06   ` Andrew Lunn
2024-08-30 21:07   ` Andrew Lunn
2024-09-04  8:52     ` Maxime Chevallier
2024-08-29 16:15 ` [PATCH net-next v2 5/7] net: ethernet: fs_enet: fcc: use macros for speed and duplex values Maxime Chevallier
2024-08-30 21:08   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 6/7] net: ethernet: fs_enet: simplify clock handling with devm accessors Maxime Chevallier
2024-08-30 21:09   ` Andrew Lunn
2024-08-29 16:15 ` [PATCH net-next v2 7/7] net: ethernet: fs_enet: phylink conversion Maxime Chevallier
2024-09-03  1:55   ` Jakub Kicinski
2024-09-04 10:49     ` Maxime Chevallier

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=20240904175043.0f198836@fedora.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pantelis.antoniou@gmail.com \
    --cc=thomas.petazzoni@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox