* [PATCH] vhost/vsock: use static minor number
@ 2017-05-09 19:28 Stefan Hajnoczi
2017-05-10 8:01 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2017-05-09 19:28 UTC (permalink / raw)
To: kvm
Cc: Greg Kroah-Hartman, device, Michael S. Tsirkin, Arnd Bergmann,
linux-kernel, Stefan Hajnoczi
Vhost-vsock is a software device so there is no probe call that causes
the driver to register its misc char device node. This creates a
chicken and egg problem: userspace applications must open
/dev/vhost-vsock to use the driver but the file doesn't exist until the
kernel module has been loaded.
Use the devname modalias mechanism so that /dev/vhost-vsock is created
at boot. The vhost_vsock kernel module is automatically loaded when the
first application opens /dev/host-vsock.
Note that the "reserved for local use" range in
Documentation/admin-guide/devices.txt is incorrect. The userio driver
already occupies part of that range. I've updated the documentation
accordingly.
Cc: device@lanana.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
Documentation/admin-guide/devices.txt | 3 ++-
include/linux/miscdevice.h | 1 +
drivers/vhost/vsock.c | 4 +++-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
index c9cea2e..5fe3480 100644
--- a/Documentation/admin-guide/devices.txt
+++ b/Documentation/admin-guide/devices.txt
@@ -369,8 +369,9 @@
237 = /dev/loop-control Loopback control device
238 = /dev/vhost-net Host kernel accelerator for virtio net
239 = /dev/uhid User-space I/O driver support for HID subsystem
+ 241 = /dev/vhost-vsock Host kernel driver for virtio vsock
- 240-254 Reserved for local use
+ 242-254 Reserved for local use
255 Reserved for MISC_DYNAMIC_MINOR
11 char Raw keyboard device (Linux/SPARC only)
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 762b5fe..58751ea 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -54,6 +54,7 @@
#define VHOST_NET_MINOR 238
#define UHID_MINOR 239
#define USERIO_MINOR 240
+#define VHOST_VSOCK_MINOR 241
#define MISC_DYNAMIC_MINOR 255
struct device;
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 44eed8e..53e3e95 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -701,7 +701,7 @@ static const struct file_operations vhost_vsock_fops = {
};
static struct miscdevice vhost_vsock_misc = {
- .minor = MISC_DYNAMIC_MINOR,
+ .minor = VHOST_VSOCK_MINOR,
.name = "vhost-vsock",
.fops = &vhost_vsock_fops,
};
@@ -773,3 +773,5 @@ module_exit(vhost_vsock_exit);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Asias He");
MODULE_DESCRIPTION("vhost transport for vsock ");
+MODULE_ALIAS_MISCDEV(VHOST_VSOCK_MINOR);
+MODULE_ALIAS("devname:vhost-vsock");
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost/vsock: use static minor number
2017-05-09 19:28 [PATCH] vhost/vsock: use static minor number Stefan Hajnoczi
@ 2017-05-10 8:01 ` Arnd Bergmann
2017-05-10 14:19 ` Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-05-10 8:01 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: kvm, Greg Kroah-Hartman, device, Michael S. Tsirkin,
Linux Kernel Mailing List
On Tue, May 9, 2017 at 9:28 PM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> Note that the "reserved for local use" range in
> Documentation/admin-guide/devices.txt is incorrect. The userio driver
> already occupies part of that range. I've updated the documentation
> accordingly.
...
> diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
> index c9cea2e..5fe3480 100644
> --- a/Documentation/admin-guide/devices.txt
> +++ b/Documentation/admin-guide/devices.txt
> @@ -369,8 +369,9 @@
> 237 = /dev/loop-control Loopback control device
> 238 = /dev/vhost-net Host kernel accelerator for virtio net
> 239 = /dev/uhid User-space I/O driver support for HID subsystem
> + 241 = /dev/vhost-vsock Host kernel driver for virtio vsock
It seems like you intended to add the 240 documentation here as well but
then sent the patch without it.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost/vsock: use static minor number
2017-05-10 8:01 ` Arnd Bergmann
@ 2017-05-10 14:19 ` Stefan Hajnoczi
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2017-05-10 14:19 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Stefan Hajnoczi, kvm, Greg Kroah-Hartman, device,
Michael S. Tsirkin, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
On Wed, May 10, 2017 at 10:01:36AM +0200, Arnd Bergmann wrote:
> On Tue, May 9, 2017 at 9:28 PM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> >
> > Note that the "reserved for local use" range in
> > Documentation/admin-guide/devices.txt is incorrect. The userio driver
> > already occupies part of that range. I've updated the documentation
> > accordingly.
> ...
> > diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
> > index c9cea2e..5fe3480 100644
> > --- a/Documentation/admin-guide/devices.txt
> > +++ b/Documentation/admin-guide/devices.txt
> > @@ -369,8 +369,9 @@
> > 237 = /dev/loop-control Loopback control device
> > 238 = /dev/vhost-net Host kernel accelerator for virtio net
> > 239 = /dev/uhid User-space I/O driver support for HID subsystem
> > + 241 = /dev/vhost-vsock Host kernel driver for virtio vsock
>
> It seems like you intended to add the 240 documentation here as well but
> then sent the patch without it.
Thanks, will fix in v2.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-10 14:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 19:28 [PATCH] vhost/vsock: use static minor number Stefan Hajnoczi
2017-05-10 8:01 ` Arnd Bergmann
2017-05-10 14:19 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).