RE: [PATCH 03/19] drivers/hv: minimal mshv module (/dev/mshv/)

From: Sunil Muthuswamy
Date: Wed Jun 02 2021 - 21:28:14 EST


> diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
> index 66c794d92391..d618b1fab2bb 100644
> --- a/drivers/hv/Kconfig
> +++ b/drivers/hv/Kconfig
> @@ -27,4 +27,22 @@ config HYPERV_BALLOON
> help
> Select this option to enable Hyper-V Balloon driver.
>
> +config HYPERV_ROOT_API

A more suitable place to put this would be under the "VIRTUALIZATION"
config menu option, where we have the "KVM" option today.

> + tristate "Microsoft Hypervisor root partition interfaces: /dev/mshv"
> + depends on HYPERV
> + help
> + Provides access to interfaces for managing guest virtual machines
> + running under the Microsoft Hypervisor.

These are technically not "root" interfaces. As you say it too, these are
interfaces to manage guest VMs. Calling it "HYPERV_ROOT_API" would
be confusing. Something along the lines of "HYPERV_VMM_API" or
"HYPERV_VM_API" seems more appropriate to me.

> new file mode 100644
> index 000000000000..c68cc84fb983
> --- /dev/null
> +++ b/drivers/hv/mshv_main.c
Why not in /virt/hv or something under /virt?

> +static int mshv_dev_open(struct inode *inode, struct file *filp);
> +static int mshv_dev_release(struct inode *inode, struct file *filp);
> +static long mshv_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg);

Do we need to have both 'mshv' & 'dev' in the name? How about just
calling these 'mshv_xyz'? Like you have for init/exit.

> +
> +static struct miscdevice mshv_dev = {
> + .minor = MISC_DYNAMIC_MINOR,
> + .name = "mshv",
> + .fops = &mshv_dev_fops,
> + .mode = 600,
> +};
For the default mode, I think we want to keep it the same as that for 'kvm'.

- Sunil