Skip to content

Commit

Permalink
patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ptr1337 committed Jun 23, 2022
1 parent e2a7d9e commit 26d5412
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 276 deletions.
149 changes: 7 additions & 142 deletions 5.18/dev/0001-cachy.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
From f4260d4e1707c0d9f769886c9f3fe87beb4e728f Mon Sep 17 00:00:00 2001
From e973f3ee99d7de02230926c6ecaa8064cc974780 Mon Sep 17 00:00:00 2001
From: Peter Jung <[email protected]>
Date: Thu, 23 Jun 2022 14:13:04 +0200
Date: Thu, 23 Jun 2022 16:54:58 +0200
Subject: [PATCH] cachy

Signed-off-by: Peter Jung <[email protected]>
---
.../admin-guide/kernel-parameters.txt | 19 +
.../admin-guide/kernel-parameters.txt | 13 +
Documentation/admin-guide/pm/cpuidle.rst | 15 +-
Makefile | 7 +-
arch/Kconfig | 10 +
Makefile | 2 +
arch/alpha/kernel/syscalls/syscall.tbl | 1 +
arch/arm/tools/syscall.tbl | 1 +
arch/arm64/include/asm/unistd.h | 2 +-
Expand Down Expand Up @@ -76,7 +75,6 @@ Signed-off-by: Peter Jung <[email protected]>
kernel/fork.c | 14 +
kernel/locking/rwsem.c | 4 +-
kernel/module.c | 20 ++
kernel/rcu/Kconfig | 26 ++
kernel/sched/core.c | 5 +-
kernel/sched/debug.c | 1 +
kernel/sched/fair.c | 98 +++++-
Expand All @@ -98,12 +96,10 @@ Signed-off-by: Peter Jung <[email protected]>
mm/vmscan.c | 24 +-
net/ipv4/inet_connection_sock.c | 2 +-
net/ipv4/tcp.c | 4 +-
scripts/Makefile.lib | 4 +
scripts/Makefile.modfinal | 8 +
95 files changed, 1295 insertions(+), 183 deletions(-)
91 files changed, 1238 insertions(+), 181 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index c4893782055b..86e2de9bd859 100644
index c4893782055b..b23ba248cce9 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1615,6 +1615,19 @@
Expand All @@ -126,26 +122,6 @@ index c4893782055b..86e2de9bd859 100644
hlt [BUGS=ARM,SH]

hpet= [X86-32,HPET] option to control HPET usage
@@ -3608,6 +3621,9 @@
just as if they had also been called out in the
rcu_nocbs= boot parameter.

+ Note that this argument takes precedence over
+ the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option.
+
noiotrap [SH] Disables trapped I/O port accesses.

noirqdebug [X86-32] Disables the code which attempts to detect and
@@ -4511,6 +4527,9 @@
no-callback mode from boot but the mode may be
toggled at runtime via cpusets.

+ Note that this argument takes precedence over
+ the CONFIG_RCU_NOCB_CPU_DEFAULT_ALL option.
+
rcu_nocb_poll [KNL]
Rather than requiring that offloaded CPUs
(specified by rcu_nocbs= above) explicitly
diff --git a/Documentation/admin-guide/pm/cpuidle.rst b/Documentation/admin-guide/pm/cpuidle.rst
index aec2cd2aaea7..19754beb5a4e 100644
--- a/Documentation/admin-guide/pm/cpuidle.rst
Expand Down Expand Up @@ -180,7 +156,7 @@ index aec2cd2aaea7..19754beb5a4e 100644
In addition to the architecture-level kernel command line options affecting CPU
idle time management, there are parameters affecting individual ``CPUIdle``
diff --git a/Makefile b/Makefile
index 27850d452d65..ebf0487b8cc5 100644
index 27850d452d65..6112b4d30618 100644
--- a/Makefile
+++ b/Makefile
@@ -758,6 +758,8 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
Expand All @@ -192,46 +168,6 @@ index 27850d452d65..ebf0487b8cc5 100644
endif

