All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Allan W. Nielsen" <allan.nielsen@microsemi.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, davem@davemloft.net,
	bcm-kernel-feedback-list@broadcom.com,
	raju.lakkaraju@microsemi.com,
	vivien.didelot@savoirfairelinux.com
Subject: Re: [PATCH net-next 4/5] net: phy: bcm7xxx: Add support for downshift/Wirespeed
Date: Wed, 23 Nov 2016 15:46:36 +0100	[thread overview]
Message-ID: <20161123144636.GK14947@lunn.ch> (raw)
In-Reply-To: <20161123114512.GB25778@microsemi.com>

> > > Maybe we should think about this locking a bit. It is normal for the
> > > lock to be held when using ops in the phy driver structure. The
> > > exception is suspend/resume. Maybe we should also take the lock before
> > > calling the phydev->drv->get_tunable() and phydev->drv->set_tunable()?
> > 
> > Yes, that certainly seems like a good approach to me, let me cook a
> > patch doing that.
> 
> Just for my understanding (such that I will not make the same mistake again)...
> 
> Why is it that phy functions such as get_wol needs to take the phy_lock and
> others like get_tunable does not.
> 
> I do understand the arguments on why the lock should be held by the caller of
> get_tunable, but I do not understand why the same argument does not apply for
> get_wol.

Hi Allan

phy_ethtool_get_wol and friends probably should take the
phy_lock. This inconsistency is probably leading to locking
bugs. e.g. at803x_set_wol() does a read-modify-write, and does not
take the lock.

There is no comment in the patch adding phy_ethtool_set_wol() to say
why the lock is not taken, and a quick look at the code does not
suggest a reason why it could not be taken/released by
phy_ethtool_set_wol().

I think it would be a good idea to change this.

phy_suspend()/phy_resume() might have good reasons to avoid the lock,
i've no idea how it is supposed to work. Is there a danger something
else is holding the lock and has already been suspended? I guess not,
otherwise there is little hope suspend would work at all.

	  Andrew

  reply	other threads:[~2016-11-23 14:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 19:40 [PATCH net-next 0/5] net: phy: broadcom: Wirespeed/downshift support Florian Fainelli
2016-11-22 19:40 ` [PATCH net-next 1/5] net: phy: broadcom: Move bcm54xx_auxctl_{read,write} to common library Florian Fainelli
2016-11-22 19:40 ` [PATCH net-next 2/5] net: phy: broadcom: Add support code for downshift/Wirespeed Florian Fainelli
2016-11-22 19:40 ` [PATCH net-next 3/5] net: phy: broadcom: Allow enabling or disabling of EEE Florian Fainelli
2016-11-22 19:40 ` [PATCH net-next 4/5] net: phy: bcm7xxx: Add support for downshift/Wirespeed Florian Fainelli
2016-11-22 20:02   ` Andrew Lunn
2016-11-22 20:07     ` Florian Fainelli
2016-11-22 20:57       ` Andrew Lunn
2016-11-22 21:01         ` Florian Fainelli
2016-11-23 11:45       ` Allan W. Nielsen
2016-11-23 14:46         ` Andrew Lunn [this message]
2016-11-23 18:16           ` Florian Fainelli
2016-11-22 19:40 ` [PATCH net-next 5/5] net: dsa: bcm_sf2: Ensure we re-negotiate EEE during after link change Florian Fainelli
2016-11-24 20:54 ` [PATCH net-next 0/5] net: phy: broadcom: Wirespeed/downshift support David Miller

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=20161123144636.GK14947@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=allan.nielsen@microsemi.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=raju.lakkaraju@microsemi.com \
    --cc=vivien.didelot@savoirfairelinux.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.