RE: [PATCH net v3 1/1] net: phylink: Add module_exit()

From: Gan, Yi Fang
Date: Thu Jan 11 2024 - 01:39:17 EST




> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Thursday, January 4, 2024 9:05 PM
> To: Gan, Yi Fang <yi.fang.gan@xxxxxxxxx>
> Cc: Russell King <linux@xxxxxxxxxxxxxxx>; Heiner Kallweit
> <hkallweit1@xxxxxxxxx>; David S . Miller <davem@xxxxxxxxxxxxx>; Eric
> Dumazet <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo
> Abeni <pabeni@xxxxxxxxxx>; Marek Behún <kabel@xxxxxxxxxx>;
> netdev@xxxxxxxxxxxxxxx; linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx; linux-
> arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Looi, Hong Aun
> <hong.aun.looi@xxxxxxxxx>; Voon, Weifeng <weifeng.voon@xxxxxxxxx>; Song,
> Yoong Siang <yoong.siang.song@xxxxxxxxx>; Choong, Yong Liang
> <yong.liang.choong@xxxxxxxxx>
> Subject: Re: [PATCH net v3 1/1] net: phylink: Add module_exit()
>
> On Thu, Jan 04, 2024 at 06:12:55PM +0800, Gan, Yi Fang wrote:
> 65;7401;1c> In delete_module(), if mod->init callback is defined but mod->exit
> callback
> > is not defined, it will assume the module cannot be removed and return
> > EBUSY. The module_exit() is missing from current phylink module drive
> > causing failure while unloading it.
>
> This is still missing the explanation why this is safe.
>
>
> Andrew
>
> ---
> pw-bot: cr

Hi Andrew,

Regarding the justification on why it is safe to remove phylink,
we had done some memory leak check when unloading the phylink module.

root@localhost:~# lsmod | grep "phylink"
phylink 73728 0
root@localhost:~# rmmod phylink
root@localhost:~# echo scan > /sys/kernel/debug/kmemleak
root@localhost:~# cat /sys/kernel/debug/kmemleak
root@localhost:~#

So far, we didn't observe any memory leaking happened when unloading
phylink module. Is it sufficient or do you have any other suggestions to check
on whether the module is safe to remove?

Best Regards,
Gan Yi Fang