diff mbox series

[3/3] arm64: configs: Add virtconfig

Message ID 20230203-arm64-defconfigs-v1-3-cd0694a05f13@kernel.org (mailing list archive)
State New, archived
Headers show
Series arm64: configs: Provide slimmed down configuration for guests | expand

Commit Message

Mark Brown Feb. 10, 2023, 7:52 p.m. UTC
Provide a slimline configuration intended to be booted on virtual
machines, with the goal of providing a light configuration which will
boot on and enable features available in mach-virt.  This is defined in
terms of the standard defconfig, with an additional virt.config fragment
which disables options unneeded in a virtual configuration.

As a first step we just disable all the ARCH_ configuration options,
disabling the build of all the SoC specific drivers.  This results in a
kernel that builds about 25% faster in my testing, if this approach
works for people we can add further options.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/Makefile            |  6 ++++++
 arch/arm64/configs/virt.config | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

Comments

Masahiro Yamada Feb. 11, 2023, 7:37 a.m. UTC | #1
On Sat, Feb 11, 2023 at 4:54 AM Mark Brown <broonie@kernel.org> wrote:
>
> Provide a slimline configuration intended to be booted on virtual
> machines, with the goal of providing a light configuration which will
> boot on and enable features available in mach-virt.  This is defined in
> terms of the standard defconfig, with an additional virt.config fragment
> which disables options unneeded in a virtual configuration.
>
> As a first step we just disable all the ARCH_ configuration options,
> disabling the build of all the SoC specific drivers.  This results in a
> kernel that builds about 25% faster in my testing, if this approach
> works for people we can add further options.
>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  arch/arm64/Makefile            |  6 ++++++
>  arch/arm64/configs/virt.config | 39 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
>
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index c33b5da95b4a..2d49aea0ff67 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -205,6 +205,12 @@ ifdef CONFIG_COMPAT_VDSO
>  endif
>  endif
>
> +include $(srctree)/scripts/Makefile.defconf
> +
> +PHONY += virtconfig
> +virtconfig:
> +       $(call merge_into_defconfig_override,defconfig,virt)
> +
>  define archhelp
>    echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
>    echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
> diff --git a/arch/arm64/configs/virt.config b/arch/arm64/configs/virt.config
> new file mode 100644
> index 000000000000..6ef0a739717f
> --- /dev/null
> +++ b/arch/arm64/configs/virt.config
> @@ -0,0 +1,39 @@
> +# CONFIG_ARCH_ACTIONS is not set
> +# CONFIG_ARCH_SUNXI is not set
> +# CONFIG_ARCH_ALPINE is not set
> +# CONFIG_ARCH_APPLE is not set
> +# CONFIG_ARCH_BCM is not set
> +# CONFIG_ARCH_BCM2835 is not set
> +# CONFIG_ARCH_BCMBCA is not set
> +# CONFIG_ARCH_BCM_IPROC is not set
> +# CONFIG_ARCH_BERLIN is not set
> +# CONFIG_ARCH_BRCMSTB is not set
> +# CONFIG_ARCH_EXYNOS is not set
> +# CONFIG_ARCH_K3 is not set
> +# CONFIG_ARCH_LAYERSCAPE is not set
> +# CONFIG_ARCH_LG1K is not set
> +# CONFIG_ARCH_HISI is not set
> +# CONFIG_ARCH_KEEMBAY is not set
> +# CONFIG_ARCH_MEDIATEK is not set
> +# CONFIG_ARCH_MESON is not set
> +# CONFIG_ARCH_MVEBU is not set
> +# CONFIG_ARCH_NXP is not set
> +# CONFIG_ARCH_MXC is not set
> +# CONFIG_ARCH_NPCM is not set
> +# CONFIG_ARCH_QCOM is not set
> +# CONFIG_ARCH_RENESAS is not set
> +# CONFIG_ARCH_ROCKCHIP is not set
> +# CONFIG_ARCH_S32 is not set
> +# CONFIG_ARCH_SEATTLE is not set
> +# CONFIG_ARCH_INTEL_SOCFPGA is not set
> +# CONFIG_ARCH_SYNQUACER is not set
> +# CONFIG_ARCH_TEGRA is not set
> +# CONFIG_ARCH_TESLA_FSD is not set
> +# CONFIG_ARCH_SPRD is not set
> +# CONFIG_ARCH_THUNDER is not set
> +# CONFIG_ARCH_THUNDER2 is not set
> +# CONFIG_ARCH_UNIPHIER is not set
> +# CONFIG_ARCH_VEXPRESS is not set
> +# CONFIG_ARCH_VISCONTI is not set
> +# CONFIG_ARCH_XGENE is not set
> +# CONFIG_ARCH_ZYNQMP is not set
>
> --
> 2.30.2
>



