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 2958798

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 2958798

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎src/driver/linux_resource/resource_driver.c‎

Lines changed: 20 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,21 @@ static void efrm_nic_del_all(void)
631632
efrm_nic_del(linux_efhw_nic(nic));
632633
}
633634

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

635651
/****************************************************************************
636652
*
@@ -683,6 +699,8 @@ static int init_sfc_resource(void)
683699
efrm_install_sysfs_entries();
684700
efrm_nondl_register();
685701

702+
register_reboot_notifier(&sfc_resource_shutdown_nb);
703+
686704
return 0;
687705

688706
failed_notifier:
@@ -705,6 +723,8 @@ static int init_sfc_resource(void)
705723
****************************************************************************/
706724
static void cleanup_sfc_resource(void)
707725
{
726+
unregister_reboot_notifier(&sfc_resource_shutdown_nb);
727+
708728
efrm_nondl_unregister();
709729
efrm_remove_sysfs_entries();
710730
efrm_nondl_shutdown();

0 commit comments

Comments
(0)

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