[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <808b7ab5-dc30-483b-81cc-397f14683963@quicinc.com>
Date: Thu, 5 Jun 2025 17:52:31 -0700
From: "Abhishek Chauhan (ABC)" <quic_abchauha@...cinc.com>
To: Wei Fang <wei.fang@....com>, Russell King <linux@...linux.org.uk>
CC: Florian Fainelli <f.fainelli@...il.com>,
"andrew@...n.ch"
<andrew@...n.ch>,
"hkallweit1@...il.com" <hkallweit1@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com"
<edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"xiaolei.wang@...driver.com"
<xiaolei.wang@...driver.com>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>,
Sarosh Hasan <quic_sarohasa@...cinc.com>
Subject: Re: [PATCH v2 net] net: phy: clear phydev->devlink when the link is
deleted
On 6/4/2025 5:08 AM, Wei Fang wrote:
>> On Wed, Jun 04, 2025 at 06:00:54AM +0000, Wei Fang wrote:
>>> I think this issue is also introduced by the commit bc66fa87d4fd
>>> ("net: phy: Add link between phy dev and mac dev"). I suggested
>>> to change the DL_FLAG_STATELESS flag to
>>> DL_FLAG_AUTOREMOVE_SUPPLIER to solve this issue, so that
>>> the consumer (MAC controller) driver will be automatically removed
>>> when the link is removed. The changes are as follows.
>>
>> I suspect this still has problems. This is fine if the PHY device is
>> going away and as you say device_del() is called.
>>
>> However, you need to consider the case where a MAC driver attaches the
>> PHY during .ndo_open and releases it during .ndo_release. These will
>> happen multiple times.
>
> .ndo_release? Do you mean .ndo_stop?
>
>>
>> Each time the MAC driver attaches to the PHY via .ndo_open, we will
>> call device_link_add(), but the device link will not be removed when
>> .ndo_release is called.
>>
>> Either device_link_add() will fail, or we will eat memory each time
>> the device is closed and re-opened.
>
> Below is what I find in the kernel doc of device_link_add().
> https://elixir.bootlin.com/linux/v6.15/source/drivers/base/core.c#L711
>
> if a device link between the given @consumer and @supplier pair
> exists already when this function is called for them, the existing link will
> be returned regardless of its current type and status.
>
> Therefore, it will not create new link each time the netdev is re-opened.
>
@Wei,
We were able to verify the suggestion what you gave us.
No crash is seen now.
Should we raise a patch or shall we wait until this is clarified and
Russell has no more further questions. ?
I am okay with anything.
>>
>> If that is correct, then we're trading one problem for another.
>>
>
Powered by blists - more mailing lists