[PATCH v2 0/3] arch/x86: Remove unnecessary dependencies on bootparam.h

Thomas Zimmermann tzimmermann at suse.de
Fri Dec 15 12:18:11 UTC 2023


Reduce built time in some cases by removing unnecessary include statements
for <asm/bootparam.h>. Reorganize some header files accordingly.

While working on the kernel's boot-up graphics, I noticed that touching
include/linux/screen_info.h triggers a complete rebuild of the kernel
on x86. It turns out that the architecture's PCI and EFI headers include
<asm/bootparam.h>, which depends on <linux/screen_info.h>. But none of
the drivers have any business with boot parameters or the screen_info
state.

The patchset moves code from bootparam.h and efi.h into separate header
files and removes obsolete include statements on x86. I did

  make allmodconfig
  make -j28
  touch include/linus/screen_info.h
  time make -j28

to measure the time it takes to rebuild. Results without the patchset
are around 20 minutes.

  real    20m46,705s
  user    354m29,166s
  sys     28m27,359s

And with the patchset applied it goes down to less than one minute.

  real    0m56,643s
  user    4m0,661s
  sys     0m32,956s

The test system is an Intel i5-13500.

v2:
	* only keep struct boot_params in bootparam.h (Ard)
	* simplify arch_ima_efi_boot_mode define (Ard)
	* updated cover letter

Thomas Zimmermann (3):
  arch/x86: Move UAPI setup structures into setup_data.h
  arch/x86: Add <asm/ima-efi.h> for arch_ima_efi_boot_mode
  arch/x86: Do not include <asm/bootparam.h> in several header files

 arch/x86/boot/compressed/acpi.c        |   2 +
 arch/x86/boot/compressed/cmdline.c     |   2 +
 arch/x86/boot/compressed/efi.c         |   2 +
 arch/x86/boot/compressed/misc.h        |   3 +-
 arch/x86/boot/compressed/pgtable_64.c  |   1 +
 arch/x86/boot/compressed/sev.c         |   1 +
 arch/x86/include/asm/e820/types.h      |   2 +-
 arch/x86/include/asm/efi.h             |   3 -
 arch/x86/include/asm/ima-efi.h         |  11 ++
 arch/x86/include/asm/kexec.h           |   1 -
 arch/x86/include/asm/mem_encrypt.h     |   2 +-
 arch/x86/include/asm/pci.h             |   2 +-
 arch/x86/include/asm/sev.h             |   3 +-
 arch/x86/include/asm/x86_init.h        |   2 -
 arch/x86/include/uapi/asm/bootparam.h  | 218 +----------------------
 arch/x86/include/uapi/asm/setup_data.h | 229 +++++++++++++++++++++++++
 arch/x86/kernel/crash.c                |   1 +
 arch/x86/kernel/sev-shared.c           |   2 +
 arch/x86/platform/pvh/enlighten.c      |   1 +
 arch/x86/xen/enlighten_pvh.c           |   1 +
 arch/x86/xen/vga.c                     |   1 -
 include/asm-generic/Kbuild             |   1 +
 include/asm-generic/ima-efi.h          |  16 ++
 security/integrity/ima/ima_efi.c       |   5 +-
 24 files changed, 279 insertions(+), 233 deletions(-)
 create mode 100644 arch/x86/include/asm/ima-efi.h
 create mode 100644 arch/x86/include/uapi/asm/setup_data.h
 create mode 100644 include/asm-generic/ima-efi.h


base-commit: 961ef418705ac5808345e883acd91f8ce167e00b
prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36
prerequisite-patch-id: e7a5405fb48608e0c8e3b41bf983fefa2c8bd1f3
-- 
2.43.0




More information about the Linux-security-module-archive mailing list