TuxML / tuxml

The main repository of the TuxML project contains the scripts for building Linux kernel configurations in the large.
Apache License 2.0
4 stars 2 forks source link

preset not working for Linux kernel 5.15? #57

Closed acherm closed 2 years ago

acherm commented 2 years ago

I have observed a possible non-regression for Linux kernel 5.15: tinyconfig is 1.42 Mb (gcc6, gcc8, gcc10, clang11) instead of ~11 Mb for older versions (5.10 at least).

eg http://tuxml-data.irisa.fr/data/configuration/194597/ vs http://tuxml-data.irisa.fr/data/configuration/194596/

An inquiry shows that the preset of X86_64 for make tinyconfig has no effect: X86_32 is actually chosen!

/TuxML/linux-5.15# KCONFIG_ALLCONFIG=/TuxML/compilation/x64.config make CC=gcc tinyconfig -j8
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
Using .config as base
Merging ./kernel/configs/tiny.config
Value of CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
New value: # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set

Value of CONFIG_CC_OPTIMIZE_FOR_SIZE is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
New value: CONFIG_CC_OPTIMIZE_FOR_SIZE=y

Value of CONFIG_KERNEL_GZIP is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_KERNEL_GZIP=y
New value: # CONFIG_KERNEL_GZIP is not set

Value of CONFIG_KERNEL_XZ is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_KERNEL_XZ is not set
New value: CONFIG_KERNEL_XZ=y

Value of CONFIG_SLUB is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_SLUB=y
New value: # CONFIG_SLUB is not set

Value of CONFIG_SLOB is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_SLOB is not set
New value: CONFIG_SLOB=y

Merging ./arch/x86/configs/tiny.config
Value of CONFIG_NOHIGHMEM is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: # CONFIG_NOHIGHMEM is not set
New value: CONFIG_NOHIGHMEM=y

Value of CONFIG_HIGHMEM4G is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: CONFIG_HIGHMEM4G=y
New value: # CONFIG_HIGHMEM4G is not set

Value of CONFIG_UNWINDER_GUESS is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: # CONFIG_UNWINDER_GUESS is not set
New value: CONFIG_UNWINDER_GUESS=y

Value of CONFIG_UNWINDER_FRAME_POINTER is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: CONFIG_UNWINDER_FRAME_POINTER=y
New value: # CONFIG_UNWINDER_FRAME_POINTER is not set

#
# merged configuration written to .config (needs make)
#
#
# configuration written to .config

/TuxML/linux-5.15# cat /TuxML/compilation/x64.config                           
CONFIG_64BIT=y

/TuxML/linux-5.15# cat .config | grep X86
CONFIG_X86_32=y
CONFIG_X86=y

/TuxML/linux-5.15# cat .config | grep 64BIT
# CONFIG_64BIT is not set
acherm commented 2 years ago

Not sure whether it's related: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15

commit 2c861f2b859385e9eaa6e464a8a7435b5a6bf564
Author: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Date:   Tue Aug 3 13:35:23 2021 +0200

    x86/entry: Correct reference to intended CONFIG_64_BIT

    Commit in Fixes adds a condition with IS_ENABLED(CONFIG_64_BIT),
    but the intended config item is called CONFIG_64BIT, as defined in
    arch/x86/Kconfig.

    Fortunately, scripts/checkkconfigsymbols.py warns:

    64_BIT
    Referencing files: arch/x86/include/asm/entry-common.h

    Correct the reference to the intended config symbol.

    Fixes: 662a0221893a ("x86/entry: Fix AC assertion")
    Suggested-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lkml.kernel.org/r/20210803113531.30720-2-lukas.bulwahn@gmail.com
acherm commented 2 years ago

No success with this attempt:

/TuxML/linux-5.15# cat preset 
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86_32=n
acherm commented 2 years ago

KCONFIG_ALLCONFIG=/TuxML/linux-5.15/preset make **ARCH=x86_64** CC=gcc tinyconfig -j8

seems to fix the issue related to #42

acherm commented 2 years ago

requires further experiments, but overall looks good

acherm commented 2 years ago

