summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorshmilee2020-07-03 19:37:32 +0800
committershmilee2020-07-03 19:37:32 +0800
commit367e5dfbe322a8a9df44c9725046136b4208021c (patch)
treea3e559e669ea82a52bef16922b5c69ad92cfd777
parentbedd525c866095fb5f73505dec803d03fccfe175 (diff)
downloadaur-367e5dfbe322a8a9df44c9725046136b4208021c.tar.gz
update to LTS 5.4.50-2, fix sleep suspend problem
-rw-r--r--.SRCINFO6
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD49
-rw-r--r--broken-sleep-5.4.48+.patch152
4 files changed, 204 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e5032c017c6..ba6aef35c19 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,8 @@
# Generated by makepkg 5.2.1
-# Thu Jul 2 05:35:11 UTC 2020
+# Fri Jul 3 11:28:29 UTC 2020
pkgbase = linux-shmilee
pkgver = 5.4.50
- pkgrel = 1
+ pkgrel = 2
url = https://www.kernel.org/
arch = x86_64
license = GPL2
@@ -24,6 +24,7 @@ pkgbase = linux-shmilee
source = sphinx-workaround.patch
source = uksm-patch-for-5.4.33+.patch
source = linux-cjktty-patch-for-5.4.36+.patch
+ source = broken-sleep-5.4.48+.patch::https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/patch/?id=f7757368e0f0b3e108088ca7b5b8abda6faa7ebc
source = config
source = 60-linux.hook
source = 90-linux.hook
@@ -40,6 +41,7 @@ pkgbase = linux-shmilee
sha256sums = b7c814c8183e4645947a6dcc3cbf80431de8a8fd4e895b780f9a5fd92f82cb8e
sha256sums = 6826624f65276927de012f040e77b02231fe6345b9da7c702deacd9372ea001e
sha256sums = 573f1c40951a6ee4cf6b07a6a8a1123b00fcd8bff29843905cf191e08f1d87f2
+ sha256sums = 9f9ec5becca27bc7b65b372254bcd4c64069deff1d3b7fa15e6e416595163654
sha256sums = 7ce388e429d8df479a721285e445e116c5ee41e3126a702862e59056460b655e
sha256sums = ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21
sha256sums = 75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919
diff --git a/.gitignore b/.gitignore
index de3f9e0dc54..7728dcfc84b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,9 @@ linux-cjktty-?.*.patch
pkg/*
src/*
+debug-*.*.*
linux-shmilee-*.log
linux-shmilee-*.src.tar.gz
linux-shmilee-*.pkg.tar.xz
+linux-shmilee-*.pkg.tar
linux.install.pkg
diff --git a/PKGBUILD b/PKGBUILD
index b7498ab9b26..fd8716a8106 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,6 +10,18 @@
_LLL_VER=5.4
_LLL_SUBVER=50
+# Bisect debug, v5.4.47 -> v5.4.48
+_Bisect_debug=off # on, test, off
+if [ "$_Bisect_debug" == "on" ]; then
+ _burlbase=https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
+ _bcommit=f7757368e0f0b3e108088ca7b5b8abda6faa7ebc #Peter, 8 x
+# _bcommit=2e256dd5b05561b051e895121530d2a0062c7a0f #Jann, 10 v
+# _bdiff="$_burlbase/diff/?h=linux-${_LLL_VER}.y&id2=v${_LLL_VER}.${_LLL_SUBVER}&id=$_bcommit"
+ _bpatch="$_burlbase/rawdiff/?h=linux-${_LLL_VER}.y&id2=v${_LLL_VER}.${_LLL_SUBVER}&id=$_bcommit"
+ msg "Bisect debug on: v${_LLL_VER}.${_LLL_SUBVER} --> $_bcommit"
+ msg "Bisect debug patch: $_bpatch"
+fi
+
# NUMA is optimized for multi-socket motherboards.
# A single multi-core CPU can actually run slower with NUMA enabled.
# Most users can disable NUMA.
@@ -38,10 +50,13 @@ _CJKTTY_PATCH="${_CJKTTY_PATCH_FILE}::${_CJKTTY_PATCH_URL}"
_PATHSET_DESC="ck${_CK_VER} uksm-${_UKSM_VER} and cjktty"
pkgbase=linux-shmilee
-pkgname=("${pkgbase}" "${pkgbase}-headers" "${pkgbase}-docs")
+pkgname=("${pkgbase}" "${pkgbase}-headers")
+if [ "$_Bisect_debug" == "off" ]; then
+ pkgname+=("${pkgbase}-docs")
+fi
_srcname=linux-${_LLL_VER}
pkgver=${_LLL_VER}.${_LLL_SUBVER}
-pkgrel=1
+pkgrel=2
arch=('x86_64')
url="https://www.kernel.org/"
license=('GPL2')
@@ -59,6 +74,7 @@ source=(
'sphinx-workaround.patch'
'uksm-patch-for-5.4.33+.patch'
'linux-cjktty-patch-for-5.4.36+.patch'
+ 'broken-sleep-5.4.48+.patch::https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/patch/?id=f7757368e0f0b3e108088ca7b5b8abda6faa7ebc'
'config' # the main kernel config file
'60-linux.hook' # pacman hook for depmod
'90-linux.hook' # pacman hook for initramfs regeneration
@@ -79,6 +95,7 @@ sha256sums=('bf338980b1670bca287f9994b7441c2361907635879169c64ae78364efc5f491'
'b7c814c8183e4645947a6dcc3cbf80431de8a8fd4e895b780f9a5fd92f82cb8e'
'6826624f65276927de012f040e77b02231fe6345b9da7c702deacd9372ea001e'
'573f1c40951a6ee4cf6b07a6a8a1123b00fcd8bff29843905cf191e08f1d87f2'
+ '9f9ec5becca27bc7b65b372254bcd4c64069deff1d3b7fa15e6e416595163654'
'7ce388e429d8df479a721285e445e116c5ee41e3126a702862e59056460b655e'
'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
@@ -86,12 +103,30 @@ sha256sums=('bf338980b1670bca287f9994b7441c2361907635879169c64ae78364efc5f491'
_kernelname=${pkgbase#linux}
+if [ "$_Bisect_debug" != "off" ]; then
+ makedepends+=('wget' 'modprobed-db')
+ PKGEXT='.pkg.tar'
+fi
+
prepare() {
cd ${_srcname}
# add upstream patch
patch -p1 -i ../patch-${pkgver}
+ # Bisect debug
+ if [ "$_Bisect_debug" == "on" ]; then
+ msg "Patching upstream v$pkgver --> $_bcommit"
+ if [ ! -f "${srcdir}/../v${pkgver}-${pkgrel}-$_bcommit" ]; then
+ wget "$_bpatch" -O "${srcdir}/../v${pkgver}-${pkgrel}-$_bcommit"
+ fi
+ patch -p1 -i "${srcdir}/../v${pkgver}-${pkgrel}-$_bcommit"
+ fi
+ # Bisect debug result
+ if [ "$_Bisect_debug" != "on" ]; then
+ patch -R -p1 -i "../broken-sleep-5.4.48+.patch"
+ fi
+
# add latest fixes from stable queue, if needed
# http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
@@ -157,6 +192,10 @@ prepare() {
#make oldconfig # using old config from previous kernel version
# ... or manually edit .config
+ if [ "$_Bisect_debug" != "off" ]; then
+ make LSMOD=$HOME/.config/modprobed.db localmodconfig
+ fi
+
# rewrite configuration
yes "" | make config >/dev/null
}
@@ -164,7 +203,11 @@ prepare() {
build() {
cd ${_srcname}
- make ${MAKEFLAGS} LOCALVERSION= bzImage modules htmldocs
+ if [ "$_Bisect_debug" == "off" ]; then
+ make ${MAKEFLAGS} LOCALVERSION= bzImage modules htmldocs
+ else
+ make ${MAKEFLAGS} LOCALVERSION= bzImage modules
+ fi
}
_package() {
diff --git a/broken-sleep-5.4.48+.patch b/broken-sleep-5.4.48+.patch
new file mode 100644
index 00000000000..e922de302b1
--- /dev/null
+++ b/broken-sleep-5.4.48+.patch
@@ -0,0 +1,152 @@
+From f7757368e0f0b3e108088ca7b5b8abda6faa7ebc Mon Sep 17 00:00:00 2001
+From: Peter Zijlstra <peterz@infradead.org>
+Date: Wed, 1 Apr 2020 17:40:33 -0400
+Subject: sched/core: Fix illegal RCU from offline CPUs
+
+[ Upstream commit bf2c59fce4074e55d622089b34be3a6bc95484fb ]
+
+In the CPU-offline process, it calls mmdrop() after idle entry and the
+subsequent call to cpuhp_report_idle_dead(). Once execution passes the
+call to rcu_report_dead(), RCU is ignoring the CPU, which results in
+lockdep complaining when mmdrop() uses RCU from either memcg or
+debugobjects below.
+
+Fix it by cleaning up the active_mm state from BP instead. Every arch
+which has CONFIG_HOTPLUG_CPU should have already called idle_task_exit()
+from AP. The only exception is parisc because it switches them to
+&init_mm unconditionally (see smp_boot_one_cpu() and smp_cpu_init()),
+but the patch will still work there because it calls mmgrab(&init_mm) in
+smp_cpu_init() and then should call mmdrop(&init_mm) in finish_cpu().
+
+ WARNING: suspicious RCU usage
+ -----------------------------
+ kernel/workqueue.c:710 RCU or wq_pool_mutex should be held!
+
+ other info that might help us debug this:
+
+ RCU used illegally from offline CPU!
+ Call Trace:
+ dump_stack+0xf4/0x164 (unreliable)
+ lockdep_rcu_suspicious+0x140/0x164
+ get_work_pool+0x110/0x150
+ __queue_work+0x1bc/0xca0
+ queue_work_on+0x114/0x120
+ css_release+0x9c/0xc0
+ percpu_ref_put_many+0x204/0x230
+ free_pcp_prepare+0x264/0x570
+ free_unref_page+0x38/0xf0
+ __mmdrop+0x21c/0x2c0
+ idle_task_exit+0x170/0x1b0
+ pnv_smp_cpu_kill_self+0x38/0x2e0
+ cpu_die+0x48/0x64
+ arch_cpu_idle_dead+0x30/0x50
+ do_idle+0x2f4/0x470
+ cpu_startup_entry+0x38/0x40
+ start_secondary+0x7a8/0xa80
+ start_secondary_resume+0x10/0x14
+
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Qian Cai <cai@lca.pw>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
+Link: https://lkml.kernel.org/r/20200401214033.8448-1-cai@lca.pw
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/powernv/smp.c | 1 -
+ include/linux/sched/mm.h | 2 ++
+ kernel/cpu.c | 18 +++++++++++++++++-
+ kernel/sched/core.c | 5 +++--
+ 4 files changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
+index 13e251699346..b2ba3e95bda7 100644
+--- a/arch/powerpc/platforms/powernv/smp.c
++++ b/arch/powerpc/platforms/powernv/smp.c
+@@ -167,7 +167,6 @@ static void pnv_smp_cpu_kill_self(void)
+ /* Standard hot unplug procedure */
+
+ idle_task_exit();
+- current->active_mm = NULL; /* for sanity */
+ cpu = smp_processor_id();
+ DBG("CPU%d offline\n", cpu);
+ generic_set_cpu_dead(cpu);
+diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
+index c49257a3b510..a132d875d351 100644
+--- a/include/linux/sched/mm.h
++++ b/include/linux/sched/mm.h
+@@ -49,6 +49,8 @@ static inline void mmdrop(struct mm_struct *mm)
+ __mmdrop(mm);
+ }
+
++void mmdrop(struct mm_struct *mm);
++
+ /*
+ * This has to be called after a get_task_mm()/mmget_not_zero()
+ * followed by taking the mmap_sem for writing before modifying the
+diff --git a/kernel/cpu.c b/kernel/cpu.c
+index d7890c1285bf..7527825ac7da 100644
+--- a/kernel/cpu.c
++++ b/kernel/cpu.c
+@@ -3,6 +3,7 @@
+ *
+ * This code is licenced under the GPL.
+ */
++#include <linux/sched/mm.h>
+ #include <linux/proc_fs.h>
+ #include <linux/smp.h>
+ #include <linux/init.h>
+@@ -564,6 +565,21 @@ static int bringup_cpu(unsigned int cpu)
+ return bringup_wait_for_ap(cpu);
+ }
+
++static int finish_cpu(unsigned int cpu)
++{
++ struct task_struct *idle = idle_thread_get(cpu);
++ struct mm_struct *mm = idle->active_mm;
++
++ /*
++ * idle_task_exit() will have switched to &init_mm, now
++ * clean up any remaining active_mm state.
++ */
++ if (mm != &init_mm)
++ idle->active_mm = &init_mm;
++ mmdrop(mm);
++ return 0;
++}
++
+ /*
+ * Hotplug state machine related functions
+ */
+@@ -1434,7 +1450,7 @@ static struct cpuhp_step cpuhp_hp_states[] = {
+ [CPUHP_BRINGUP_CPU] = {
+ .name = "cpu:bringup",
+ .startup.single = bringup_cpu,
+- .teardown.single = NULL,
++ .teardown.single = finish_cpu,
+ .cant_stop = true,
+ },
+ /* Final state before CPU kills itself */
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index e99d326fa569..4874e1468279 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -6177,13 +6177,14 @@ void idle_task_exit(void)
+ struct mm_struct *mm = current->active_mm;
+
+ BUG_ON(cpu_online(smp_processor_id()));
++ BUG_ON(current != this_rq()->idle);
+
+ if (mm != &init_mm) {
+ switch_mm(mm, &init_mm, current);
+- current->active_mm = &init_mm;
+ finish_arch_post_lock_switch();
+ }
+- mmdrop(mm);
++
++ /* finish_cpu(), as ran on the BP, will clean up the active_mm state */
+ }
+
+ /*
+--
+cgit 1.2.3-1.el7
+