# Tell gcc to never replace conditional load with a non-conditional one
@@ -894,7 +896,8 @@ endif
ifdef CONFIG_LTO_CLANG
ifdef CONFIG_LTO_CLANG_THIN
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
-KBUILD_LDFLAGS += --thinlto-cache-dir=$(extmod_prefix).thinlto-cache
+export thinlto-dir = $(if $(CONFIG_LTO_CLANG_THIN_CACHEDIR),$(CONFIG_LTO_CLANG_THIN_CACHEDIR)/)
+KBUILD_LDFLAGS += --thinlto-cache-dir=$(thinlto-dir)$(extmod_prefix).thinlto-cache
else
CC_FLAGS_LTO := -flto
endif
@@ -1715,7 +1718,7 @@ PHONY += compile_commands.json

clean-dirs := $(KBUILD_EXTMOD)
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps \
- $(KBUILD_EXTMOD)/compile_commands.json $(KBUILD_EXTMOD)/.thinlto-cache
+ $(KBUILD_EXTMOD)/compile_commands.json $(thinlto-dir)$(KBUILD_EXTMOD)/.thinlto-cache

PHONY += prepare
# now expand this into a simple variable to reduce the cost of shell evaluations
diff --git a/arch/Kconfig b/arch/Kconfig
index 31c4fdc4a4ba..61b0859be567 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -712,6 +712,16 @@ config LTO_CLANG_THIN
https://clang.llvm.org/docs/ThinLTO.html

If unsure, say Y.
+
+config LTO_CLANG_THIN_CACHEDIR
+ string "Clang ThinLTO cache directory"
+ depends on LTO_CLANG_THIN
+ default "/tmp"
+ help
+ This option allows users to choose a directory that stores
+ Clang's ThinLTO cache.
+ Leave empty for default.
+
endchoice

config ARCH_SUPPORTS_CFI_CLANG
diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index 3515bc4f16a4..00ff721da300 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
Expand Down Expand Up @@ -2334,43 +2270,6 @@ index 6529c84c536f..7201b19b7eb5 100644
return 0;
}
module_init(proc_modules_init);
diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig
index f559870fbf8b..2f374089c0e7 100644
--- a/kernel/rcu/Kconfig
+++ b/kernel/rcu/Kconfig
@@ -224,6 +224,32 @@ config RCU_NOCB_CPU
Say Y here if you need reduced OS jitter, despite added overhead.
Say N here if you are unsure.

+config RCU_NOCB_CPU_DEFAULT_ALL
+ bool "Offload RCU callback processing from all CPUs by default"
+ depends on RCU_NOCB_CPU
+ default n
+ help
+ Use this option to offload callback processing from all CPUs
+ by default, in the absence of the rcu_nocbs or nohz_full boot
+ parameter. This also avoids the need to use any boot parameters
+ to achieve the effect of offloading all CPUs on boot.
+
+ Say Y here if you want offload all CPUs by default on boot.
+ Say N here if you are unsure.
+
+config RCU_NOCB_CPU_DEFAULT_ALL
+ bool "Offload RCU callback processing from all CPUs by default"
+ depends on RCU_NOCB_CPU
+ default n
+ help
+ Use this option to offload callback processing from all CPUs
+ by default, in the absence of the rcu_nocbs or nohz_full boot
+ parameter. This also avoids the need to use any boot parameters
+ to achieve the effect of offloading all CPUs on boot.
+
+ Say Y here if you want offload all CPUs by default on boot.
+ Say N here if you are unsure.
+
config TASKS_TRACE_RCU_READ_MB
bool "Tasks Trace RCU readers use memory barriers in user and idle"
depends on RCU_EXPERT
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index dd11daa7a84b..78ecb72df9d4 100644
--- a/kernel/sched/core.c
Expand Down Expand Up @@ -3326,40 +3225,6 @@ index e31cf137c614..724eb145f09c 100644

