Skip to contentSkip to conversation

net/core: Replace driver version to be kernel version

PATCH In review Leon Romanovsky 6 participants 30 messages Jan 23, 2020 – Jan 27, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/core: Replace driver version to be kernel version

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
I wanted to change to VERMAGIC_STRING, but the output doesn't look pleasant to my taste and on my system is truncated to be "version: 5.5.0-rc6+ SMP mod_unload modve".

After this patch, we can drop all those version assignments from the drivers.

Inspired by nfp and hns code.

---
 net/core/ethtool.c | 3 +++
 1 file changed, 3 insertions(+)
net/core/ethtool.c +3 -0
index cd9bc67381b2..3c6fb13a78bf 100644
@@ -17,6 +17,7 @@
 #include <linux/phy.h>
 #include <linux/bitops.h>
 #include <linux/uaccess.h>
+#include <linux/vermagic.h>
 #include <linux/vmalloc.h>
 #include <linux/sfp.h>
 #include <linux/slab.h>
@@ -776,6 +777,8 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
 		return -EOPNOTSUPP;
 	}
 
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
+
 	/*
 	 * this method of obtaining string set info is deprecated;
 	 * Use ETHTOOL_GSSET_INFO instead.

--
2.20.1

maintainer
#1 lore raw
Quoted 14 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

Quoted 1 line

I wonder how hard it would be to tell Coccinelle to remove all prints in the drivers. Removing related defines would probably be a little painful/manual. Hm..

Anyway, you gotta rebase on net-next, the ethtool code got moved around :)

#2 lore raw
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

Quoted 5 lines
Quoted 1 line

I wonder how hard it would be to tell Coccinelle to remove all prints in the drivers. Removing related defines would probably be a little painful/manual. Hm..

It is also unclear how can we automatically catch new comers.

Quoted 3 lines

Anyway, you gotta rebase on net-next, the ethtool code got moved around :)

I tried it now and It applies cleanly on top of commit 6d9f6e6790e7 Merge branch 'net-sched-add-Flow-Queue-PIE-packet-scheduler'

Thanks

#3 lore raw
Quoted 7 lines · Leon Romanovsky
Quoted 1 line

Anyway, you gotta rebase on net-next, the ethtool code got moved

around

Quoted 1 line

:)

I tried it now and It applies cleanly on top of commit 6d9f6e6790e7 Merge branch 'net-sched-add-Flow-Queue-PIE-packet-scheduler'

Git is magic.

maintainer
#4 lore raw
In reply to Leon Romanovsky

From: Leon Romanovsky <[email protected]>
Date: Thu, 23 Jan 2020 15:05:41 +0200

Quoted 14 lines

From: Leon Romanovsky <[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

Quoted 1 line

Please respin on current net-next, thank you :)

#5 lore raw
In reply to Leon Romanovsky
Quoted 50 lines · Leon Romanovsky

From: Leon Romanovsky<[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
I wanted to change to VERMAGIC_STRING, but the output doesn't look pleasant to my taste and on my system is truncated to be "version: 5.5.0-rc6+ SMP mod_unload modve".

After this patch, we can drop all those version assignments from the drivers.

Inspired by nfp and hns code.

---
  net/core/ethtool.c | 3 +++
  1 file changed, 3 insertions(+)
net/core/ethtool.c +3 -1
index cd9bc67381b2..3c6fb13a78bf 100644
@@ -17,6 +17,7 @@
  #include <linux/phy.h>
  #include <linux/bitops.h>
  #include <linux/uaccess.h>
+#include <linux/vermagic.h>
  #include <linux/vmalloc.h>
  #include <linux/sfp.h>
  #include <linux/slab.h>
@@ -776,6 +777,8 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
  		return -EOPNOTSUPP;
  	}
 
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
+
  	/*
  	 * this method of obtaining string set info is deprecated;
  	 * Use ETHTOOL_GSSET_INFO instead.
--
Quoted 2 lines

2.20.1

First of all, although I've seen some of the arguments about distros and their backporting, I still believe that the driver version number is useful.  In most cases it at least gets us in the ballpark of what generation the driver happens to be and is still useful. I'd really prefer that it is just left alone for the device manufactures and their support folks to deal with.

Fine, I'm sure I lose that argument since there's already been plenty of discussion about it.

Meanwhile, there is some non-zero number of support scripts and processes, possibly internal testing chains, that use that driver/vendor specific version information and will be broken by this change.  Small number?  Large number?  I don't know, but we're breaking them.

Sure, I probably easily lose that argument too, but it still should be stated.

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Of course, out-of-tree drivers are not first class citizens, so I probably lose that argument as well.

So if you are so all fired up about not allowing the drivers to report their own version number, then why report anything at all? Maybe just report a blank field.  As some have said, the uname info is already available else where, why are we sticking it here?

Personally, I think this is a rather arbitrary, heavy handed and unnecessary slam on the drivers, and will make support more difficult in the long run.

sln

#6 lore raw
Quoted 84 lines · Shannon Nelson
Quoted 50 lines · Leon Romanovsky

From: Leon Romanovsky<[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
I wanted to change to VERMAGIC_STRING, but the output doesn't look pleasant to my taste and on my system is truncated to be "version: 5.5.0-rc6+ SMP mod_unload modve".

After this patch, we can drop all those version assignments from the drivers.

Inspired by nfp and hns code.

---
  net/core/ethtool.c | 3 +++
  1 file changed, 3 insertions(+)
net/core/ethtool.c +3 -1
index cd9bc67381b2..3c6fb13a78bf 100644
@@ -17,6 +17,7 @@
  #include <linux/phy.h>
  #include <linux/bitops.h>
  #include <linux/uaccess.h>
+#include <linux/vermagic.h>
  #include <linux/vmalloc.h>
  #include <linux/sfp.h>
  #include <linux/slab.h>
@@ -776,6 +777,8 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
  		return -EOPNOTSUPP;
  	}
 
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
+
  	/*
  	 * this method of obtaining string set info is deprecated;
  	 * Use ETHTOOL_GSSET_INFO instead.
--
Quoted 2 lines

2.20.1

First of all, although I've seen some of the arguments about distros and their backporting, I still believe that the driver version number is useful.  In most cases it at least gets us in the ballpark of what generation the driver happens to be and is still useful. I'd really prefer that it is just left alone for the device manufactures and their support folks to deal with.

Fine, I'm sure I lose that argument since there's already been plenty of discussion about it.

Meanwhile, there is some non-zero number of support scripts and processes, possibly internal testing chains, that use that driver/vendor specific version information and will be broken by this change.  Small number?  Large number?  I don't know, but we're breaking them.

Sure, I probably easily lose that argument too, but it still should be stated.

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Of course, out-of-tree drivers are not first class citizens, so I probably lose that argument as well.

Quoted 7 lines

So if you are so all fired up about not allowing the drivers to report their own version number, then why report anything at all? Maybe just report a blank field.  As some have said, the uname info is already available else where, why are we sticking it here?

Personally, I think this is a rather arbitrary, heavy handed and unnecessary slam on the drivers, and will make support more difficult in the long run.

The thing is that leaving this field as empty, for sure will break all applications. I have a feeling that it can be close to 100% hit rate. So, kernel version was chosen as an option, because it is already successfully in use by at least two drivers (nfp and hns).

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

Thanks

Quoted 3 lines

sln

maintainer
#7 lore raw
Quoted 17 lines · Leon Romanovsky
Quoted 17 lines

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Of course, out-of-tree drivers are not first class citizens, so I probably lose that argument as well.

So if you are so all fired up about not allowing the drivers to report their own version number, then why report anything at all? Maybe just report a blank field.  As some have said, the uname info is already available else where, why are we sticking it here?

Quoted 7 lines
Quoted 2 lines

Personally, I think this is a rather arbitrary, heavy handed and unnecessary slam on the drivers, and will make support more difficult in the long run.

The thing is that leaving this field as empty, for sure will break all applications. I have a feeling that it can be close to 100% hit rate. So, kernel version was chosen as an option, because it is already successfully in use by at least two drivers (nfp and hns).

Shannon does have a point that out of tree drivers still make use of this field. Perhaps it would be a more suitable first step to print the kernel version as default and add a comment saying upstream modules shouldn't overwrite it (perhaps one day CI can catch new violators).

The NFP reports the git hash of the driver source plus the string "(oot)" for out-of-tree:

https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L297
https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L315

Quoted 9 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

That is true. But reporting the kernel version without even as much as in-tree/out-of-tree indication makes the field entirely meaningless.

#8 lore raw
Quoted 26 lines · Jakub Kicinski
Quoted 17 lines · Leon Romanovsky
Quoted 17 lines

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Of course, out-of-tree drivers are not first class citizens, so I probably lose that argument as well.

So if you are so all fired up about not allowing the drivers to report their own version number, then why report anything at all? Maybe just report a blank field.  As some have said, the uname info is already available else where, why are we sticking it here?

Quoted 7 lines
Quoted 2 lines

Personally, I think this is a rather arbitrary, heavy handed and unnecessary slam on the drivers, and will make support more difficult in the long run.

The thing is that leaving this field as empty, for sure will break all applications. I have a feeling that it can be close to 100% hit rate. So, kernel version was chosen as an option, because it is already successfully in use by at least two drivers (nfp and hns).

Quoted 4 lines

Shannon does have a point that out of tree drivers still make use of this field. Perhaps it would be a more suitable first step to print the kernel version as default and add a comment saying upstream modules shouldn't overwrite it (perhaps one day CI can catch new violators).

Jakub,

Shannon proposed to remove this field and it was me who said no :) My plan is to overwrite ->version, delete all users and add WARN_ONEC(strcpy(..->version_)...) inside net/ethtool/ to catch abusers.

Quoted 6 lines

The NFP reports the git hash of the driver source plus the string "(oot)" for out-of-tree:

https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L297
https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L315

I was inspired by upstream code.
https://elixir.bootlin.com/linux/v5.5-rc7/source/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c#L184

Quoted 7 lines
Quoted 7 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

Quoted 6 lines
Quoted 3 lines

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

That is true. But reporting the kernel version without even as much as in-tree/out-of-tree indication makes the field entirely meaningless.

The long-standing policy in kernel that we don't really care about out-of-tree code.

Thanks

#9 lore raw
Quoted 2 lines · Leon Romanovsky

The long-standing policy in kernel that we don't really care about out-of-tree code.

That doesn't mean we need to be aggressively against out-of-tree code.  One of the positive points about Linux and loadable modules has always been the flexibility that allows and encourages innovation, and helps enable more work and testing before a driver can become a fully-fledged part of the kernel.  This move actively discourages part of that flexibility and I think it is breaking part of the usefulness of modules.

sln

#10 lore raw
Quoted 10 lines · Shannon Nelson
Quoted 2 lines · Leon Romanovsky

The long-standing policy in kernel that we don't really care about out-of-tree code.

That doesn't mean we need to be aggressively against out-of-tree code.  One of the positive points about Linux and loadable modules has always been the flexibility that allows and encourages innovation, and helps enable more work and testing before a driver can become a fully-fledged part of the kernel.  This move actively discourages part of that flexibility and I think it is breaking part of the usefulness of modules.

You are mixing definitions, nothing stops those people to innovate and develop their code inside kernel and as standalone modules too.

It just stops them to put useless driver version string inside ethtool. If they feel that their life can't be without something from 90s, they have venerable MODULE_VERSION() macro to print anything they want.

Thanks

Quoted 3 lines

sln

#11 lore raw
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Shannon Nelson
Quoted 2 lines · Leon Romanovsky

The long-standing policy in kernel that we don't really care about out-of-tree code.

That doesn't mean we need to be aggressively against out-of-tree code.  One of the positive points about Linux and loadable modules has always been the flexibility that allows and encourages innovation, and helps enable more work and testing before a driver can become a fully-fledged part of the kernel.  This move actively discourages part of that flexibility and I think it is breaking part of the usefulness of modules.

Quoted 7 lines

You are mixing definitions, nothing stops those people to innovate and develop their code inside kernel and as standalone modules too.

It just stops them to put useless driver version string inside ethtool. If they feel that their life can't be without something from 90s, they have venerable MODULE_VERSION() macro to print anything they want.

Part of the pain of supporting our users is getting them to give us useful information about their problem.  The more commands I need them to run to get information about the environment, the less likely I will get anything useful.  We've been training our users over the years to use "ethtool -i" to get a good chunk of that info, with the knowledge that the driver version is only a hint, based upon the distro involved.  I don't want to lose that hint.  If anything, I'd prefer that we added a field for UTS_RELEASE in the ethtool output, but I know that's too much to ask.

If the driver can put its "useless" version info into the MODULE_VERSION, why is it not acceptable for the ethtool driver version field?

... and as beauty is in the eye of the beholder, a judgement of "useless" is a personal thing.  Personally, I find it the driver version useful.

sln

#12 lore raw
Quoted 18 lines · Shannon Nelson
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Shannon Nelson
Quoted 2 lines · Leon Romanovsky

The long-standing policy in kernel that we don't really care about out-of-tree code.

That doesn't mean we need to be aggressively against out-of-tree code.  One of the positive points about Linux and loadable modules has always been the flexibility that allows and encourages innovation, and helps enable more work and testing before a driver can become a fully-fledged part of the kernel.  This move actively discourages part of that flexibility and I think it is breaking part of the usefulness of modules.

Quoted 7 lines

You are mixing definitions, nothing stops those people to innovate and develop their code inside kernel and as standalone modules too.

It just stops them to put useless driver version string inside ethtool. If they feel that their life can't be without something from 90s, they have venerable MODULE_VERSION() macro to print anything they want.

Quoted 8 lines

Part of the pain of supporting our users is getting them to give us useful information about their problem.  The more commands I need them to run to get information about the environment, the less likely I will get anything useful.  We've been training our users over the years to use "ethtool -i" to get a good chunk of that info, with the knowledge that the driver version is only a hint, based upon the distro involved.  I don't want to lose that hint.  If anything, I'd prefer that we added a field for UTS_RELEASE in the ethtool output, but I know that's too much to ask.

At the same time, I've been trying to explain both our L1/L2 support guys and our customers that "driver version" information reported by "ethtool -i" is almost useless and that if they really want to identify driver version, they should rather use srcversion as reported by modinfo or sysfs.

Michal

#13 lore raw
Quoted 27 lines · Michal Kubecek
Quoted 18 lines · Shannon Nelson
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Shannon Nelson
Quoted 2 lines · Leon Romanovsky

The long-standing policy in kernel that we don't really care about out-of-tree code.

That doesn't mean we need to be aggressively against out-of-tree code.  One of the positive points about Linux and loadable modules has always been the flexibility that allows and encourages innovation, and helps enable more work and testing before a driver can become a fully-fledged part of the kernel.  This move actively discourages part of that flexibility and I think it is breaking part of the usefulness of modules.

Quoted 7 lines

You are mixing definitions, nothing stops those people to innovate and develop their code inside kernel and as standalone modules too.

It just stops them to put useless driver version string inside ethtool. If they feel that their life can't be without something from 90s, they have venerable MODULE_VERSION() macro to print anything they want.

Quoted 8 lines

Part of the pain of supporting our users is getting them to give us useful information about their problem.  The more commands I need them to run to get information about the environment, the less likely I will get anything useful.  We've been training our users over the years to use "ethtool -i" to get a good chunk of that info, with the knowledge that the driver version is only a hint, based upon the distro involved.  I don't want to lose that hint.  If anything, I'd prefer that we added a field for UTS_RELEASE in the ethtool output, but I know that's too much to ask.

Quoted 7 lines

At the same time, I've been trying to explain both our L1/L2 support guys and our customers that "driver version" information reported by "ethtool -i" is almost useless and that if they really want to identify driver version, they should rather use srcversion as reported by modinfo or sysfs.

Michal

So as I suggested elsewhere, can we compromise by not bashing the driver string in the caller stack, but require the in-kernel drivers to use a particular macro that will put the kernel/git version into the string?  This allows out-of-tree drivers the option of overriding the version with some other string that can be meaningful in any other given old or new distro kernel.  This should be easy to enforce mechanically with checkpatch, and easy enough to do a sweeping coccinelle change on the existing drivers.

sln

#14 lore raw
Quoted 17 lines · Shannon Nelson
Quoted 10 lines · Michal Kubecek
Quoted 8 lines · Shannon Nelson

Part of the pain of supporting our users is getting them to give us useful information about their problem.  The more commands I need them to run to get information about the environment, the less likely I will get anything useful.  We've been training our users over the years to use "ethtool -i" to get a good chunk of that info, with the knowledge that the driver version is only a hint, based upon the distro involved.  I don't want to lose that hint.  If anything, I'd prefer that we added a field for UTS_RELEASE in the ethtool output, but I know that's too much to ask.

Quoted 5 lines

At the same time, I've been trying to explain both our L1/L2 support guys and our customers that "driver version" information reported by "ethtool -i" is almost useless and that if they really want to identify driver version, they should rather use srcversion as reported by modinfo or sysfs.

Quoted 7 lines

So as I suggested elsewhere, can we compromise by not bashing the driver string in the caller stack, but require the in-kernel drivers to use a particular macro that will put the kernel/git version into the string?  This allows out-of-tree drivers the option of overriding the version with some other string that can be meaningful in any other given old or new distro kernel.  This should be easy to enforce mechanically with checkpatch, and easy enough to do a sweeping coccinelle change on the existing drivers.

Personally, I rather liked what Jakub suggested earlier: set ethtool_drvinfo::version to kernel version before ops->get_drvinfo() is called in ethtool_get_drvinfo() (and its netlink counterpart once we get some consensus about what information should be in the message), clean up in-tree drivers so that they don't touch it and add a coccinelle check so that we keep in-tree drivers compliant; this would allow out-of-tree drivers to overwrite ethtool_drvinfo::version with whatever they want.

Michal

#15 lore raw
Quoted 26 lines · Michal Kubecek
Quoted 17 lines · Shannon Nelson
Quoted 10 lines · Michal Kubecek
Quoted 8 lines · Shannon Nelson

Part of the pain of supporting our users is getting them to give us useful information about their problem.  The more commands I need them to run to get information about the environment, the less likely I will get anything useful.  We've been training our users over the years to use "ethtool -i" to get a good chunk of that info, with the knowledge that the driver version is only a hint, based upon the distro involved.  I don't want to lose that hint.  If anything, I'd prefer that we added a field for UTS_RELEASE in the ethtool output, but I know that's too much to ask.

Quoted 5 lines

At the same time, I've been trying to explain both our L1/L2 support guys and our customers that "driver version" information reported by "ethtool -i" is almost useless and that if they really want to identify driver version, they should rather use srcversion as reported by modinfo or sysfs.

Quoted 7 lines

So as I suggested elsewhere, can we compromise by not bashing the driver string in the caller stack, but require the in-kernel drivers to use a particular macro that will put the kernel/git version into the string?  This allows out-of-tree drivers the option of overriding the version with some other string that can be meaningful in any other given old or new distro kernel.  This should be easy to enforce mechanically with checkpatch, and easy enough to do a sweeping coccinelle change on the existing drivers.

Quoted 7 lines

Personally, I rather liked what Jakub suggested earlier: set ethtool_drvinfo::version to kernel version before ops->get_drvinfo() is called in ethtool_get_drvinfo() (and its netlink counterpart once we get some consensus about what information should be in the message), clean up in-tree drivers so that they don't touch it and add a coccinelle check so that we keep in-tree drivers compliant; this would allow out-of-tree drivers to overwrite ethtool_drvinfo::version with whatever they want.

It works for MODULE_VERSION(), so I don't see any reason to have different solution for the same value for ethtool.

For example, ib_core module doesn't have MODULE_VERSION() string. [leonro@server ~]$ modinfo ib_core
filename: /lib/modules/5.5.0-rc6/modules/ib_core.ko
<...>

intree:         Y
name:           ib_core
vermagic:       5.5.0-rc6 SMP mod_unload modversions

<...>

Thanks

Quoted 2 lines

Michal

#16 lore raw
In reply to Michal Kubecek
Quoted 28 lines · Michal Kubecek
Quoted 18 lines · Shannon Nelson
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Shannon Nelson
Quoted 2 lines · Leon Romanovsky

The long-standing policy in kernel that we don't really care about out-of-tree code.

That doesn't mean we need to be aggressively against out-of-tree code.  One of the positive points about Linux and loadable modules has always been the flexibility that allows and encourages innovation, and helps enable more work and testing before a driver can become a fully-fledged part of the kernel.  This move actively discourages part of that flexibility and I think it is breaking part of the usefulness of modules.

Quoted 7 lines

You are mixing definitions, nothing stops those people to innovate and develop their code inside kernel and as standalone modules too.

It just stops them to put useless driver version string inside ethtool. If they feel that their life can't be without something from 90s, they have venerable MODULE_VERSION() macro to print anything they want.

Quoted 8 lines

Part of the pain of supporting our users is getting them to give us useful information about their problem.  The more commands I need them to run to get information about the environment, the less likely I will get anything useful.  We've been training our users over the years to use "ethtool -i" to get a good chunk of that info, with the knowledge that the driver version is only a hint, based upon the distro involved.  I don't want to lose that hint.  If anything, I'd prefer that we added a field for UTS_RELEASE in the ethtool output, but I know that's too much to ask.

Quoted 5 lines

At the same time, I've been trying to explain both our L1/L2 support guys and our customers that "driver version" information reported by "ethtool -i" is almost useless and that if they really want to identify driver version, they should rather use srcversion as reported by modinfo or sysfs.

We went even farther and wrote simple bash script that collects all needed information from the system.

Thanks

Quoted 2 lines

Michal

maintainer
#17 lore raw
In reply to Leon Romanovsky
Quoted 11 lines · Leon Romanovsky
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · Leon Romanovsky
Quoted 8 lines

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Quoted 6 lines
Quoted 4 lines

Shannon does have a point that out of tree drivers still make use of this field. Perhaps it would be a more suitable first step to print the kernel version as default and add a comment saying upstream modules shouldn't overwrite it (perhaps one day CI can catch new violators).

Shannon proposed to remove this field and it was me who said no :)

Obviously, we can't remove fields from UAPI structs.

Quoted 3 lines

My plan is to overwrite ->version, delete all users and add WARN_ONEC(strcpy(..->version_)...) inside net/ethtool/ to catch abusers.

What I was thinking just now was: initialize ->version to utsname before drivers are called, delete all upstream users, add a coccicheck for upstream drivers which try to report the version.

Quoted 8 lines
Quoted 5 lines

The NFP reports the git hash of the driver source plus the string "(oot)" for out-of-tree:

https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L297
https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L315

I was inspired by upstream code.
https://elixir.bootlin.com/linux/v5.5-rc7/source/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c#L184

Right, upstream nfp reports kernel version (both in modinfo and ethtool) GitHub/compat/backport/out-of-tree reports kernel version in which the code was expected to appear in modinfo:

https://github.com/Netronome/nfp-drv-kmods/commit/7ec15c47caf5dbdf1f9806410535ad5b7373ec34#diff-492d7fa4004d885a38cfa889ed1adbe7L1284

And git hash of the driver source plus out of tree marker in ethtool.

That means it's out-of-tree driver which has to carry the extra code and require extra feeding. As backport should IMHO.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

Quoted 5 lines
Quoted 2 lines

That is true. But reporting the kernel version without even as much as in-tree/out-of-tree indication makes the field entirely meaningless.

The long-standing policy in kernel that we don't really care about out-of-tree code.

Yeah... we all know it's not that simple :)

The in-tree driver versions are meaningless and cause annoying churn when people arbitrarily bump them. If we can get people to stop doing that we'll be happy, that's all there is to it.

Out of tree the field is useful, so we don't have to take it away just as a matter of principle. If we can't convince people to stop bringing the versions into the tree that'll be another story...

#18 lore raw

On 1/26/20 1:33 PM, Jakub Kicinski wrote

Quoted 8 lines
Quoted 2 lines

The long-standing policy in kernel that we don't really care about out-of-tree code.

Yeah... we all know it's not that simple :)

The in-tree driver versions are meaningless and cause annoying churn when people arbitrarily bump them. If we can get people to stop doing that we'll be happy, that's all there is to it.

Perhaps it would be helpful if this standard was applied to all the drivers equally?  For example, I see that this week's ice driver update from Intel was accepted with no comment on their driver version bump.

Look, if we want to stamp all in-kernel drivers with the kernel version, fine.  But let's do it in a way that doesn't break the out-of-tree driver ability to report something else.  Can we set up a macro for in-kernel drivers to use in their get_drvinfo callback and require drivers to use that macro?  Then the out-of-tree drivers are able to replace that macro with whatever they need.  Just don't forcibly bash the value from higher up in the stack.

sln

#19 lore raw
Quoted 5 lines · Shannon Nelson

On 1/26/20 1:33 PM, Jakub Kicinski wrote

Quoted 4 lines
Quoted 2 lines

The long-standing policy in kernel that we don't really care about out-of-tree code.

Yeah... we all know it's not that simple :)

Quoted 7 lines
Quoted 4 lines

The in-tree driver versions are meaningless and cause annoying churn when people arbitrarily bump them. If we can get people to stop doing that we'll be happy, that's all there is to it.

Perhaps it would be helpful if this standard was applied to all the drivers equally?  For example, I see that this week's ice driver update from Intel was accepted with no comment on their driver version bump.

Thanks, it is another great example of why trusting driver authors, even experienced, on specific topics is not an option.

Quoted 8 lines

Look, if we want to stamp all in-kernel drivers with the kernel version, fine.  But let's do it in a way that doesn't break the out-of-tree driver ability to report something else.  Can we set up a macro for in-kernel drivers to use in their get_drvinfo callback and require drivers to use that macro?  Then the out-of-tree drivers are able to replace that macro with whatever they need.  Just don't forcibly bash the value from higher up in the stack.

The thing is that we don't consider in-kernel API as stable one, so addition of new field which is not in use in upstream looks sketchy to me, but I have an idea how to solve it.

Thanks

Quoted 3 lines

sln

#20 lore raw
Quoted 26 lines · Leon Romanovsky
Quoted 5 lines · Shannon Nelson

On 1/26/20 1:33 PM, Jakub Kicinski wrote

Quoted 4 lines
Quoted 2 lines

The long-standing policy in kernel that we don't really care about out-of-tree code.

Yeah... we all know it's not that simple :)

Quoted 7 lines
Quoted 4 lines

The in-tree driver versions are meaningless and cause annoying churn when people arbitrarily bump them. If we can get people to stop doing that we'll be happy, that's all there is to it.

Perhaps it would be helpful if this standard was applied to all the drivers equally?  For example, I see that this week's ice driver update from Intel was accepted with no comment on their driver version bump.

Thanks, it is another great example of why trusting driver authors, even experienced, on specific topics is not an option.

Quoted 8 lines

Look, if we want to stamp all in-kernel drivers with the kernel version, fine.  But let's do it in a way that doesn't break the out-of-tree driver ability to report something else.  Can we set up a macro for in-kernel drivers to use in their get_drvinfo callback and require drivers to use that macro?  Then the out-of-tree drivers are able to replace that macro with whatever they need.  Just don't forcibly bash the value from higher up in the stack.

Quoted 3 lines

The thing is that we don't consider in-kernel API as stable one, so addition of new field which is not in use in upstream looks sketchy to me, but I have an idea how to solve it.

Actually, it looks like my idea is Jakub's and Michal's idea. I will use this opportunity and remove MODULE_VERSION() too.

Thanks

Quoted 6 lines

Thanks

Quoted 3 lines

sln

maintainer
#21 lore raw
Quoted 6 lines · Leon Romanovsky
Quoted 3 lines

The thing is that we don't consider in-kernel API as stable one, so addition of new field which is not in use in upstream looks sketchy to me, but I have an idea how to solve it.

Actually, it looks like my idea is Jakub's and Michal's idea. I will use this opportunity and remove MODULE_VERSION() too.

If you do please make sure DKMS works. I remember it was looking at that value.

#22 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 6 lines · Leon Romanovsky
Quoted 3 lines

The thing is that we don't consider in-kernel API as stable one, so addition of new field which is not in use in upstream looks sketchy to me, but I have an idea how to solve it.

Actually, it looks like my idea is Jakub's and Michal's idea. I will use this opportunity and remove MODULE_VERSION() too.

If you do please make sure DKMS works. I remember it was looking at that value.

I'll check, thanks.

However from reading the source, it will be unlikely to see any issues there.

DKMS uses modversion for two things. First is to manage internal tree where those modules will be built and it knows how to install and clean automatically modules. Second is to list modaliases, and it handles them perfectly with and without version [1].

In our case, modules version will be available, it just going to change from 1.0.0. to something like 5.5.0-rc6.

[1] https://github.com/dell/dkms/blob/master/dkms_find-provides#L48

Thanks

#23 lore raw
In reply to Jakub Kicinski
Quoted 59 lines · Jakub Kicinski
Quoted 11 lines · Leon Romanovsky
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · Leon Romanovsky
Quoted 8 lines

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Quoted 6 lines
Quoted 4 lines

Shannon does have a point that out of tree drivers still make use of this field. Perhaps it would be a more suitable first step to print the kernel version as default and add a comment saying upstream modules shouldn't overwrite it (perhaps one day CI can catch new violators).

Shannon proposed to remove this field and it was me who said no :)

Obviously, we can't remove fields from UAPI structs.

Quoted 3 lines

My plan is to overwrite ->version, delete all users and add WARN_ONEC(strcpy(..->version_)...) inside net/ethtool/ to catch abusers.

What I was thinking just now was: initialize ->version to utsname before drivers are called, delete all upstream users, add a coccicheck for upstream drivers which try to report the version.

Quoted 8 lines
Quoted 5 lines

The NFP reports the git hash of the driver source plus the string "(oot)" for out-of-tree:

https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L297
https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L315

I was inspired by upstream code.
https://elixir.bootlin.com/linux/v5.5-rc7/source/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c#L184

Right, upstream nfp reports kernel version (both in modinfo and ethtool) GitHub/compat/backport/out-of-tree reports kernel version in which the code was expected to appear in modinfo:

https://github.com/Netronome/nfp-drv-kmods/commit/7ec15c47caf5dbdf1f9806410535ad5b7373ec34#diff-492d7fa4004d885a38cfa889ed1adbe7L1284

And git hash of the driver source plus out of tree marker in ethtool.

That means it's out-of-tree driver which has to carry the extra code and require extra feeding. As backport should IMHO.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That is true. But reporting the kernel version without even as much as in-tree/out-of-tree indication makes the field entirely meaningless.

The long-standing policy in kernel that we don't really care about out-of-tree code.

Yeah... we all know it's not that simple :)

It is simple, unfortunately netdev people like to complicate things by declaring ABI in very vague way which sometimes goes so far that it ends more strict than anyone would imagine.

We, RDMA and many other subsystems mentioned in that ksummit thread, removed MODULE_VERSION() a long time ago and got zero complains from the real users.

Quoted 8 lines

The in-tree driver versions are meaningless and cause annoying churn when people arbitrarily bump them. If we can get people to stop doing that we'll be happy, that's all there is to it.

Out of tree the field is useful, so we don't have to take it away just as a matter of principle. If we can't convince people to stop bringing the versions into the tree that'll be another story...

As Shannon pointed, even experienced people will try to sneak those changes. I assume that it is mainly because they are pushed to do it by the people who doesn't understand Linux kernel process.

Thanks

maintainer
#24 lore raw

From: Leon Romanovsky <[email protected]>
Date: Mon, 27 Jan 2020 07:49:55 +0200

Quoted 3 lines

We, RDMA and many other subsystems mentioned in that ksummit thread, removed MODULE_VERSION() a long time ago and got zero complains from the real users.

Changes to RDMA have a disproportionate level of impact compared to all of netdev.

So comparing the level of real or perceived potential impact is quite intellectually dishonest.

#25 lore raw
Quoted 7 lines · David Miller

From: Leon Romanovsky <[email protected]>
Date: Mon, 27 Jan 2020 07:49:55 +0200

Quoted 3 lines

We, RDMA and many other subsystems mentioned in that ksummit thread, removed MODULE_VERSION() a long time ago and got zero complains from the real users.

Quoted 5 lines

Changes to RDMA have a disproportionate level of impact compared to all of netdev.

So comparing the level of real or perceived potential impact is quite intellectually dishonest.

This whole discussion was more emotional than intellectual :).

Anyway, I sent v4 https://lore.kernel.org/linux-rdma/[email protected]
and that variant provides default version value without harming
out-of-tree modules.

I have a plan to start and remove ethtool version and MODULE_VERSION() calls from the drivers/net/* modules after merge window completes.

Does this plan sound right to you?

Thanks

maintainer
#26 lore raw

From: Leon Romanovsky <[email protected]>
Date: Mon, 27 Jan 2020 14:42:05 +0200

Quoted 8 lines

Anyway, I sent v4 https://lore.kernel.org/linux-rdma/[email protected]
and that variant provides default version value without harming
out-of-tree modules.

I have a plan to start and remove ethtool version and MODULE_VERSION() calls from the drivers/net/* modules after merge window completes.

Does this plan sound right to you?

Yes it does, I was just reviewing the patch now.

#27 lore raw
In reply to Leon Romanovsky
Quoted 70 lines · Leon Romanovsky
Quoted 49 lines · Jakub Kicinski
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · Leon Romanovsky
Quoted 8 lines

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Quoted 5 lines
Quoted 4 lines

Shannon does have a point that out of tree drivers still make use of this field. Perhaps it would be a more suitable first step to print the kernel version as default and add a comment saying upstream modules shouldn't overwrite it (perhaps one day CI can catch new violators).

Shannon proposed to remove this field and it was me who said no :)

Obviously, we can't remove fields from UAPI structs.

Quoted 3 lines

My plan is to overwrite ->version, delete all users and add WARN_ONEC(strcpy(..->version_)...) inside net/ethtool/ to catch abusers.

What I was thinking just now was: initialize ->version to utsname before drivers are called, delete all upstream users, add a coccicheck for upstream drivers which try to report the version.

Quoted 7 lines
Quoted 5 lines

The NFP reports the git hash of the driver source plus the string "(oot)" for out-of-tree:

https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L297
https://github.com/Netronome/nfp-drv-kmods/blob/master/src/Kbuild#L315

I was inspired by upstream code.
https://elixir.bootlin.com/linux/v5.5-rc7/source/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c#L184

Right, upstream nfp reports kernel version (both in modinfo and ethtool) GitHub/compat/backport/out-of-tree reports kernel version in which the code was expected to appear in modinfo:

https://github.com/Netronome/nfp-drv-kmods/commit/7ec15c47caf5dbdf1f9806410535ad5b7373ec34#diff-492d7fa4004d885a38cfa889ed1adbe7L1284

And git hash of the driver source plus out of tree marker in ethtool.

That means it's out-of-tree driver which has to carry the extra code and require extra feeding. As backport should IMHO.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

That is true. But reporting the kernel version without even as much as in-tree/out-of-tree indication makes the field entirely meaningless.

The long-standing policy in kernel that we don't really care about out-of-tree code.

Yeah... we all know it's not that simple :)

It is simple, unfortunately netdev people like to complicate things by declaring ABI in very vague way which sometimes goes so far that it ends more strict than anyone would imagine.

We, RDMA and many other subsystems mentioned in that ksummit thread, removed MODULE_VERSION() a long time ago and got zero complains from the real users.

Quoted 4 lines

The in-tree driver versions are meaningless and cause annoying churn when people arbitrarily bump them. If we can get people to stop doing that we'll be happy, that's all there is to it.

Quoted 7 lines
Quoted 3 lines

Out of tree the field is useful, so we don't have to take it away just as a matter of principle. If we can't convince people to stop bringing the versions into the tree that'll be another story...

As Shannon pointed, even experienced people will try to sneak those changes. I assume that it is mainly because they are pushed to do it by the people who doesn't understand Linux kernel process.

I don't think that the Intel Networking folks were trying to "sneak" something through, I think they have simply been continuing the process that they've been following for years.  When we have groups such as them, with a long history of contributions to drivers and stack, not following the new rules, perhaps we need to take a look at how we're publicizing these changes.

sln

#28 lore raw
In reply to Leon Romanovsky
Quoted 89 lines · Leon Romanovsky
Quoted 88 lines · Shannon Nelson
Quoted 50 lines · Leon Romanovsky

From: Leon Romanovsky<[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
I wanted to change to VERMAGIC_STRING, but the output doesn't look pleasant to my taste and on my system is truncated to be "version: 5.5.0-rc6+ SMP mod_unload modve".

After this patch, we can drop all those version assignments from the drivers.

Inspired by nfp and hns code.

---
   net/core/ethtool.c | 3 +++
   1 file changed, 3 insertions(+)
net/core/ethtool.c +3 -1
index cd9bc67381b2..3c6fb13a78bf 100644
@@ -17,6 +17,7 @@
   #include <linux/phy.h>
   #include <linux/bitops.h>
   #include <linux/uaccess.h>
+#include <linux/vermagic.h>
   #include <linux/vmalloc.h>
   #include <linux/sfp.h>
   #include <linux/slab.h>
@@ -776,6 +777,8 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
   		return -EOPNOTSUPP;
   	}
 
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
+
   	/*
   	 * this method of obtaining string set info is deprecated;
   	 * Use ETHTOOL_GSSET_INFO instead.
--
Quoted 2 lines

2.20.1

First of all, although I've seen some of the arguments about distros and their backporting, I still believe that the driver version number is useful.  In most cases it at least gets us in the ballpark of what generation the driver happens to be and is still useful. I'd really prefer that it is just left alone for the device manufactures and their support folks to deal with.

Fine, I'm sure I lose that argument since there's already been plenty of discussion about it.

Meanwhile, there is some non-zero number of support scripts and processes, possibly internal testing chains, that use that driver/vendor specific version information and will be broken by this change.  Small number?  Large number?  I don't know, but we're breaking them.

Sure, I probably easily lose that argument too, but it still should be stated.

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Of course, out-of-tree drivers are not first class citizens, so I probably lose that argument as well.

So if you are so all fired up about not allowing the drivers to report their own version number, then why report anything at all? Maybe just report a blank field.  As some have said, the uname info is already available else where, why are we sticking it here?

Quoted 6 lines
Quoted 2 lines

Personally, I think this is a rather arbitrary, heavy handed and unnecessary slam on the drivers, and will make support more difficult in the long run.

The thing is that leaving this field as empty, for sure will break all applications. I have a feeling that it can be close to 100% hit rate. So, kernel version was chosen as an option, because it is already successfully in use by at least two drivers (nfp and hns).

I'm glad that works for those drivers.

Quoted 5 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

So you want to remove the one reliable place to put some information we find useful, thus forcing us to come up with creative new places to put it?  Shall we remove the firmware version number as well when we start abusing it by adding driver version information?

There has been a lot of work over the years to try to corral and unify various bits of information so that everyone can access it the same way, and now you're trying to remove one of those methods. This will only force driver writers to get "creative" on how to get the info they need out to the user.

Quoted 3 lines

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

Shall we also fix it so those pesky distros can't add their own arbitrary version numbers to the kernel?

Again, I think you are trying to remove a useful bit of information.  Just because it isn't useful to you doesn't mean it is useless to others.

sln

#29 lore raw
Quoted 99 lines · Shannon Nelson
Quoted 89 lines · Leon Romanovsky
Quoted 88 lines · Shannon Nelson
Quoted 50 lines · Leon Romanovsky

From: Leon Romanovsky<[email protected]>

In order to stop useless driver version bumps and unify output presented by ethtool -i, let's overwrite the version string.

Before this change:
[leonro@erver ~]$ ethtool -i eth0
driver: virtio_net
version: 1.0.0
After this change:
[leonro@server ~]$ ethtool -i eth0
driver: virtio_net
version: 5.5.0-rc6+

---
I wanted to change to VERMAGIC_STRING, but the output doesn't look pleasant to my taste and on my system is truncated to be "version: 5.5.0-rc6+ SMP mod_unload modve".

After this patch, we can drop all those version assignments from the drivers.

Inspired by nfp and hns code.

---
   net/core/ethtool.c | 3 +++
   1 file changed, 3 insertions(+)
net/core/ethtool.c +3 -1
index cd9bc67381b2..3c6fb13a78bf 100644
@@ -17,6 +17,7 @@
   #include <linux/phy.h>
   #include <linux/bitops.h>
   #include <linux/uaccess.h>
+#include <linux/vermagic.h>
   #include <linux/vmalloc.h>
   #include <linux/sfp.h>
   #include <linux/slab.h>
@@ -776,6 +777,8 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
   		return -EOPNOTSUPP;
   	}
 
+	strlcpy(info.version, UTS_RELEASE, sizeof(info.version));
+
   	/*
   	 * this method of obtaining string set info is deprecated;
   	 * Use ETHTOOL_GSSET_INFO instead.
--
Quoted 2 lines

2.20.1

First of all, although I've seen some of the arguments about distros and their backporting, I still believe that the driver version number is useful.  In most cases it at least gets us in the ballpark of what generation the driver happens to be and is still useful. I'd really prefer that it is just left alone for the device manufactures and their support folks to deal with.

Fine, I'm sure I lose that argument since there's already been plenty of discussion about it.

Meanwhile, there is some non-zero number of support scripts and processes, possibly internal testing chains, that use that driver/vendor specific version information and will be broken by this change.  Small number?  Large number?  I don't know, but we're breaking them.

Sure, I probably easily lose that argument too, but it still should be stated.

This will end up affecting out-of-tree drivers as well, where it is useful to know what the version number is, most especially since it is different from what the kernel provided driver is.  How else are we to get this information out to the user?  If this feature gets squashed, we'll end up having to abuse some other mechanism so we can get the live information from the driver, and probably each vendor will find a different way to sneak it out, giving us more chaos than where we started.  At least the ethtool version field is a known and consistent place for the version info.

Of course, out-of-tree drivers are not first class citizens, so I probably lose that argument as well.

So if you are so all fired up about not allowing the drivers to report their own version number, then why report anything at all? Maybe just report a blank field.  As some have said, the uname info is already available else where, why are we sticking it here?

Quoted 6 lines
Quoted 2 lines

Personally, I think this is a rather arbitrary, heavy handed and unnecessary slam on the drivers, and will make support more difficult in the long run.

The thing is that leaving this field as empty, for sure will break all applications. I have a feeling that it can be close to 100% hit rate. So, kernel version was chosen as an option, because it is already successfully in use by at least two drivers (nfp and hns).

I'm glad that works for those drivers.

Quoted 8 lines
Quoted 5 lines

Leaving to deal with driver version to vendors is not an option too, because they prove for more than once that they are not capable to define user visible interfaces. It comes due to their natural believe that their company is alone in the world and user visible interface should be suitable for them only.

So you want to remove the one reliable place to put some information we find useful, thus forcing us to come up with creative new places to put it?

What exactly do you find reliable in random string printed by ethtool?

Quoted 2 lines

Shall we remove the firmware version number as well when we start abusing it by adding driver version information?

It is unrelated and I have hard time to understand your question, firmware is not part of the kernel and firmware version needed to tight specific driver to specific version. It doesn't need to be general by definition.

Quoted 6 lines

There has been a lot of work over the years to try to corral and unify various bits of information so that everyone can access it the same way, and now you're trying to remove one of those methods. This will only force driver writers to get "creative" on how to get the info they need out to the user.

I'm not removing, but fixing something that was broken for a long time already. The version thing comes from pre-git era and it doesn't make sense for a long time already.

Quoted 11 lines
Quoted 4 lines

It is already impossible for users to distinguish properly versions of different vendors, because they use arbitrary strings with some numbers.

Shall we also fix it so those pesky distros can't add their own arbitrary version numbers to the kernel?

Again, I think you are trying to remove a useful bit of information.  Just because it isn't useful to you doesn't mean it is useless to others.

Again, I'm not removing it.

Feel free to start discussion in ksummit mailing list on why it is so useful that we need to update driver version independently from the main kernel version.

If you success to convince Linus and Greg, we will be happy to update our driver version every week like a clock.

Thanks

Quoted 2 lines

sln