From: Sasha Levin Date: Sun, 22 Nov 2020 17:03:30 +0000 (-0500) Subject: Fixes for 4.9 X-Git-Tag: v4.4.246~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd644b84efd48db7049c2faab59a5f5da1c8e060;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/arm64-psci-avoid-printing-in-cpu_psci_cpu_die.patch b/queue-4.9/arm64-psci-avoid-printing-in-cpu_psci_cpu_die.patch new file mode 100644 index 00000000000..d8c5539dd83 --- /dev/null +++ b/queue-4.9/arm64-psci-avoid-printing-in-cpu_psci_cpu_die.patch @@ -0,0 +1,50 @@ +From c1c275ba1f025be6a82117a4632485663de42d65 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Nov 2020 09:57:55 +0000 +Subject: arm64: psci: Avoid printing in cpu_psci_cpu_die() + +From: Will Deacon + +[ Upstream commit 891deb87585017d526b67b59c15d38755b900fea ] + +cpu_psci_cpu_die() is called in the context of the dying CPU, which +will no longer be online or tracked by RCU. It is therefore not generally +safe to call printk() if the PSCI "cpu off" request fails, so remove the +pr_crit() invocation. + +Cc: Qian Cai +Cc: "Paul E. McKenney" +Cc: Catalin Marinas +Link: https://lore.kernel.org/r/20201106103602.9849-2-will@kernel.org +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + arch/arm64/kernel/psci.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c +index e3713d6fb8e00..bf6142a80cf1a 100644 +--- a/arch/arm64/kernel/psci.c ++++ b/arch/arm64/kernel/psci.c +@@ -68,7 +68,6 @@ static int cpu_psci_cpu_disable(unsigned int cpu) + + static void cpu_psci_cpu_die(unsigned int cpu) + { +- int ret; + /* + * There are no known implementations of PSCI actually using the + * power state field, pass a sensible default for now. +@@ -76,9 +75,7 @@ static void cpu_psci_cpu_die(unsigned int cpu) + u32 state = PSCI_POWER_STATE_TYPE_POWER_DOWN << + PSCI_0_2_POWER_STATE_TYPE_SHIFT; + +- ret = psci_ops.cpu_off(state); +- +- pr_crit("unable to power off CPU%u (%d)\n", cpu, ret); ++ psci_ops.cpu_off(state); + } + + static int cpu_psci_cpu_kill(unsigned int cpu) +-- +2.27.0 + diff --git a/queue-4.9/pinctrl-rockchip-enable-gpio-pclk-for-rockchip_gpio_.patch b/queue-4.9/pinctrl-rockchip-enable-gpio-pclk-for-rockchip_gpio_.patch new file mode 100644 index 00000000000..84071f9afea --- /dev/null +++ b/queue-4.9/pinctrl-rockchip-enable-gpio-pclk-for-rockchip_gpio_.patch @@ -0,0 +1,39 @@ +From fb52e4a6a00be1ef2a751944cd697753fc6469fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Oct 2020 14:37:30 +0800 +Subject: pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq + +From: Jianqun Xu + +[ Upstream commit 63fbf8013b2f6430754526ef9594f229c7219b1f ] + +There need to enable pclk_gpio when do irq_create_mapping, since it will +do access to gpio controller. + +Signed-off-by: Jianqun Xu +Reviewed-by: Heiko Stuebner +Reviewed-by: Kever Yang +Link: https://lore.kernel.org/r/20201013063731.3618-3-jay.xu@rock-chips.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-rockchip.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 417cd3bd7e0c9..ee2dcea1e54b9 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -1815,7 +1815,9 @@ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset) + if (!bank->domain) + return -ENXIO; + ++ clk_enable(bank->clk); + virq = irq_create_mapping(bank->domain, offset); ++ clk_disable(bank->clk); + + return (virq) ? : -ENXIO; + } +-- +2.27.0 + diff --git a/queue-4.9/series b/queue-4.9/series index 4d8ae40f64c..a03676eb14f 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -16,3 +16,6 @@ net-usb-qmi_wwan-set-dtr-quirk-for-mr400.patch tcp-only-postpone-probe_rtt-if-rtt-is-current-min_rtt-estimate.patch net-ftgmac100-fix-crash-when-removing-driver.patch mlxsw-core-use-variable-timeout-for-emad-retries.patch +pinctrl-rockchip-enable-gpio-pclk-for-rockchip_gpio_.patch +arm64-psci-avoid-printing-in-cpu_psci_cpu_die.patch +vfs-remove-lockdep-bogosity-in-__sb_start_write.patch diff --git a/queue-4.9/vfs-remove-lockdep-bogosity-in-__sb_start_write.patch b/queue-4.9/vfs-remove-lockdep-bogosity-in-__sb_start_write.patch new file mode 100644 index 00000000000..8b658fabac1 --- /dev/null +++ b/queue-4.9/vfs-remove-lockdep-bogosity-in-__sb_start_write.patch @@ -0,0 +1,111 @@ +From e2d182c9821b9eb4e7297c02b37ce5f5e75d988a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Nov 2020 16:49:29 -0800 +Subject: vfs: remove lockdep bogosity in __sb_start_write + +From: Darrick J. Wong + +[ Upstream commit 22843291efc986ce7722610073fcf85a39b4cb13 ] + +__sb_start_write has some weird looking lockdep code that claims to +exist to handle nested freeze locking requests from xfs. The code as +written seems broken -- if we think we hold a read lock on any of the +higher freeze levels (e.g. we hold SB_FREEZE_WRITE and are trying to +lock SB_FREEZE_PAGEFAULT), it converts a blocking lock attempt into a +trylock. + +However, it's not correct to downgrade a blocking lock attempt to a +trylock unless the downgrading code or the callers are prepared to deal +with that situation. Neither __sb_start_write nor its callers handle +this at all. For example: + +sb_start_pagefault ignores the return value completely, with the result +that if xfs_filemap_fault loses a race with a different thread trying to +fsfreeze, it will proceed without pagefault freeze protection (thereby +breaking locking rules) and then unlocks the pagefault freeze lock that +it doesn't own on its way out (thereby corrupting the lock state), which +leads to a system hang shortly afterwards. + +Normally, this won't happen because our ownership of a read lock on a +higher freeze protection level blocks fsfreeze from grabbing a write +lock on that higher level. *However*, if lockdep is offline, +lock_is_held_type unconditionally returns 1, which means that +percpu_rwsem_is_held returns 1, which means that __sb_start_write +unconditionally converts blocking freeze lock attempts into trylocks, +even when we *don't* hold anything that would block a fsfreeze. + +Apparently this all held together until 5.10-rc1, when bugs in lockdep +caused lockdep to shut itself off early in an fstests run, and once +fstests gets to the "race writes with freezer" tests, kaboom. This +might explain the long trail of vanishingly infrequent livelocks in +fstests after lockdep goes offline that I've never been able to +diagnose. + +We could fix it by spinning on the trylock if wait==true, but AFAICT the +locking works fine if lockdep is not built at all (and I didn't see any +complaints running fstests overnight), so remove this snippet entirely. + +NOTE: Commit f4b554af9931 in 2015 created the current weird logic (which +used to exist in a different form in commit 5accdf82ba25c from 2012) in +__sb_start_write. XFS solved this whole problem in the late 2.6 era by +creating a variant of transactions (XFS_TRANS_NO_WRITECOUNT) that don't +grab intwrite freeze protection, thus making lockdep's solution +unnecessary. The commit claims that Dave Chinner explained that the +trylock hack + comment could be removed, but nobody ever did. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +Reviewed-by: Jan Kara +Signed-off-by: Sasha Levin +--- + fs/super.c | 33 ++++----------------------------- + 1 file changed, 4 insertions(+), 29 deletions(-) + +diff --git a/fs/super.c b/fs/super.c +index abe2541fb28c2..377c439477b74 100644 +--- a/fs/super.c ++++ b/fs/super.c +@@ -1254,36 +1254,11 @@ EXPORT_SYMBOL(__sb_end_write); + */ + int __sb_start_write(struct super_block *sb, int level, bool wait) + { +- bool force_trylock = false; +- int ret = 1; ++ if (!wait) ++ return percpu_down_read_trylock(sb->s_writers.rw_sem + level-1); + +-#ifdef CONFIG_LOCKDEP +- /* +- * We want lockdep to tell us about possible deadlocks with freezing +- * but it's it bit tricky to properly instrument it. Getting a freeze +- * protection works as getting a read lock but there are subtle +- * problems. XFS for example gets freeze protection on internal level +- * twice in some cases, which is OK only because we already hold a +- * freeze protection also on higher level. Due to these cases we have +- * to use wait == F (trylock mode) which must not fail. +- */ +- if (wait) { +- int i; +- +- for (i = 0; i < level - 1; i++) +- if (percpu_rwsem_is_held(sb->s_writers.rw_sem + i)) { +- force_trylock = true; +- break; +- } +- } +-#endif +- if (wait && !force_trylock) +- percpu_down_read(sb->s_writers.rw_sem + level-1); +- else +- ret = percpu_down_read_trylock(sb->s_writers.rw_sem + level-1); +- +- WARN_ON(force_trylock && !ret); +- return ret; ++ percpu_down_read(sb->s_writers.rw_sem + level-1); ++ return 1; + } + EXPORT_SYMBOL(__sb_start_write); + +-- +2.27.0 +