Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fdbe123

Browse files
Unregister efrm-nondl on shutdown / reboot
On shutdown / reboot, if netdevs don't have a refcount of 1, the kernel loops with message: unregister_netdevice: waiting for eth0 to become free. Usage count = 3 unregister_netdevice: waiting for eth0 to become free. Usage count = 3 unregister_netdevice: waiting for eth0 to become free. Usage count = 3 [...] With netdev refcount tracking, the traces are visible: unregister_netdevice: waiting for eth0 to become free. Usage count = 3 ref_tracker: eth%d@ff3cf768c8344548 has 1/2 users at efrm_nic_add+0x29b/0x460 [sfc_resource] efrm_nondl_add_device+0x124/0x1c0 [sfc_resource] efrm_nondl_try_add_device+0x27/0xf0 [sfc_resource] efrm_nondl_register_netdev+0x106/0x160 [sfc_resource] nondl_register_store+0x174/0x1e0 [sfc_resource] kernfs_fop_write_iter+0x128/0x1c0 vfs_write+0x308/0x420 ksys_write+0x5f/0xe0 do_syscall_64+0x7b/0x160 entry_SYSCALL_64_after_hwframe+0x76/0x7e ref_tracker: eth%d@ff3cf768c8344548 has 1/2 users at efrm_nondl_register_netdev+0xa9/0x160 [sfc_resource] nondl_register_store+0x174/0x1e0 [sfc_resource] kernfs_fop_write_iter+0x128/0x1c0 vfs_write+0x308/0x420 ksys_write+0x5f/0xe0 do_syscall_64+0x7b/0x160 entry_SYSCALL_64_after_hwframe+0x76/0x7e This patch makes sfc_resource register a reboot notifier that calls efrm_nondl_unregister & efrm_nondl_shutdown that handles each of the two refcounts. Considering that the only other caller of those functions is the cleanup_sfc_resource module exit function, I don't think shutdown should be concerned about module unload racing under normal circumstances. Signed-off-by: YiFei Zhu <zhuyifei@google.com>
1 parent 4ab93d8 commit fdbe123

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎src/driver/linux_resource/resource_driver.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#include "sfcaffinity.h"
7070
#include <ci/driver/resource/linux_efhw_nic.h>
7171
#include <ci/driver/resource/driverlink.h>
72+
#include <linux/reboot.h>
7273
#include "debugfs.h"
7374

7475
MODULE_AUTHOR("Solarflare Communications");
@@ -631,6 +632,23 @@ static void efrm_nic_del_all(void)
631632
efrm_nic_del(linux_efhw_nic(nic));
632633
}
633634

635+
static void cleanup_sfc_resource(void);
636+
637+
static int sfc_resource_shutdown_notify(struct notifier_block *unused1,
638+
unsigned long unused2, void *unused3)
639+
{
640+
/* Due to refcounting reasons in netdev, these must
641+
* be called for the shutdown to happen without delays
642+
*/
643+
efrm_nondl_unregister();
644+
efrm_nondl_shutdown();
645+
646+
return NOTIFY_DONE;
647+
}
648+
649+
static struct notifier_block sfc_resource_shutdown_nb = {
650+
.notifier_call = sfc_resource_shutdown_notify,
651+
};
634652

635653
/****************************************************************************
636654
*
@@ -683,6 +701,8 @@ static int init_sfc_resource(void)
683701
efrm_install_sysfs_entries();
684702
efrm_nondl_register();
685703

704+
register_reboot_notifier(&sfc_resource_shutdown_nb);
705+
686706
return 0;
687707

688708
failed_notifier:
@@ -705,6 +725,8 @@ static int init_sfc_resource(void)
705725
****************************************************************************/
706726
static void cleanup_sfc_resource(void)
707727
{
728+
unregister_reboot_notifier(&sfc_resource_shutdown_nb);
729+
708730
efrm_nondl_unregister();
709731
efrm_remove_sysfs_entries();
710732
efrm_nondl_shutdown();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /