From: Sasha Levin Date: Sun, 13 Dec 2020 23:22:40 +0000 (-0500) Subject: Fixes for 4.9 X-Git-Tag: v5.10.1~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f2d581ce479284433adde2bd56ddeafca590f221;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/arc-stack-unwinding-don-t-assume-non-current-task-is.patch b/queue-4.9/arc-stack-unwinding-don-t-assume-non-current-task-is.patch new file mode 100644 index 00000000000..c265eb92a0b --- /dev/null +++ b/queue-4.9/arc-stack-unwinding-don-t-assume-non-current-task-is.patch @@ -0,0 +1,96 @@ +From c667d63be63bd32dd2e95e70f8a1b9dc5e272d2d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Nov 2020 16:59:27 -0800 +Subject: ARC: stack unwinding: don't assume non-current task is sleeping + +From: Vineet Gupta + +[ Upstream commit e42404fa10fd11fe72d0a0e149a321d10e577715 ] + +To start stack unwinding (SP, PC and BLINK) are needed. When the +explicit execution context (pt_regs etc) is not available, unwinder +assumes the task is sleeping (in __switch_to()) and fetches SP and BLINK +from kernel mode stack. + +But this assumption is not true, specially in a SMP system, when top +runs on 1 core, there may be active running processes on all cores. + +So when unwinding non courrent tasks, ensure they are NOT running. + +And while at it, handle the self unwinding case explicitly. + +This came out of investigation of a customer reported hang with +rcutorture+top + +Link: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/31 +Signed-off-by: Vineet Gupta +Signed-off-by: Sasha Levin +--- + arch/arc/kernel/stacktrace.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c +index 165158735aa6b..3ee19b1e79be5 100644 +--- a/arch/arc/kernel/stacktrace.c ++++ b/arch/arc/kernel/stacktrace.c +@@ -39,15 +39,15 @@ + + #ifdef CONFIG_ARC_DW2_UNWIND + +-static void seed_unwind_frame_info(struct task_struct *tsk, +- struct pt_regs *regs, +- struct unwind_frame_info *frame_info) ++static int ++seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs, ++ struct unwind_frame_info *frame_info) + { + /* + * synchronous unwinding (e.g. dump_stack) + * - uses current values of SP and friends + */ +- if (tsk == NULL && regs == NULL) { ++ if (regs == NULL && (tsk == NULL || tsk == current)) { + unsigned long fp, sp, blink, ret; + frame_info->task = current; + +@@ -66,11 +66,15 @@ static void seed_unwind_frame_info(struct task_struct *tsk, + frame_info->call_frame = 0; + } else if (regs == NULL) { + /* +- * Asynchronous unwinding of sleeping task +- * - Gets SP etc from task's pt_regs (saved bottom of kernel +- * mode stack of task) ++ * Asynchronous unwinding of a likely sleeping task ++ * - first ensure it is actually sleeping ++ * - if so, it will be in __switch_to, kernel mode SP of task ++ * is safe-kept and BLINK at a well known location in there + */ + ++ if (tsk->state == TASK_RUNNING) ++ return -1; ++ + frame_info->task = tsk; + + frame_info->regs.r27 = TSK_K_FP(tsk); +@@ -104,6 +108,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk, + frame_info->regs.r63 = regs->ret; + frame_info->call_frame = 0; + } ++ ++ return 0; + } + + #endif +@@ -117,7 +123,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, + unsigned int address; + struct unwind_frame_info frame_info; + +- seed_unwind_frame_info(tsk, regs, &frame_info); ++ if (seed_unwind_frame_info(tsk, regs, &frame_info)) ++ return 0; + + while (1) { + address = UNW_PC(&frame_info); +-- +2.27.0 + diff --git a/queue-4.9/arm64-dts-rockchip-assign-a-fixed-index-to-mmc-devic.patch b/queue-4.9/arm64-dts-rockchip-assign-a-fixed-index-to-mmc-devic.patch new file mode 100644 index 00000000000..245f5a1094b --- /dev/null +++ b/queue-4.9/arm64-dts-rockchip-assign-a-fixed-index-to-mmc-devic.patch @@ -0,0 +1,43 @@ +From 71639a4ca8563afc921be8760f1aab74ad3757cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Nov 2020 17:23:55 +0100 +Subject: arm64: dts: rockchip: Assign a fixed index to mmc devices on rk3399 + boards. + +From: Markus Reichl + +[ Upstream commit 0011c6d182774fc781fb9e115ebe8baa356029ae ] + +Recently introduced async probe on mmc devices can shuffle block IDs. +Pin them to fixed values to ease booting in environments where UUIDs +are not practical. Use newly introduced aliases for mmcblk devices from [1]. + +[1] +https://patchwork.kernel.org/patch/11747669/ + +Signed-off-by: Markus Reichl +Reviewed-by: Douglas Anderson +Link: https://lore.kernel.org/r/20201104162356.1251-1-m.reichl@fivetechno.de +Signed-off-by: Heiko Stuebner +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +index 7afbfb0f96a3c..dd211dbdaaae0 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi +@@ -65,6 +65,9 @@ + i2c6 = &i2c6; + i2c7 = &i2c7; + i2c8 = &i2c8; ++ mmc0 = &sdio0; ++ mmc1 = &sdmmc; ++ mmc2 = &sdhci; + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; +-- +2.27.0 + diff --git a/queue-4.9/iwlwifi-pcie-limit-memory-read-spin-time.patch b/queue-4.9/iwlwifi-pcie-limit-memory-read-spin-time.patch new file mode 100644 index 00000000000..b7654f4cf9d --- /dev/null +++ b/queue-4.9/iwlwifi-pcie-limit-memory-read-spin-time.patch @@ -0,0 +1,94 @@ +From 4986ca6f4b654c2399f36b8f725243c9fd1e506a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Oct 2020 16:51:03 +0300 +Subject: iwlwifi: pcie: limit memory read spin time + +From: Johannes Berg + +[ Upstream commit 04516706bb99889986ddfa3a769ed50d2dc7ac13 ] + +When we read device memory, we lock a spinlock, write the address we +want to read from the device and then spin in a loop reading the data +in 32-bit quantities from another register. + +As the description makes clear, this is rather inefficient, incurring +a PCIe bus transaction for every read. In a typical device today, we +want to read 786k SMEM if it crashes, leading to 192k register reads. +Occasionally, we've seen the whole loop take over 20 seconds and then +triggering the soft lockup detector. + +Clearly, it is unreasonable to spin here for such extended periods of +time. + +To fix this, break the loop down into an outer and an inner loop, and +break out of the inner loop if more than half a second elapsed. To +avoid too much overhead, check for that only every 128 reads, though +there's no particular reason for that number. Then, unlock and relock +to obtain NIC access again, reprogram the start address and continue. + +This will keep (interrupt) latencies on the CPU down to a reasonable +time. + +Signed-off-by: Johannes Berg +Signed-off-by: Mordechay Goodstein +Signed-off-by: Luca Coelho +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/iwlwifi.20201022165103.45878a7e49aa.I3b9b9c5a10002915072312ce75b68ed5b3dc6e14@changeid +Signed-off-by: Sasha Levin +--- + .../net/wireless/intel/iwlwifi/pcie/trans.c | 36 ++++++++++++++----- + 1 file changed, 27 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +index e7b873018dca6..e1287c3421165 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +@@ -1904,18 +1904,36 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, + void *buf, int dwords) + { + unsigned long flags; +- int offs, ret = 0; ++ int offs = 0; + u32 *vals = buf; + +- if (iwl_trans_grab_nic_access(trans, &flags)) { +- iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr); +- for (offs = 0; offs < dwords; offs++) +- vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT); +- iwl_trans_release_nic_access(trans, &flags); +- } else { +- ret = -EBUSY; ++ while (offs < dwords) { ++ /* limit the time we spin here under lock to 1/2s */ ++ ktime_t timeout = ktime_add_us(ktime_get(), 500 * USEC_PER_MSEC); ++ ++ if (iwl_trans_grab_nic_access(trans, &flags)) { ++ iwl_write32(trans, HBUS_TARG_MEM_RADDR, ++ addr + 4 * offs); ++ ++ while (offs < dwords) { ++ vals[offs] = iwl_read32(trans, ++ HBUS_TARG_MEM_RDAT); ++ offs++; ++ ++ /* calling ktime_get is expensive so ++ * do it once in 128 reads ++ */ ++ if (offs % 128 == 0 && ktime_after(ktime_get(), ++ timeout)) ++ break; ++ } ++ iwl_trans_release_nic_access(trans, &flags); ++ } else { ++ return -EBUSY; ++ } + } +- return ret; ++ ++ return 0; + } + + static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr, +-- +2.27.0 + diff --git a/queue-4.9/platform-x86-acer-wmi-add-automatic-keyboard-backgro.patch b/queue-4.9/platform-x86-acer-wmi-add-automatic-keyboard-backgro.patch new file mode 100644 index 00000000000..8af96fa8363 --- /dev/null +++ b/queue-4.9/platform-x86-acer-wmi-add-automatic-keyboard-backgro.patch @@ -0,0 +1,38 @@ +From 05cc1cbfc17f28bd187ceb8ae7e4ae1aa651453a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Aug 2020 02:14:23 +0200 +Subject: platform/x86: acer-wmi: add automatic keyboard background light + toggle key as KEY_LIGHTS_TOGGLE + +From: Timo Witte + +[ Upstream commit 9e7a005ad56aa7d6ea5830c5ffcc60bf35de380b ] + +Got a dmesg message on my AMD Renoir based Acer laptop: +"acer_wmi: Unknown key number - 0x84" when toggling keyboard +background light + +Signed-off-by: Timo Witte +Reviewed-by: "Lee, Chun-Yi" +Link: https://lore.kernel.org/r/20200804001423.36778-1-timo.witte@gmail.com +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index 1515c9480f89f..90015e2cce9bf 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -124,6 +124,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = { + {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ + {KE_IGNORE, 0x81, {KEY_SLEEP} }, + {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */ ++ {KE_IGNORE, 0x84, {KEY_KBDILLUMTOGGLE} }, /* Automatic Keyboard background light toggle */ + {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} }, + {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} }, + {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} }, +-- +2.27.0 + diff --git a/queue-4.9/series b/queue-4.9/series index 855d8849358..063f4d2fdb8 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -1,2 +1,6 @@ spi-bcm2835aux-fix-use-after-free-on-unbind.patch spi-bcm2835aux-restore-err-assignment-in-bcm2835aux_spi_probe.patch +iwlwifi-pcie-limit-memory-read-spin-time.patch +arm64-dts-rockchip-assign-a-fixed-index-to-mmc-devic.patch +arc-stack-unwinding-don-t-assume-non-current-task-is.patch +platform-x86-acer-wmi-add-automatic-keyboard-backgro.patch