Yeah, I have a _local_ script to apply
a similar config fragragment.

When I run QEMU, I disable unneeded CONFIG_ARCH_*,
and also disable unneeded sub-systems.

Not only me, many people are doing similar in their local env,
I guess.


Of course, I will not upstream my set of CONFIG options
since it is just my preference.
After all, this depends on people in my opinion.


BTW, the minimal set for booting + minimal features
might be similar to what Buildroot provides?
I do not know... It booted at least when I tried some years ago.

https://github.com/buildroot/buildroot/blob/master/board/qemu/aarch64-virt/linux.config






--
Best Regards
Masahiro Yamada
Mark Brown Feb. 11, 2023, 11:10 p.m. UTC | #2
On Sat, Feb 11, 2023 at 04:37:02PM +0900, Masahiro Yamada wrote:

> Yeah, I have a _local_ script to apply
> a similar config fragragment.

> When I run QEMU, I disable unneeded CONFIG_ARCH_*,
> and also disable unneeded sub-systems.

> Not only me, many people are doing similar in their local env,
> I guess.

Me too - I've got a config I actually use when doing development
that's slimmed down a lot (it's a bit bigger due to me using the
Arm FVPs for some things).  I suspect you're right that many
people who do this stuff regularly have one, it's mostly when
someone is doing cross architecture work rather than specifically
targetting arm64 that it'd make an immediate difference though
it's possible some of us will decide we can stop bothering
maintianing our own configs.

> Of course, I will not upstream my set of CONFIG options
> since it is just my preference.
> After all, this depends on people in my opinion.

There's definitely room for opinion with this, for example with
some of the virtio devices which are less frequently used in
development.

> BTW, the minimal set for booting + minimal features
> might be similar to what Buildroot provides?
> I do not know... It booted at least when I tried some years ago.

> https://github.com/buildroot/buildroot/blob/master/board/qemu/aarch64-virt/linux.config

It does look pluasible - it looks like it might be slightly
bigger than just mach-virt since it's got ARCH_VEXPRESS and thing
slike the SMMU and PL320 turned on which I suspect means it's
intended to support the Arm models too.  There might be some
other stuff needed for common test programs or systemd though.
Arnd Bergmann Feb. 13, 2023, 3:15 p.m. UTC | #3
On Sat, Feb 11, 2023, at 08:37, Masahiro Yamada wrote:
> On Sat, Feb 11, 2023 at 4:54 AM Mark Brown <broonie@kernel.org> wrote:
>>
>> Provide a slimline configuration intended to be booted on virtual
>> machines, with the goal of providing a light configuration which will
>> boot on and enable features available in mach-virt.  This is defined in
>> terms of the standard defconfig, with an additional virt.config fragment
>> which disables options unneeded in a virtual configuration.
>>
>> As a first step we just disable all the ARCH_ configuration options,
>> disabling the build of all the SoC specific drivers.  This results in a
>> kernel that builds about 25% faster in my testing, if this approach
>> works for people we can add further options.
>>
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> ---
>>  arch/arm64/Makefile            |  6 ++++++
>>  arch/arm64/configs/virt.config | 39 +++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 45 insertions(+)

I like this a lot, I think that is very helpful and we can always build on
top of it later with other fragments.

We could still combine this with another Kconfig option that
just hides all the real SoC options, which would turn this fragment
into a one-line file and avoid having to update it whenever platforms
get added.

> Yeah, I have a _local_ script to apply
> a similar config fragragment.
>
> When I run QEMU, I disable unneeded CONFIG_ARCH_*,
> and also disable unneeded sub-systems.
>
> Not only me, many people are doing similar in their local env,
> I guess.
>
>
> Of course, I will not upstream my set of CONFIG options
> since it is just my preference.
> After all, this depends on people in my opinion.

Do you have an opinion on the other two patches? If those
look good to you, maybe I can just merge all three through the
soc/defconfig branch for 6.3.

      Arnd
Mark Brown Feb. 13, 2023, 3:48 p.m. UTC | #4
On Mon, Feb 13, 2023 at 04:15:52PM +0100, Arnd Bergmann wrote:

> We could still combine this with another Kconfig option that
> just hides all the real SoC options, which would turn this fragment
> into a one-line file and avoid having to update it whenever platforms
> get added.

