From: Greg Kroah-Hartman Date: Thu, 21 Mar 2019 16:47:22 +0000 (+0100) Subject: 3.18-stable patches X-Git-Tag: v3.18.137~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a434035dd8b9fd2fc51a374e33066ec454065a9;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: rcu-do-rcu-gp-kthread-self-wakeup-from-softirq-and-interrupt.patch --- diff --git a/queue-3.18/mm-gup-fix-gup_pmd_range-for-dax.patch b/queue-3.18/mm-gup-fix-gup_pmd_range-for-dax.patch deleted file mode 100644 index e777dfc6990..00000000000 --- a/queue-3.18/mm-gup-fix-gup_pmd_range-for-dax.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c10e7f56c98af101b7af458f19bb8a212cca0f2d Mon Sep 17 00:00:00 2001 -From: Yu Zhao -Date: Tue, 12 Feb 2019 15:35:58 -0800 -Subject: mm/gup: fix gup_pmd_range() for dax - -[ Upstream commit 414fd080d125408cb15d04ff4907e1dd8145c8c7 ] - -For dax pmd, pmd_trans_huge() returns false but pmd_huge() returns true -on x86. So the function works as long as hugetlb is configured. -However, dax doesn't depend on hugetlb. - -Link: http://lkml.kernel.org/r/20190111034033.601-1-yuzhao@google.com -Signed-off-by: Yu Zhao -Reviewed-by: Jan Kara -Cc: Dan Williams -Cc: Huang Ying -Cc: Matthew Wilcox -Cc: Keith Busch -Cc: "Michael S . Tsirkin" -Cc: John Hubbard -Cc: Wei Yang -Cc: Mike Rapoport -Cc: Andrea Arcangeli -Cc: "Kirill A . Shutemov" -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds -Signed-off-by: Sasha Levin ---- - mm/gup.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/mm/gup.c b/mm/gup.c -index ce1630bf0b95..29a36fae8624 100644 ---- a/mm/gup.c -+++ b/mm/gup.c -@@ -885,7 +885,8 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, - if (pmd_none(pmd) || pmd_trans_splitting(pmd)) - return 0; - -- if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd))) { -+ if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) || -+ pmd_devmap(pmd))) { - /* - * NUMA hinting faults need to be handled in the GUP - * slowpath for accounting purposes and so that they --- -2.19.1 - diff --git a/queue-3.18/net-marvell-mvneta-fix-dma-debug-warning.patch b/queue-3.18/net-marvell-mvneta-fix-dma-debug-warning.patch deleted file mode 100644 index 5200ea89101..00000000000 --- a/queue-3.18/net-marvell-mvneta-fix-dma-debug-warning.patch +++ /dev/null @@ -1,58 +0,0 @@ -From b5382511a65617df9f933b467a2fb4a17445a3b5 Mon Sep 17 00:00:00 2001 -From: Russell King -Date: Fri, 15 Feb 2019 13:55:47 +0000 -Subject: net: marvell: mvneta: fix DMA debug warning - -[ Upstream commit a8fef9ba58c9966ddb1fec916d8d8137c9d8bc89 ] - -Booting 4.20 on SolidRun Clearfog issues this warning with DMA API -debug enabled: - -WARNING: CPU: 0 PID: 555 at kernel/dma/debug.c:1230 check_sync+0x514/0x5bc -mvneta f1070000.ethernet: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000002dd7dc00] [size=240 bytes] -Modules linked in: ahci mv88e6xxx dsa_core xhci_plat_hcd xhci_hcd devlink armada_thermal marvell_cesa des_generic ehci_orion phy_armada38x_comphy mcp3021 spi_orion evbug sfp mdio_i2c ip_tables x_tables -CPU: 0 PID: 555 Comm: bridge-network- Not tainted 4.20.0+ #291 -Hardware name: Marvell Armada 380/385 (Device Tree) -[] (unwind_backtrace) from [] (show_stack+0x10/0x14) -[] (show_stack) from [] (dump_stack+0x9c/0xd4) -[] (dump_stack) from [] (__warn+0xf8/0x124) -[] (__warn) from [] (warn_slowpath_fmt+0x38/0x48) -[] (warn_slowpath_fmt) from [] (check_sync+0x514/0x5bc) -[] (check_sync) from [] (debug_dma_sync_single_range_for_cpu+0x6c/0x74) -[] (debug_dma_sync_single_range_for_cpu) from [] (mvneta_poll+0x298/0xf58) -[] (mvneta_poll) from [] (net_rx_action+0x128/0x424) -[] (net_rx_action) from [] (__do_softirq+0xf0/0x540) -[] (__do_softirq) from [] (irq_exit+0x124/0x144) -[] (irq_exit) from [] (__handle_domain_irq+0x58/0xb0) -[] (__handle_domain_irq) from [] (gic_handle_irq+0x48/0x98) -[] (gic_handle_irq) from [] (__irq_svc+0x70/0x98) -... - -This appears to be caused by mvneta_rx_hwbm() calling -dma_sync_single_range_for_cpu() with the wrong struct device pointer, -as the buffer manager device pointer is used to map and unmap the -buffer. Fix this. - -Signed-off-by: Russell King -Signed-off-by: David S. Miller -Signed-off-by: Sasha Levin ---- - drivers/net/ethernet/marvell/mvneta.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index 6212177781d5..922c4afc767b 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -1482,7 +1482,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, - if (unlikely(!skb)) - goto err_drop_frame; - -- dma_sync_single_range_for_cpu(dev->dev.parent, -+ dma_sync_single_range_for_cpu(&pp->bm_priv->pdev->dev, - rx_desc->buf_phys_addr, - MVNETA_MH_SIZE + NET_SKB_PAD, - rx_bytes, --- -2.19.1 - diff --git a/queue-3.18/rcu-do-rcu-gp-kthread-self-wakeup-from-softirq-and-interrupt.patch b/queue-3.18/rcu-do-rcu-gp-kthread-self-wakeup-from-softirq-and-interrupt.patch new file mode 100644 index 00000000000..f8615e25336 --- /dev/null +++ b/queue-3.18/rcu-do-rcu-gp-kthread-self-wakeup-from-softirq-and-interrupt.patch @@ -0,0 +1,85 @@ +From 1d1f898df6586c5ea9aeaf349f13089c6fa37903 Mon Sep 17 00:00:00 2001 +From: "Zhang, Jun" +Date: Tue, 18 Dec 2018 06:55:01 -0800 +Subject: rcu: Do RCU GP kthread self-wakeup from softirq and interrupt + +From: Zhang, Jun + +commit 1d1f898df6586c5ea9aeaf349f13089c6fa37903 upstream. + +The rcu_gp_kthread_wake() function is invoked when it might be necessary +to wake the RCU grace-period kthread. Because self-wakeups are normally +a useless waste of CPU cycles, if rcu_gp_kthread_wake() is invoked from +this kthread, it naturally refuses to do the wakeup. + +Unfortunately, natural though it might be, this heuristic fails when +rcu_gp_kthread_wake() is invoked from an interrupt or softirq handler +that interrupted the grace-period kthread just after the final check of +the wait-event condition but just before the schedule() call. In this +case, a wakeup is required, even though the call to rcu_gp_kthread_wake() +is within the RCU grace-period kthread's context. Failing to provide +this wakeup can result in grace periods failing to start, which in turn +results in out-of-memory conditions. + +This race window is quite narrow, but it actually did happen during real +testing. It would of course need to be fixed even if it was strictly +theoretical in nature. + +This patch does not Cc stable because it does not apply cleanly to +earlier kernel versions. + +Fixes: 48a7639ce80c ("rcu: Make callers awaken grace-period kthread") +Reported-by: "He, Bo" +Co-developed-by: "Zhang, Jun" +Co-developed-by: "He, Bo" +Co-developed-by: "xiao, jin" +Co-developed-by: Bai, Jie A +Signed-off: "Zhang, Jun" +Signed-off: "He, Bo" +Signed-off: "xiao, jin" +Signed-off: Bai, Jie A +Signed-off-by: "Zhang, Jun" +[ paulmck: Switch from !in_softirq() to "!in_interrupt() && + !in_serving_softirq() to avoid redundant wakeups and to also handle the + interrupt-handler scenario as well as the softirq-handler scenario that + actually occurred in testing. ] +Signed-off-by: Paul E. McKenney +Link: https://lkml.kernel.org/r/CD6925E8781EFD4D8E11882D20FC406D52A11F61@SHSMSX104.ccr.corp.intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/rcu/tree.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -1399,15 +1399,23 @@ static int rcu_future_gp_cleanup(struct + } + + /* +- * Awaken the grace-period kthread for the specified flavor of RCU. +- * Don't do a self-awaken, and don't bother awakening when there is +- * nothing for the grace-period kthread to do (as in several CPUs +- * raced to awaken, and we lost), and finally don't try to awaken +- * a kthread that has not yet been created. ++ * Awaken the grace-period kthread. Don't do a self-awaken (unless in ++ * an interrupt or softirq handler), and don't bother awakening when there ++ * is nothing for the grace-period kthread to do (as in several CPUs raced ++ * to awaken, and we lost), and finally don't try to awaken a kthread that ++ * has not yet been created. If all those checks are passed, track some ++ * debug information and awaken. ++ * ++ * So why do the self-wakeup when in an interrupt or softirq handler ++ * in the grace-period kthread's context? Because the kthread might have ++ * been interrupted just as it was going to sleep, and just after the final ++ * pre-sleep check of the awaken condition. In this case, a wakeup really ++ * is required, and is therefore supplied. + */ + static void rcu_gp_kthread_wake(struct rcu_state *rsp) + { +- if (current == rsp->gp_kthread || ++ if ((current == rsp->gp_kthread && ++ !in_interrupt() && !in_serving_softirq()) || + !ACCESS_ONCE(rsp->gp_flags) || + !rsp->gp_kthread) + return; diff --git a/queue-3.18/series b/queue-3.18/series index 24c1a9def6d..0cda6f05eee 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -97,7 +97,6 @@ asoc-fsl_esai-fix-register-setting-issue-in-right_j-mode.patch crypto-ahash-fix-another-early-termination-in-hash-walk.patch s390-dasd-fix-using-offset-into-zero-size-array-erro.patch input-matrix_keypad-use-flush_delayed_work.patch -mm-gup-fix-gup_pmd_range-for-dax.patch i2c-cadence-fix-the-hold-bit-setting.patch input-st-keyscan-fix-potential-zalloc-null-dereferen.patch assoc_array-fix-shortcut-creation.patch @@ -105,7 +104,6 @@ scsi-libiscsi-fix-race-between-iscsi_xmit_task-and-i.patch net-systemport-fix-reception-of-bpdus.patch net-mv643xx_eth-disable-clk-on-error-path-in-mv643xx.patch arm64-relax-gic-version-check-during-early-boot.patch -net-marvell-mvneta-fix-dma-debug-warning.patch tmpfs-fix-link-accounting-when-a-tmpfile-is-linked-i.patch net-set-static-variable-an-initial-value-in-atl2_pro.patch cifs-fix-read-after-write-for-files-with-read-caching.patch @@ -131,3 +129,4 @@ arm-s3c24xx-fix-boolean-expressions-in-osiris_dvs_notify.patch nfsd-fix-memory-corruption-caused-by-readdir.patch nfsd-fix-wrong-check-in-write_v4_end_grace.patch md-fix-failed-allocation-of-md_register_thread.patch +rcu-do-rcu-gp-kthread-self-wakeup-from-softirq-and-interrupt.patch