2019-10-08 13:16:42

by Wei Liu

[permalink] [raw]
Subject: [PATCH RFC] kconfig: add hvconfig for Linux on Hyper-V

From: Wei Liu <[email protected]>

Add an config file snippet which enalbes additional options useful for
running the kernel in a Hyper-V guest.

The expected use case is a user provides an existing config file then
executes `make hvconfig`. It will merge those options with the
provided config file.

Based on similar concept for Xen and KVM.

Signed-off-by: Wei Liu <[email protected]>
---
RFC: I only tested this on x86. Although the config options included in
hv_guest.config don't seem to be arch-specific, we should probably
move the ones not yet implemented on Arm to an x86 specific config
file.
---
Documentation/admin-guide/README.rst | 3 +++
kernel/configs/hv_guest.config | 33 ++++++++++++++++++++++++++++
scripts/kconfig/Makefile | 5 +++++
3 files changed, 41 insertions(+)
create mode 100644 kernel/configs/hv_guest.config

diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
index cc6151fc0845..d5f4389a7a2f 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -224,6 +224,9 @@ Configuring the kernel
"make xenconfig" Enable additional options for xen dom0 guest kernel
support.

+ "make hvconfig" Enable additional options for Hyper-V guest kernel
+ support.
+
"make tinyconfig" Configure the tiniest possible kernel.

You can find more information on using the Linux kernel config tools
diff --git a/kernel/configs/hv_guest.config b/kernel/configs/hv_guest.config
new file mode 100644
index 000000000000..0e71e34a2d4d
--- /dev/null
+++ b/kernel/configs/hv_guest.config
@@ -0,0 +1,33 @@
+CONFIG_NET=y
+CONFIG_NET_CORE=y
+CONFIG_NETDEVICES=y
+CONFIG_BLOCK=y
+CONFIG_BLK_DEV=y
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_INET=y
+CONFIG_TTY=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_BINFMT_ELF=y
+CONFIG_PCI=y
+CONFIG_PCI_MSI=y
+CONFIG_DEBUG_KERNEL=y
+CONFIG_VIRTUALIZATION=y
+CONFIG_HYPERVISOR_GUEST=y
+CONFIG_PARAVIRT=y
+CONFIG_HYPERV=y
+CONFIG_HYPERV_VSOCKETS=y
+CONFIG_PCI_HYPERV=y
+CONFIG_PCI_HYPERV_INTERFACE=y
+CONFIG_HYPERV_STORAGE=y
+CONFIG_HYPERV_NET=y
+CONFIG_HYPERV_KEYBOARD=y
+CONFIG_FB_HYPERV=y
+CONFIG_HID_HYPERV_MOUSE=y
+CONFIG_HYPERV=y
+CONFIG_HYPERV_TIMER=y
+CONFIG_HYPERV_UTILS=y
+CONFIG_HYPERV_BALLOON=y
+CONFIG_HYPERV_IOMMU=y
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index ef2f2336c469..2ee46301b22e 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -104,6 +104,10 @@ PHONY += xenconfig
xenconfig: xen.config
@:

+PHONY += hvconfig
+hvconfig: hv_guest.config
+ @:
+
PHONY += tinyconfig
tinyconfig:
$(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
@@ -138,6 +142,7 @@ help:
@echo ' default value without prompting'
@echo ' kvmconfig - Enable additional options for kvm guest kernel support'
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
+ @echo ' hvconfig - Enable additional options for Hyper-V guest kernel support'
@echo ' tinyconfig - Configure the tiniest possible kernel'
@echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'

--
2.20.1


2019-10-08 16:07:53

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH RFC] kconfig: add hvconfig for Linux on Hyper-V