I think if people are OK with this approach we'll want to extend
it so that it's cutting out more than just the platforms -
there's quite a lot of drivers and subsystems that aren't
platform specific but are clearly not something we'd want as
default for running in a virtual environment, enough to make a
difference to build times.  That doesn't mean that a "disable all
the platform support" Kconfig isn't useful, just that I don't
think we'd want this to be a one liner long term.
Masahiro Yamada Feb. 13, 2023, 4:18 p.m. UTC | #5
On Tue, Feb 14, 2023 at 12:16 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Sat, Feb 11, 2023, at 08:37, Masahiro Yamada wrote:
> > On Sat, Feb 11, 2023 at 4:54 AM Mark Brown <broonie@kernel.org> wrote:
> >>
> >> Provide a slimline configuration intended to be booted on virtual
> >> machines, with the goal of providing a light configuration which will
> >> boot on and enable features available in mach-virt.  This is defined in
> >> terms of the standard defconfig, with an additional virt.config fragment
> >> which disables options unneeded in a virtual configuration.
> >>
> >> As a first step we just disable all the ARCH_ configuration options,
> >> disabling the build of all the SoC specific drivers.  This results in a
> >> kernel that builds about 25% faster in my testing, if this approach
> >> works for people we can add further options.
> >>
> >> Signed-off-by: Mark Brown <broonie@kernel.org>
> >> ---
> >>  arch/arm64/Makefile            |  6 ++++++
> >>  arch/arm64/configs/virt.config | 39 +++++++++++++++++++++++++++++++++++++++
> >>  2 files changed, 45 insertions(+)
>
> I like this a lot, I think that is very helpful and we can always build on
> top of it later with other fragments.
>
> We could still combine this with another Kconfig option that
> just hides all the real SoC options, which would turn this fragment
> into a one-line file and avoid having to update it whenever platforms
> get added.
>
> > Yeah, I have a _local_ script to apply
> > a similar config fragragment.
> >
> > When I run QEMU, I disable unneeded CONFIG_ARCH_*,
> > and also disable unneeded sub-systems.
> >
> > Not only me, many people are doing similar in their local env,
> > I guess.
> >
> >
> > Of course, I will not upstream my set of CONFIG options
> > since it is just my preference.
> > After all, this depends on people in my opinion.
>
> Do you have an opinion on the other two patches? If those
> look good to you, maybe I can just merge all three through the
> soc/defconfig branch for 6.3.
>
>       Arnd


scripts/Makefile.defconf is not what I'd maintain.
Please do whatever you want to do.
diff mbox series

Patch

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index c33b5da95b4a..2d49aea0ff67 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -205,6 +205,12 @@  ifdef CONFIG_COMPAT_VDSO
 endif
 endif
 
+include $(srctree)/scripts/Makefile.defconf
+
+PHONY += virtconfig
+virtconfig:
+	$(call merge_into_defconfig_override,defconfig,virt)
+
 define archhelp
   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
diff --git a/arch/arm64/configs/virt.config b/arch/arm64/configs/virt.config
new file mode 100644
index 000000000000..6ef0a739717f
--- /dev/null
+++ b/arch/arm64/configs/virt.config
@@ -0,0 +1,39 @@ 
+# CONFIG_ARCH_ACTIONS is not set
+# CONFIG_ARCH_SUNXI is not set
+# CONFIG_ARCH_ALPINE is not set
+# CONFIG_ARCH_APPLE is not set
+# CONFIG_ARCH_BCM is not set
+# CONFIG_ARCH_BCM2835 is not set
+# CONFIG_ARCH_BCMBCA is not set
+# CONFIG_ARCH_BCM_IPROC is not set
+# CONFIG_ARCH_BERLIN is not set
+# CONFIG_ARCH_BRCMSTB is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_K3 is not set
+# CONFIG_ARCH_LAYERSCAPE is not set
+# CONFIG_ARCH_LG1K is not set
+# CONFIG_ARCH_HISI is not set
+# CONFIG_ARCH_KEEMBAY is not set
+# CONFIG_ARCH_MEDIATEK is not set
+# CONFIG_ARCH_MESON is not set
+# CONFIG_ARCH_MVEBU is not set
+# CONFIG_ARCH_NXP is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_NPCM is not set
+# CONFIG_ARCH_QCOM is not set
+# CONFIG_ARCH_RENESAS is not set
+# CONFIG_ARCH_ROCKCHIP is not set
+# CONFIG_ARCH_S32 is not set
+# CONFIG_ARCH_SEATTLE is not set
+# CONFIG_ARCH_INTEL_SOCFPGA is not set
+# CONFIG_ARCH_SYNQUACER is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_TESLA_FSD is not set
+# CONFIG_ARCH_SPRD is not set
+# CONFIG_ARCH_THUNDER is not set
+# CONFIG_ARCH_THUNDER2 is not set
+# CONFIG_ARCH_UNIPHIER is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_VISCONTI is not set
+# CONFIG_ARCH_XGENE is not set
+# CONFIG_ARCH_ZYNQMP is not set