init_net.ipv4.sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
init_net.ipv4.sysctl_tcp_wmem[1] = 16*1024;
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 9f69ecdd7977..4eaeb2867b03 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -197,6 +197,10 @@ endif
part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
quiet_modtag = $(if $(part-of-module),[M], )

+ifdef CONFIG_LTO_CLANG_THIN
+KBUILD_LDFLAGS += --thinlto-cache-dir=$(thinlto-dir)$(extmod-prefix).thinlto-cache
+endif
+
modkern_cflags = \
$(if $(part-of-module), \
$(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index 7f39599e9fae..f74be61b0e71 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -55,6 +55,14 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)


+ifdef CONFIG_LTO_CLANG_THIN
+KBUILD_LDFLAGS += --thinlto-cache-dir=$(thinlto-dir)$(extmod-prefix).thinlto-cache
+endif # CONFIG_LTO_CLANG_THIN
+
+ifdef CONFIG_LTO_CLANG_THIN
+KBUILD_LDFLAGS += --thinlto-cache-dir=$(thinlto-dir)$(extmod-prefix).thinlto-cache
+endif # CONFIG_LTO_CLANG_THIN
+
# Re-generate module BTFs if either module's .ko or vmlinux changed
$(modules): %.ko: %$(mod-prelink-ext).o %.mod.o scripts/module.lds $(if $(KBUILD_BUILTIN),vmlinux) FORCE
+$(call if_changed_except,ld_ko_o,vmlinux)
--
2.37.0.rc1

36 changes: 19 additions & 17 deletions 5.18/dev/0001-kbuild.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From eb7c6a4c99f9532ae494e5425935fea2361bfa97 Mon Sep 17 00:00:00 2001
From f22517b54615c79df7a6fd224727bb3375907f52 Mon Sep 17 00:00:00 2001
From: Peter Jung <[email protected]>
Date: Thu, 23 Jun 2022 12:02:19 +0200
Date: Thu, 23 Jun 2022 17:00:27 +0200
Subject: [PATCH] kbuild

Signed-off-by: Peter Jung <[email protected]>
Expand Down Expand Up @@ -48,7 +48,7 @@ Signed-off-by: Peter Jung <[email protected]>
scripts/Makefile.clean | 8 +-
scripts/Makefile.extrawarn | 13 +-
scripts/Makefile.lib | 13 +-
scripts/Makefile.modfinal | 4 +-
scripts/Makefile.modfinal | 5 +-
scripts/Makefile.modpost | 9 +-
scripts/adjust_autoksyms.sh | 2 +-
scripts/check-local-export | 64 +
Expand All @@ -71,7 +71,7 @@ Signed-off-by: Peter Jung <[email protected]>
scripts/prune-kernel | 6 +-
tools/objtool/Makefile | 4 +-
usr/include/Makefile | 2 +-
66 files changed, 2165 insertions(+), 2128 deletions(-)
66 files changed, 2165 insertions(+), 2129 deletions(-)
mode change 100644 => 100755 arch/arm/boot/install.sh
mode change 100644 => 100755 arch/arm64/boot/install.sh
mode change 100644 => 100755 arch/ia64/install.sh
Expand Down Expand Up @@ -120,7 +120,7 @@ index 93a5b6e1fabd..a7173843a294 100644
+.. [10] https://paulgazzillo.com/papers/esecfse21.pdf
+.. [11] https://github.com/paulgazz/kmax
diff --git a/Makefile b/Makefile
index 1258436ce5c6..38c45a3de3aa 100644
index 6112b4d30618..871e37a71498 100644
--- a/Makefile
+++ b/Makefile
@@ -436,6 +436,7 @@ else
Expand All @@ -140,7 +140,7 @@ index 1258436ce5c6..38c45a3de3aa 100644
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
@@ -1301,11 +1302,12 @@ scripts_unifdef: scripts_basic
@@ -1299,11 +1300,12 @@ scripts_unifdef: scripts_basic
# Install

# Many distributions have the custom install script, /sbin/installkernel.
Expand All @@ -156,15 +156,15 @@ index 1258436ce5c6..38c45a3de3aa 100644

# ---------------------------------------------------------------------------
# Tools
@@ -1657,6 +1659,7 @@ help:
@@ -1655,6 +1657,7 @@ help:
@echo ' 1: warnings which may be relevant and do not occur too often'
@echo ' 2: warnings which occur quite often but may still be relevant'
@echo ' 3: more obscure warnings, can most likely be ignored'
+ @echo ' e: warnings are being treated as errors'
@echo ' Multiple levels can be combined with W=12 or W=123'
@echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
@@ -1799,7 +1802,8 @@ ifdef single-build
@@ -1797,7 +1800,8 @@ ifdef single-build

# .ko is special because modpost is needed
single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
Expand All @@ -174,7 +174,7 @@ index 1258436ce5c6..38c45a3de3aa 100644

$(single-ko): single_modpost
@:
@@ -1855,7 +1859,7 @@ clean: $(clean-dirs)
@@ -1853,7 +1857,7 @@ clean: $(clean-dirs)
-o -name '*.ko.*' \
-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
-o -name '*.dwo' -o -name '*.lst' \
Expand Down Expand Up @@ -965,10 +965,10 @@ index 5910ccb66ca2..3f31ced0d977 100644
"__kstrtab_" #sym ": \n" \
" .asciz \"" #sym "\" \n" \
diff --git a/init/Kconfig b/init/Kconfig
index 0944e654b702..bbc963e7d768 100644
index d8fd440af07e..183e9d5f2006 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2175,10 +2175,6 @@ config ASM_MODVERSIONS
@@ -2178,10 +2178,6 @@ config ASM_MODVERSIONS
assembly. This can be enabled only when the target architecture
supports it.

Expand Down Expand Up @@ -1436,10 +1436,10 @@ index 650d0b8ceec3..f5f0d6f09053 100644
+
+endif
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 4eaeb2867b03..07bbb47d8bc0 100644
index 9f69ecdd7977..f75138385449 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -229,20 +229,13 @@ dtc_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \
@@ -225,20 +225,13 @@ dtc_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \
$(addprefix -I,$(DTC_INCLUDE)) \
-undef -D__DTS__

Expand All @@ -1464,7 +1464,7 @@ index 4eaeb2867b03..07bbb47d8bc0 100644

# Copy a file
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index f74be61b0e71..b57077ec4e80 100644
index 7f39599e9fae..35100e981f4a 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -9,7 +9,7 @@ __modfinal:
Expand All @@ -1476,12 +1476,14 @@ index f74be61b0e71..b57077ec4e80 100644
include $(srctree)/scripts/Makefile.lib

# find all modules listed in modules.order
@@ -64,7 +64,7 @@ KBUILD_LDFLAGS += --thinlto-cache-dir=$(thinlto-dir)$(extmod-prefix).thinlto-cac
endif # CONFIG_LTO_CLANG_THIN
@@ -54,9 +54,8 @@ if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \
$(cmd); \
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)

-
# Re-generate module BTFs if either module's .ko or vmlinux changed
-$(modules): %.ko: %$(mod-prelink-ext).o %.mod.o scripts/module.lds $(if $(KBUILD_BUILTIN),vmlinux) FORCE
++$(modules): %.ko: %.o %.mod.o scripts/module.lds $(if $(KBUILD_BUILTIN),vmlinux) FORCE
+$(modules): %.ko: %.o %.mod.o scripts/module.lds $(if $(KBUILD_BUILTIN),vmlinux) FORCE
+$(call if_changed_except,ld_ko_o,vmlinux)
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
+$(if $(newer-prereqs),$(call cmd,btf_ko))
Expand Down
Loading

0 comments on commit 26d5412

Please sign in to comment.