[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200820.165244.540878641387937530.davem@davemloft.net>
Date: Thu, 20 Aug 2020 16:52:44 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: ashiduka@...itsu.com
Cc: sergei.shtylyov@...il.com, kuba@...nel.org, netdev@...r.kernel.org,
linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH v3] ravb: Fixed to be able to unload modules
From: Yuusuke Ashizuka <ashiduka@...itsu.com>
Date: Thu, 20 Aug 2020 18:43:07 +0900
> When this driver is built as a module, I cannot rmmod it after insmoding
> it.
> This is because that this driver calls ravb_mdio_init() at the time of
> probe, and module->refcnt is incremented by alloc_mdio_bitbang() called
> after that.
> Therefore, even if ifup is not performed, the driver is in use and rmmod
> cannot be performed.
>
> $ lsmod
> Module Size Used by
> ravb 40960 1
> $ rmmod ravb
> rmmod: ERROR: Module ravb is in use
>
> Call ravb_mdio_init() at open and free_mdio_bitbang() at close, thereby
> rmmod is possible in the ifdown state.
>
> Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
> Signed-off-by: Yuusuke Ashizuka <ashiduka@...itsu.com>
> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@...il.com>
> ---
> Changes in v3:
> - Update the commit subject and description.
> - Add Fixes c156633f1353.
> - Add Reviewed-by Sergei.
> https://patchwork.kernel.org/patch/11692719/
>
> Changes in v2:
> - Fix build error
This is OK as a short term bug fix for sure.
But longer term, we should always be able to rmmod a networking
device driver even if it is UP.
Supplementary references from MDIO make this not possible.
What would need to happen is that MDIO would stop taking references to
the network device driver module, and it would register a netdevice
notifier that would do the necessary detachmentand resource release
during an unregister attempt.
That's how ipv4, ipv6, etc. deal with references to the device via
routes, assigned protocol addresses, etc.
Powered by blists - more mailing lists