Skip to contentSkip to conversation

network driver usage count

DISCUSSION Ferenc Wagner 4 participants 6 messages Nov 21, 2007 – Nov 23, 2007

lore
Share & tools
lore
#0 lore raw

Hi!

Under 2.6.23.1, my lsmod output shows this:

$ lsmod | grep tg3
tg3                   100580  0 

The usage count is zero, even though it drives my two physical interfaces:

$ ls -l /sys/class/net/eth-gb?/device/driver
lrwxrwxrwx 1 root root 0 2007-11-21 19:58 /sys/class/net/eth-gb1/device/driver -> ../../../bus/pci/drivers/tg3
lrwxrwxrwx 1 root root 0 2007-11-21 19:58 /sys/class/net/eth-gb2/device/driver -> ../../../bus/pci/drivers/tg3

These interfaces are up and bonded together, but that doesn't seem to matter at all. I also checked other machines, the network driver (tg3, e1000) usage counts are always zero under various recent 2.6 kernels, but nonzero under 2.4.21 for example.

And really, the module could be removed, cutting my ssh session. :)

Was this made possible intentionally? If yes, why?

Signature · 8 lines
Thanks,
Feri.

PS. please Cc: me, I'm not on the list.

PPS. on loading tg3, I get messages like:
     eth-gb1: device_rename: sysfs_create_symlink failed (-17)
     I configured renaming by udev, did I make a mistake?
#1 lore raw
Quoted 14 lines · On Wed, 21 Nov 2007 20:45:11 +0100 Ferenc Wagner <[email protected]> wrote:

Hi!

Under 2.6.23.1, my lsmod output shows this:

$ lsmod | grep tg3
tg3                   100580  0 

The usage count is zero, even though it drives my two physical interfaces:

$ ls -l /sys/class/net/eth-gb?/device/driver
lrwxrwxrwx 1 root root 0 2007-11-21 19:58 /sys/class/net/eth-gb1/device/driver -> ../../../bus/pci/drivers/tg3
lrwxrwxrwx 1 root root 0 2007-11-21 19:58 /sys/class/net/eth-gb2/device/driver -> ../../../bus/pci/drivers/tg3
Quoted 8 lines

These interfaces are up and bonded together, but that doesn't seem to matter at all. I also checked other machines, the network driver (tg3, e1000) usage counts are always zero under various recent 2.6 kernels, but nonzero under 2.4.21 for example.

And really, the module could be removed, cutting my ssh session. :)

Was this made possible intentionally? If yes, why?

Yes, so devices can be removed at anytime.

Signature · 1 line
Stephen Hemminger <[email protected]>
#2 lore raw
Quoted 20 lines · Stephen Hemminger
Quoted 17 lines · On Wed, 21 Nov 2007 20:45:11 +0100 Ferenc Wagner <[email protected]> wrote:

Under 2.6.23.1, my lsmod output shows this:

$ lsmod | grep tg3
tg3                   100580  0 

The usage count is zero, even though it drives my two physical interfaces:

$ ls -l /sys/class/net/eth-gb?/device/driver
lrwxrwxrwx 1 root root 0 2007-11-21 19:58 /sys/class/net/eth-gb1/device/driver -> ../../../bus/pci/drivers/tg3
lrwxrwxrwx 1 root root 0 2007-11-21 19:58 /sys/class/net/eth-gb2/device/driver -> ../../../bus/pci/drivers/tg3

These interfaces are up and bonded together, but that doesn't seem to matter at all. I also checked other machines, the network driver (tg3, e1000) usage counts are always zero under various recent 2.6 kernels, but nonzero under 2.4.21 for example.

Quoted 5 lines
Quoted 3 lines

And really, the module could be removed, cutting my ssh session. :)

Was this made possible intentionally? If yes, why?

Yes, so devices can be removed at anytime.

Hmm, that would warrant nuking all the reference counts on every driver. I must be missing something, since I really feel it goes against common sense. Can you point me to some discussion of this change? I mean, I couldn't remove the driver of a mounted filesystem. So why can I remove a driver serving live network traffic?

Signature · 2 lines
Thanks,
Feri.
#3 lore raw

Wagner Ferenc <[email protected]> :
[...]

Quoted 1 line

So why can I remove a driver serving live network traffic?

Why not ? It is quite common to remove physically a network/storage device.

Signature · 1 line
Ueimor
#4 lore raw
In reply to Wagner Ferenc

From: Wagner Ferenc <[email protected]>
Date: Wed, 21 Nov 2007 23:16:59 +0100

Quoted 2 lines

Hmm, that would warrant nuking all the reference counts on every driver.

That's not true. When packets are in flight, references go to the device and the device cannot be unloaded until those references get dropped.

This behavior makes sense because otherwise you have to figure out the myriad of references (each ipv4 address, each ipv6 address, routes, ARP entries, etc.) just to perform such a simple operation.

If you do not mean to unload the device, simply do not do it.

#5 lore raw
Quoted 9 lines · David Miller

From: Wagner Ferenc <[email protected]>
Date: Wed, 21 Nov 2007 23:16:59 +0100

Quoted 2 lines

Hmm, that would warrant nuking all the reference counts on every driver.

That's not true. When packets are in flight, references go to the device and the device cannot be unloaded until those references get dropped.

I'm trying to understand it. Do you mean that the "usage count" in the lsmod output does not express the user's view of a piece of *ware being in use, but rather the number of internal kernel references to it, which would become invalid should that piece disappear? Where the former "invalidily" means some undetectable and uncorrectable inconsistency in the kernel data structures, which leads to a kernel crash.

Quoted 4 lines

This behavior makes sense because otherwise you have to figure out the myriad of references (each ipv4 address, each ipv6 address, routes, ARP entries, etc.) just to perform such a simple operation.

Yes, that's the user's idea of a network device being in use. It can get hairy indeed.

Quoted 1 line

If you do not mean to unload the device, simply do not do it.

Now I know...

Signature · 2 lines
Thanks for taking the time,
Feri.