On Tue, Oct 8, 2019 at 10:15 PM Wei Liu <[email protected]> wrote:
>
> From: Wei Liu <[email protected]>
>
> Add an config file snippet which enalbes additional options useful for
> running the kernel in a Hyper-V guest.
>
> The expected use case is a user provides an existing config file then
> executes `make hvconfig`. It will merge those options with the
> provided config file.
>
> Based on similar concept for Xen and KVM.
>
> Signed-off-by: Wei Liu <[email protected]>
> ---
> RFC: I only tested this on x86. Although the config options included in
> hv_guest.config don't seem to be arch-specific, we should probably
> move the ones not yet implemented on Arm to an x86 specific config
> file.
> ---
> Documentation/admin-guide/README.rst | 3 +++
> kernel/configs/hv_guest.config | 33 ++++++++++++++++++++++++++++
> scripts/kconfig/Makefile | 5 +++++
> 3 files changed, 41 insertions(+)
> create mode 100644 kernel/configs/hv_guest.config
>
> diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
> index cc6151fc0845..d5f4389a7a2f 100644
> --- a/Documentation/admin-guide/README.rst
> +++ b/Documentation/admin-guide/README.rst
> @@ -224,6 +224,9 @@ Configuring the kernel
> "make xenconfig" Enable additional options for xen dom0 guest kernel
> support.
>
> + "make hvconfig" Enable additional options for Hyper-V guest kernel
> + support.
> +
> "make tinyconfig" Configure the tiniest possible kernel.
>
> You can find more information on using the Linux kernel config tools
> diff --git a/kernel/configs/hv_guest.config b/kernel/configs/hv_guest.config
> new file mode 100644
> index 000000000000..0e71e34a2d4d
> --- /dev/null
> +++ b/kernel/configs/hv_guest.config
> @@ -0,0 +1,33 @@
> +CONFIG_NET=y
> +CONFIG_NET_CORE=y
> +CONFIG_NETDEVICES=y
> +CONFIG_BLOCK=y
> +CONFIG_BLK_DEV=y
> +CONFIG_NETWORK_FILESYSTEMS=y
> +CONFIG_INET=y
> +CONFIG_TTY=y
> +CONFIG_SERIAL_8250=y
> +CONFIG_SERIAL_8250_CONSOLE=y
> +CONFIG_IP_PNP=y
> +CONFIG_IP_PNP_DHCP=y
> +CONFIG_BINFMT_ELF=y
> +CONFIG_PCI=y
> +CONFIG_PCI_MSI=y
> +CONFIG_DEBUG_KERNEL=y
> +CONFIG_VIRTUALIZATION=y
> +CONFIG_HYPERVISOR_GUEST=y
> +CONFIG_PARAVIRT=y
> +CONFIG_HYPERV=y
> +CONFIG_HYPERV_VSOCKETS=y
> +CONFIG_PCI_HYPERV=y
> +CONFIG_PCI_HYPERV_INTERFACE=y
> +CONFIG_HYPERV_STORAGE=y
> +CONFIG_HYPERV_NET=y
> +CONFIG_HYPERV_KEYBOARD=y
> +CONFIG_FB_HYPERV=y
> +CONFIG_HID_HYPERV_MOUSE=y
> +CONFIG_HYPERV=y
> +CONFIG_HYPERV_TIMER=y
> +CONFIG_HYPERV_UTILS=y
> +CONFIG_HYPERV_BALLOON=y
> +CONFIG_HYPERV_IOMMU=y
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index ef2f2336c469..2ee46301b22e 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -104,6 +104,10 @@ PHONY += xenconfig
> xenconfig: xen.config
> @:
>
> +PHONY += hvconfig
> +hvconfig: hv_guest.config
> + @:
> +


Does this need to be hooked up to kconfig Makefile?

In my understanding, this code provides
"make hvconfig" as a shorthand for "make hv_guest.config"

Please do not do this.


See "xenconfig" as a bad example.

"make xenconfig" is a shorthand of "make xen.config".
This exists to save just one character typing.


If I allow this, people would push more and more random pointless shorthands,
which are essentially unrelated to kconfig.


kvmconfig and xenconfig are just historical mistakes.


Please drop the changes to scripts/kconfig/Makefile.

Also, please do not use misleading "kconfig:" for the subject prefix.
You can use the subject prefix "hyper-v:" or something.


Thanks.


> PHONY += tinyconfig
> tinyconfig:
> $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
> @@ -138,6 +142,7 @@ help:
> @echo ' default value without prompting'
> @echo ' kvmconfig - Enable additional options for kvm guest kernel support'
> @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
> + @echo ' hvconfig - Enable additional options for Hyper-V guest kernel support'
> @echo ' tinyconfig - Configure the tiniest possible kernel'
> @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
>
> --
> 2.20.1
>


--
Best Regards
Masahiro Yamada

2019-10-08 16:10:47

by Wei Liu

[permalink] [raw]
Subject: Re: [PATCH RFC] kconfig: add hvconfig for Linux on Hyper-V

On Wed, Oct 09, 2019 at 01:03:19AM +0900, Masahiro Yamada wrote:
[...]
> > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> > index ef2f2336c469..2ee46301b22e 100644
> > --- a/scripts/kconfig/Makefile
> > +++ b/scripts/kconfig/Makefile
> > @@ -104,6 +104,10 @@ PHONY += xenconfig
> > xenconfig: xen.config
> > @:
> >
> > +PHONY += hvconfig
> > +hvconfig: hv_guest.config
> > + @:
> > +
>
>
> Does this need to be hooked up to kconfig Makefile?
>

It is not strictly necessary. Just thought it would be nice to follow
existing examples.

> In my understanding, this code provides
> "make hvconfig" as a shorthand for "make hv_guest.config"
>

Yes that's correct.

> Please do not do this.
>
>
> See "xenconfig" as a bad example.
>
> "make xenconfig" is a shorthand of "make xen.config".
> This exists to save just one character typing.
>
>
> If I allow this, people would push more and more random pointless shorthands,
> which are essentially unrelated to kconfig.
>
>
> kvmconfig and xenconfig are just historical mistakes.
>
>
> Please drop the changes to scripts/kconfig/Makefile.

OK.

>
> Also, please do not use misleading "kconfig:" for the subject prefix.
> You can use the subject prefix "hyper-v:" or something.
>

OK.

Wei.