vhost-net: add module alias
Subsystems (7)
PATCH 1/1 vhost-net: add module alias
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
--- drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/vhost/net.c +5 -3
@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )
@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );
include/linux/miscdevice.h +1 -0
@@ -31,6 +31,7 @@#define I2O_MINOR 166#define MICROCODE_MINOR 184#define TUN_MINOR 200 +#define VHOST_NET_MINOR 201#define MWAVE_MINOR 219/* ACP/Mwave Modem */ #define MPT_MINOR 220#define MPT2SAS_MINOR 221
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Why do you think a statically-allocated device number will do any good at all? Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
Thanks,
/mjt
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Why do you think a statically-allocated device number will do any good at all? Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
Thanks,
/mjt
Quoted 40 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)drivers/vhost/net.c 2012-01-10 19:48:23.650225892 -0800 renamed from drivers/vhost/net.c 2012-01-10 10:56:58.883179194 -0800 +6
-6@@ -856,9 +856,9 @@ static const struct file_operations vhos }; static struct miscdevice vhost_net_misc = { - MISC_DYNAMIC_MINOR, - "vhost-net", - &vhost_net_fops, + .minor = VHOST_NET_MINOR, + .name = "vhost-net", + .fops = &vhost_net_fops, }; static int vhost_net_init(void)@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1"); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Michael S. Tsirkin"); MODULE_DESCRIPTION("Host kernel accelerator for virtio net"); +MODULE_ALIAS_MISCDEV(VHOST_NET_MINOR); +MODULE_ALIAS("devname:vhost-net"); --- a/include/linux/miscdevice.h 2012-01-10 10:56:59.779189436 -0800 +++ b/include/linux/miscdevice.h 2012-01-10 19:49:56.091748210 -0800
drivers/vhost/net.c 2012-01-10 19:48:23.650225892 -0800 line 35
Quoted 5 lines
drivers/vhost/net.c 2012-01-10 19:48:23.650225892 -0800 renamed from drivers/vhost/net.c 2012-01-10 10:56:58.883179194 -0800 +1
-0@@ -31,6 +31,7 @@ #define I2O_MINOR 166 #define MICROCODE_MINOR 184 #define TUN_MINOR 200 +#define VHOST_NET_MINOR 201
include/linux/miscdevice.h:
/*
* These allocations are managed by [email protected]. If you use an * entry that is not in assigned your entry may well be moved and * reassigned, or set dynamic if a fixed value is not justified.
*/
#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
Quoted 8 lines
drivers/vhost/net.c 2012-01-10 19:48:23.650225892 -0800 renamed from drivers/vhost/net.c 2012-01-10 10:56:58.883179194 -0800 +0
-0#define MPT_MINOR 220 #define MPT2SAS_MINOR 221_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 10 lines · On Wed, 11 Jan 2012 15:43:42 +0800 Amos Kong <[email protected]> wrote:
Quoted 7 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)
:
Quoted 5 lines
/*
* These allocations are managed by [email protected]. If you use an * entry that is not in assigned your entry may well be moved and * reassigned, or set dynamic if a fixed value is not justified.*/
Didn't that mailing address was ever used any more. Like many places in kernel, the comment looked like a historical leftover.
Quoted 10 lines · On Wed, 11 Jan 2012 15:43:42 +0800 Amos Kong <[email protected]> wrote:
Quoted 7 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-)
:
Quoted 5 lines
/*
* These allocations are managed by [email protected]. If you use an * entry that is not in assigned your entry may well be moved and * reassigned, or set dynamic if a fixed value is not justified.*/
Didn't that mailing address was ever used any more. Like many places in kernel, the comment looked like a historical leftover.
Quoted 11 lines · On Wed, 11 Jan 2012 11:07:47 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Why do you think a statically-allocated device number will do any good at all? Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
The statically allocated device number is required for the udev/module autoloading to work. Probably the udev infrastructure needs a consistent number to hang off of.
It looks like:
* driver adds MODULE_ALIAS() for devname and character device
* depmod scans modules and creates modules.devname (in /lib/modules)
* udev uses modules.devname to autoload the module
$ /sbin/modinfo vhost_net filename: /lib/modules/3.2.0-net+/kernel/drivers/vhost/vhost_net.ko alias: devname:vhost-net alias: char-major-10-201 description: Host kernel accelerator for virtio net ...
See also: https://lkml.org/lkml/2010/5/21/134
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Wed, 11 Jan 2012 11:07:47 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Quoted 5 lines
Quoted 5 lines
Why do you think a statically-allocated device number will do any good at all? Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
[]
Quoted 1 line
See also: https://lkml.org/lkml/2010/5/21/134
Aha. So udev pre-creates statically-allocated devnodes nowadays:
Udev will pick up the depmod created file on startup and create all the static device nodes which the kernel modules specify, so that these modules get automatically loaded when the device node is accessed...
This was the part I missed. Now it all looks logically.
Thanks,
/mjt
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Wed, 11 Jan 2012 11:07:47 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Quoted 5 lines
Quoted 5 lines
Why do you think a statically-allocated device number will do any good at all? Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
[]
Quoted 1 line
See also: https://lkml.org/lkml/2010/5/21/134
Aha. So udev pre-creates statically-allocated devnodes nowadays:
Udev will pick up the depmod created file on startup and create all the static device nodes which the kernel modules specify, so that these modules get automatically loaded when the device node is accessed...
This was the part I missed. Now it all looks logically.
Thanks,
/mjt
Quoted 11 lines · Stephen Hemminger
Quoted 8 lines · On Wed, 11 Jan 2012 11:07:47 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Why do you think a statically-allocated device number will do any good at all?
It's totally fine to use them for single-instance devices. You are right, enumerated devices must _never_ use any facility like that. That would just be broken.
Quoted 4 lines
Quoted 4 lines
Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
It makes a lot of sense in this case. The kernel module files advertise the dev_t, it's not stored anywhere else. UDev finds these static numbers and does inplicit mkdev() for them.
Quoted 3 lines
The statically allocated device number is required for the udev/module autoloading to work. Probably the udev infrastructure needs a consistent number to hang off of.
It does that properly.
Just check:
$ cat /lib/modules/$(uname -r)/modules.devname # Device nodes to trigger on-demand module loading. fuse fuse c10:229 btrfs btrfs-control c10:234 ppp_generic ppp c108:0 tun net/tun c10:200 uinput uinput c10:223 ...
Kay
Quoted 11 lines · Stephen Hemminger
Quoted 8 lines · On Wed, 11 Jan 2012 11:07:47 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Why do you think a statically-allocated device number will do any good at all?
It's totally fine to use them for single-instance devices. You are right, enumerated devices must _never_ use any facility like that. That would just be broken.
Quoted 4 lines
Quoted 4 lines
Static /dev is gone almost completely, at least on the systems where whole virt stuff makes any sense, so you don't have pre-created vhost-net device anymore, and hence this allocation makes no sense. Just IMHO anyway.
It makes a lot of sense in this case. The kernel module files advertise the dev_t, it's not stored anywhere else. UDev finds these static numbers and does inplicit mkdev() for them.
Quoted 3 lines
The statically allocated device number is required for the udev/module autoloading to work. Probably the udev infrastructure needs a consistent number to hang off of.
It does that properly.
Just check:
$ cat /lib/modules/$(uname -r)/modules.devname # Device nodes to trigger on-demand module loading. fuse fuse c10:229 btrfs btrfs-control c10:234 ppp_generic ppp c108:0 tun net/tun c10:200 uinput uinput c10:223 ...
Kay
PATCH 1/1 vhost-net: add module alias (v2)
In reply to Stephen HemmingerBy adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
---
v2 - document minor number and make sure to not overlap
Documentation/devices.txt | 2 ++ drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/vhost/net.c +5 -3
@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )
@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );
include/linux/miscdevice.h +1 -0
@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;
Documentation/devices.txt +2 -0
@@ -447,6 +447,8 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/vhost-net Host kernel accelerator for virtio net + 240-254 Reserved for local use 255 Reserved for MISC_DYNAMIC_MINOR
Michael S. Tsirkin
maintainerRe: [PATCH] vhost-net: add module alias (v2)
Quoted 8 lines · Stephen Hemminger
By adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>
I don't mind but this needs an Ack from Alan Cox
who made it dynamic in the first place,
see 79907d89c397b8bc2e05b347ec94e928ea919d33.
Quoted 51 lines
---
v2 - document minor number and make sure to not overlapDocumentation/devices.txt | 2 ++ drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-)drivers/vhost/net.c +5
-3@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );include/linux/miscdevice.h +1
-0@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;Documentation/devices.txt +2
-0@@ -447,6 +447,8 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/vhost-net Host kernel accelerator for virtio net + 240-254 Reserved for local use 255 Reserved for MISC_DYNAMIC_MINOR
Michael S. Tsirkin
maintainerQuoted 21 lines · Stephen Hemminger
Quoted 10 lines · On Wed, 11 Jan 2012 15:43:42 +0800 Amos Kong <[email protected]> wrote:
Quoted 7 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-):
Quoted 8 lines
Quoted 5 lines
/*
* These allocations are managed by [email protected]. If you use an * entry that is not in assigned your entry may well be moved and * reassigned, or set dynamic if a fixed value is not justified.*/
Didn't that mailing address was ever used any more. Like many places in kernel, the comment looked like a historical leftover.
This was only added in 2010, see 79907d89c397b8bc2e05b347ec94e928ea919d33.
That said at least lanana.org web site seems to be down.
Alan, any idea?
Signature · 1 line
MST
Re: [PATCH] vhost-net: add module alias (v2)
In reply to Stephen HemmingerQuoted 11 lines · Stephen Hemminger
By adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>---
v2 - document minor number and make sure to not overlap
[...]
Quoted 13 lines
include/linux/miscdevice.h +1
-0@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;
Documentation/devices.txt Your cooperation is appreciated. · line 450
Quoted 4 lines
Documentation/devices.txt +1
-0@@ -447,6 +447,8 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/vhost-net Host kernel accelerator for virtio net
[...]
238 != 237. It looks like someone forgot to add loopctrl here.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [PATCH] vhost-net: add module alias (v2)
In reply to Stephen HemmingerQuoted 51 lines · Stephen Hemminger
By adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>---
v2 - document minor number and make sure to not overlapDocumentation/devices.txt | 2 ++
drivers/vhost/net.c | 8 +++++---
include/linux/miscdevice.h | 1 +3 files changed, 8 insertions(+), 3 deletions(-)drivers/vhost/net.c 2012-01-10 19:48:23.650225892 -0800 renamed from drivers/vhost/net.c 2012-01-10 10:56:58.883179194 -0800 +5
-3@@ -856,9 +856,9 @@ static const struct file_operations vhos }; static struct miscdevice vhost_net_misc = { - MISC_DYNAMIC_MINOR, - "vhost-net", - &vhost_net_fops, + .minor = VHOST_NET_MINOR, + .name = "vhost-net", + .fops = &vhost_net_fops, }; static int vhost_net_init(void)@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1"); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Michael S. Tsirkin"); MODULE_DESCRIPTION("Host kernel accelerator for virtio net"); +MODULE_ALIAS_MISCDEV(VHOST_NET_MINOR); +MODULE_ALIAS("devname:vhost-net");include/linux/miscdevice.h 2012-01-11 09:13:20.803694316 -0800 renamed from include/linux/miscdevice.h 2012-01-10 10:56:59.779189436 -0800 +1
-0@@ -42,6 +42,7 @@ #define AUTOFS_MINOR 235 #define MAPPER_CTRL_MINOR 236 #define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238 #define MISC_DYNAMIC_MINOR 255 struct device;Documentation/devices.txt 2012-01-11 09:12:49.251197653 -0800 renamed from Documentation/devices.txt 2012-01-10 10:56:53.399116518 -0800 +0
-0@@ -447,6 +447,8 @@ Your cooperation is appreciated.
Quoted 5 lines
234 =
/dev/btrfs-controlBtrfs control device 235 =/dev/autofsAutofs control device
236 =/dev/mapper/controlDevice-Mapper control device
+ 237 =/dev/vhost-netHost kernel accelerator for virtio net +
238? The stuff for LOOP_CTRL seems to be missing?
Quoted 9 lines
240-254 Reserved for local use 255 Reserved for
MISC_DYNAMIC_MINOR_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Signature · 3 lines
Regards, Zhi Yong Wu
Re: [PATCH] vhost-net: add module alias (v2)
In reply to Stephen HemmingerQuoted 51 lines · Stephen Hemminger
By adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>---
v2 - document minor number and make sure to not overlapDocumentation/devices.txt | 2 ++
drivers/vhost/net.c | 8 +++++---
include/linux/miscdevice.h | 1 +3 files changed, 8 insertions(+), 3 deletions(-)drivers/vhost/net.c 2012-01-10 19:48:23.650225892 -0800 renamed from drivers/vhost/net.c 2012-01-10 10:56:58.883179194 -0800 +5
-3@@ -856,9 +856,9 @@ static const struct file_operations vhos }; static struct miscdevice vhost_net_misc = { - MISC_DYNAMIC_MINOR, - "vhost-net", - &vhost_net_fops, + .minor = VHOST_NET_MINOR, + .name = "vhost-net", + .fops = &vhost_net_fops, }; static int vhost_net_init(void)@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1"); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Michael S. Tsirkin"); MODULE_DESCRIPTION("Host kernel accelerator for virtio net"); +MODULE_ALIAS_MISCDEV(VHOST_NET_MINOR); +MODULE_ALIAS("devname:vhost-net");include/linux/miscdevice.h 2012-01-11 09:13:20.803694316 -0800 renamed from include/linux/miscdevice.h 2012-01-10 10:56:59.779189436 -0800 +1
-0@@ -42,6 +42,7 @@ #define AUTOFS_MINOR 235 #define MAPPER_CTRL_MINOR 236 #define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238 #define MISC_DYNAMIC_MINOR 255 struct device;Documentation/devices.txt 2012-01-11 09:12:49.251197653 -0800 renamed from Documentation/devices.txt 2012-01-10 10:56:53.399116518 -0800 +0
-0@@ -447,6 +447,8 @@ Your cooperation is appreciated.
Quoted 5 lines
234 =
/dev/btrfs-controlBtrfs control device 235 =/dev/autofsAutofs control device
236 =/dev/mapper/controlDevice-Mapper control device
+ 237 =/dev/vhost-netHost kernel accelerator for virtio net +
238? The stuff for LOOP_CTRL seems to be missing?
Quoted 9 lines
240-254 Reserved for local use 255 Reserved for
MISC_DYNAMIC_MINOR_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Signature · 3 lines
Regards, Zhi Yong Wu
PATCH 1/1 vhost-net: add module alias (v2.1)
In reply to Zhi Yong WuSubject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-control
---
2.1 - add missing documentation for loop control as well
Documentation/devices.txt | 3 +++ drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/vhost/net.c +5 -3
@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )
@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );
include/linux/miscdevice.h +1 -0
@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;
Documentation/devices.txt +3 -0
@@ -447,6 +447,9 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/loop-control Loopback control device + 238 = /dev/vhost-net Host kernel accelerator for virtio net + 240-254 Reserved for local use 255 Reserved for MISC_DYNAMIC_MINOR
Re: [PATCH] vhost-net: add module alias (v2)
In reply to Stephen HemmingerQuoted 52 lines · Stephen Hemminger
By adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>---
v2 - document minor number and make sure to not overlapDocumentation/devices.txt | 2 ++ drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-)drivers/vhost/net.c +5
-3@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );include/linux/miscdevice.h +1
-0@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;
Documentation/devices.txt Your cooperation is appreciated. · line 454
Quoted 8 lines
Documentation/devices.txt +2
-0@@ -447,6 +447,8 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/vhost-net Host kernel accelerator for virtio net + 240-254 Reserved for local use 255 Reserved for MISC_DYNAMIC_MINOR
You added vhost-net minor as 238 in the code and 237 in the documentation. That's because loop-control is missing from the docs.
Regards.
Cascardo.
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] vhost-net: add module alias (v2)
In reply to Stephen HemmingerQuoted 52 lines · Stephen Hemminger
By adding the correct module alias, programs won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Also, use C99 style initialization.
Signed-off-by Stephen Hemminger <[email protected]>---
v2 - document minor number and make sure to not overlapDocumentation/devices.txt | 2 ++ drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-)drivers/vhost/net.c +5
-3@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );include/linux/miscdevice.h +1
-0@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;
Documentation/devices.txt Your cooperation is appreciated. · line 454
Quoted 8 lines
Documentation/devices.txt +2
-0@@ -447,6 +447,8 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/vhost-net Host kernel accelerator for virtio net + 240-254 Reserved for local use 255 Reserved for MISC_DYNAMIC_MINOR
You added vhost-net minor as 238 in the code and 237 in the documentation. That's because loop-control is missing from the docs.
Regards.
Cascardo.
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH] vhost-net: add module alias (v2.1)
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Date: Wed, 11 Jan 2012 21:30:38 -0800
Quoted 11 lines
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>
ACKs, NACKs? What is happening here?
Kay Sievers
Acked-byRe: [PATCH] vhost-net: add module alias (v2.1)
Quoted 9 lines · David Miller
From: Stephen Hemminger <[email protected]>
Date: Wed, 11 Jan 2012 21:30:38 -0800Quoted 6 lines
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Quoted 7 lines
Quoted 5 lines
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>ACKs, NACKs? What is happening here?
In general, static minors are acceptable and very useful to make on-demand loading of kernel modules working. They should be used only for single-instance devices though, which usually means: One single static device name associated with a module.
That looks all fine here, and for what it's worth:
Kay
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
David Miller
maintainerRe: [PATCH] vhost-net: add module alias (v2.1)
From: Kay Sievers <[email protected]>
Date: Fri, 13 Jan 2012 05:19:05 +0100
Quoted 18 lines · David Miller
Quoted 9 lines
From: Stephen Hemminger <[email protected]>
Date: Wed, 11 Jan 2012 21:30:38 -0800Quoted 6 lines
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Quoted 7 lines
Quoted 5 lines
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>ACKs, NACKs? What is happening here?
Quoted 7 lines
In general, static minors are acceptable and very useful to make on-demand loading of kernel modules working. They should be used only for single-instance devices though, which usually means: One single static device name associated with a module.
That looks all fine here, and for what it's worth:
Acked-by Kay Sievers <[email protected]>
Ok, applied, thanks everyone.
Michael S. Tsirkin
maintainerRe: [PATCH] vhost-net: add module alias (v2.1)
In reply to David MillerQuoted 9 lines · David Miller
From: Stephen Hemminger <[email protected]>
Date: Wed, 11 Jan 2012 21:30:38 -0800Quoted 6 lines
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Quoted 7 lines
Quoted 5 lines
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>ACKs, NACKs? What is happening here?
I would like an Ack from Alan Cox who switched vhost-net to a dynamic minor in the first place, in commit 79907d89c397b8bc2e05b347ec94e928ea919d33.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: [PATCH] vhost-net: add module alias (v2.1)
In reply to David MillerQuoted 9 lines · David Miller
From: Stephen Hemminger <[email protected]>
Date: Wed, 11 Jan 2012 21:30:38 -0800Quoted 6 lines
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Quoted 7 lines
Quoted 5 lines
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>ACKs, NACKs? What is happening here?
I would like an Ack from Alan Cox who switched vhost-net to a dynamic minor in the first place, in commit 79907d89c397b8bc2e05b347ec94e928ea919d33.
Signature · 1 line
MST
Re: [PATCH] vhost-net: add module alias (v2.1)
In reply to Michael S. TsirkinQuoted 5 lines
Quoted 1 line
ACKs, NACKs? What is happening here?
I would like an Ack from Alan Cox who switched vhost-net to a dynamic minor in the first place, in commit
79907d89c397b8bc2e05b347ec94e928ea919d33.
Sorry [email protected] isn't yet back from the kernel hack incident.
I don't read netdev so someone needs to summarise the issue and send me a copy of the patch to look at.
Alan
Quoted 4 lines · Stephen Hemminger
By adding the a module alias, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work. Choose one next to TUN since this driver is related to it.
Statically allocated numbers have to go through lanana, no?
This increases the security exposure and the kernel footprint for hosts that don't want vhost-net.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [PATCH] vhost-net: add module alias (v2.1)
In reply to Alan CoxQuoted 6 lines · On Mon, 16 Jan 2012 12:26:45 +0000 Alan Cox <[email protected]> wrote:
Quoted 5 lines
Quoted 1 line
ACKs, NACKs? What is happening here?
I would like an Ack from Alan Cox who switched vhost-net to a dynamic minor in the first place, in commit
79907d89c397b8bc2e05b347ec94e928ea919d33.
Quoted 6 lines
Sorry [email protected] isn't yet back from the kernel hack incident.
I don't read netdev so someone needs to summarise the issue and send me a copy of the patch to look at.
Alan
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-control
---
2.1 - add missing documentation for loop control as well
Documentation/devices.txt | 3 +++ drivers/vhost/net.c | 8 +++++--- include/linux/miscdevice.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/vhost/net.c +5 -3
@@ -856,9 +856,9 @@ static const struct file_operations vhos };static struct miscdevice vhost_net_misc = { -MISC_DYNAMIC_MINOR , -"vhost-net" , - &vhost_net_fops, + .minor =VHOST_NET_MINOR , + .name ="vhost-net" , + .fops = &vhost_net_fops, };static int vhost_net_init (void )
@@ -879,3 +879,5 @@ MODULE_VERSION("0.0.1");MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Michael S. Tsirkin" );MODULE_DESCRIPTION ("Host kernel accelerator for virtio net" ); +MODULE_ALIAS_MISCDEV (VHOST_NET_MINOR ); +MODULE_ALIAS ("devname:vhost-net" );
include/linux/miscdevice.h +1 -0
@@ -42,6 +42,7 @@#define AUTOFS_MINOR 235#define MAPPER_CTRL_MINOR 236#define LOOP_CTRL_MINOR 237 +#define VHOST_NET_MINOR 238#define MISC_DYNAMIC_MINOR 255struct device ;
Documentation/devices.txt +3 -0
@@ -447,6 +447,9 @@ Your cooperation is appreciated. 234 = /dev/btrfs-control Btrfs control device 235 = /dev/autofs Autofs control device 236 = /dev/mapper/control Device-Mapper control device + 237 = /dev/loop-control Loopback control device + 238 = /dev/vhost-net Host kernel accelerator for virtio net + 240-254 Reserved for local use 255 Reserved for MISC_DYNAMIC_MINOR
David Miller
maintainerRe: [PATCH] vhost-net: add module alias (v2.1)
From: Stephen Hemminger <[email protected]>
Date: Mon, 16 Jan 2012 07:52:36 -0800
Quoted 22 lines
Quoted 6 lines · On Mon, 16 Jan 2012 12:26:45 +0000 Alan Cox <[email protected]> wrote:
Quoted 5 lines
Quoted 1 line
ACKs, NACKs? What is happening here?
I would like an Ack from Alan Cox who switched vhost-net to a dynamic minor in the first place, in commit
79907d89c397b8bc2e05b347ec94e928ea919d33.Quoted 6 lines
Sorry [email protected] isn't yet back from the kernel hack incident.
I don't read netdev so someone needs to summarise the issue and send me a copy of the patch to look at.
Alan
Subject: vhost-net: add module alias (v2.1)
By adding some module aliases, programs (or users) won't have to explicitly call modprobe. Vhost-net will always be available if built into the kernel. It does require assigning a permanent minor number for depmod to work.
Quoted 5 lines
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>
I already applied your first patch, so you need to give me something relative to apply on top of your original one.
And it also shows that you're really not generating these patches against current 'net', otherwise you'd have noticed your other patch already there.
Alan Cox
Acked-byRe: [PATCH] vhost-net: add module alias (v2.1)
In reply to Stephen HemmingerQuoted 5 lines
Also:
- use C99 style initialization.
- add missing entry in documentation for loop-controlSigned-off-by Stephen Hemminger <[email protected]>
For the device allocation