KCONFIG_ALLCONFIG cannot be used with tiny now, @garandria found it ;) https://lore.kernel.org/lkml/20210313194836.372585-11-masahiroy@kernel.org/

garandria commented 2 years ago

I added some lines in the Makefile, for tinyconfig to check if KCONFIG_ALLCONFIG is defined by the user and merge it with the base configuration in kernel/configs/tiny-base.config for allnoconfig invocation.

Linux version: 5.15

$ cat preset 
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86_32=n
$ KCONFIG_ALLCONFIG=preset make tinyconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
Using .config as base
Merging ./kernel/configs/tiny.config
Value of CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
New value: # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set

Value of CONFIG_CC_OPTIMIZE_FOR_SIZE is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
New value: CONFIG_CC_OPTIMIZE_FOR_SIZE=y

Value of CONFIG_KERNEL_GZIP is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_KERNEL_GZIP=y
New value: # CONFIG_KERNEL_GZIP is not set

Value of CONFIG_KERNEL_XZ is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_KERNEL_XZ is not set
New value: CONFIG_KERNEL_XZ=y

Value of CONFIG_SLUB is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_SLUB=y
New value: # CONFIG_SLUB is not set

Value of CONFIG_SLOB is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_SLOB is not set
New value: CONFIG_SLOB=y

Merging ./arch/x86/configs/tiny.config
Value of CONFIG_NOHIGHMEM is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: # CONFIG_NOHIGHMEM is not set
New value: CONFIG_NOHIGHMEM=y

Value of CONFIG_HIGHMEM4G is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: CONFIG_HIGHMEM4G=y
New value: # CONFIG_HIGHMEM4G is not set

Value of CONFIG_UNWINDER_GUESS is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: # CONFIG_UNWINDER_GUESS is not set
New value: CONFIG_UNWINDER_GUESS=y

Value of CONFIG_UNWINDER_FRAME_POINTER is redefined by fragment ./arch/x86/configs/tiny.config:
Previous value: CONFIG_UNWINDER_FRAME_POINTER=y
New value: # CONFIG_UNWINDER_FRAME_POINTER is not set

#
# merged configuration written to .config (needs make)
#
#
# configuration written to .config
#
$ grep 64BIT .config
# CONFIG_64BIT is not set
$ make mrproper
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   include/config include/generated .config .config.old
$ git apply 0001-kconfig-consider-user-s-KCONFIG_ALLCONFIG-when-defin.patch
$ KCONFIG_ALLCONFIG=preset make tinyconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
Using .config as base
Merging ./kernel/configs/tiny.config
Value of CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
New value: # CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set

Value of CONFIG_CC_OPTIMIZE_FOR_SIZE is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
New value: CONFIG_CC_OPTIMIZE_FOR_SIZE=y

Value of CONFIG_KERNEL_GZIP is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_KERNEL_GZIP=y
New value: # CONFIG_KERNEL_GZIP is not set

Value of CONFIG_KERNEL_XZ is redefined by fragment ./kernel/configs/tiny.config:
Previous value: # CONFIG_KERNEL_XZ is not set
New value: CONFIG_KERNEL_XZ=y

Value of CONFIG_SLUB is redefined by fragment ./kernel/configs/tiny.config:
Previous value: CONFIG_SLUB=y
New value: # CONFIG_SLUB is not set

Merging ./arch/x86/configs/tiny.config
#
# merged configuration written to .config (needs make)
#
.config:1343:warning: override: UNWINDER_GUESS changes choice state
#
# configuration written to .config
#
$ grep 64BIT .config
CONFIG_64BIT=y
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y

 scripts/kconfig/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 5a215880b..36f7ce9f6 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -102,7 +102,14 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c

 PHONY += tinyconfig
 tinyconfig:
+ifeq ($(KCONFIG_ALLCONFIG),)
    $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+else
+   $(Q)cat $(KCONFIG_ALLCONFIG) > tmp-base.config
+   $(Q)cat kernel/configs/tiny-base.config >> tmp-base.config
+   $(Q)KCONFIG_ALLCONFIG=tmp-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+   $(Q)rm tmp-base.config
+endif
    $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config

 # CHECK: -o cache_dir=<path> working?
-- 
2.34.1