From: Greg Kroah-Hartman Date: Wed, 2 May 2018 15:56:44 +0000 (-0700) Subject: 4.14-stable patches X-Git-Tag: v4.9.99~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=20e8179a0ebb457107f98ca66185dfc40fc45c12;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: rcu-create-rcu-specific-workqueues-with-rescuers.patch xhci-show-what-usb-release-number-the-xhc-supports-from-protocol-capablity.patch --- diff --git a/queue-4.14/block-fix-a-race-between-request-queue-removal-and-the-block-cgroup-controller.patch b/queue-4.14/block-fix-a-race-between-request-queue-removal-and-the-block-cgroup-controller.patch deleted file mode 100644 index 5bbd070db87..00000000000 --- a/queue-4.14/block-fix-a-race-between-request-queue-removal-and-the-block-cgroup-controller.patch +++ /dev/null @@ -1,97 +0,0 @@ -From foo@baz Tue May 1 16:18:20 PDT 2018 -From: Bart Van Assche -Date: Wed, 28 Feb 2018 10:15:33 -0800 -Subject: block: Fix a race between request queue removal and the block cgroup controller - -From: Bart Van Assche - -[ Upstream commit a063057d7c731cffa7d10740e8ebc2970df8dbb3 ] - -Avoid that the following race can occur: - -blk_cleanup_queue() blkcg_print_blkgs() - spin_lock_irq(lock) (1) spin_lock_irq(blkg->q->queue_lock) (2,5) - q->queue_lock = &q->__queue_lock (3) - spin_unlock_irq(lock) (4) - spin_unlock_irq(blkg->q->queue_lock) (6) - -(1) take driver lock; -(2) busy loop for driver lock; -(3) override driver lock with internal lock; -(4) unlock driver lock; -(5) can take driver lock now; -(6) but unlock internal lock. - -This change is safe because only the SCSI core and the NVME core keep -a reference on a request queue after having called blk_cleanup_queue(). -Neither driver accesses any of the removed data structures between its -blk_cleanup_queue() and blk_put_queue() calls. - -Reported-by: Joseph Qi -Signed-off-by: Bart Van Assche -Reviewed-by: Joseph Qi -Cc: Jan Kara -Signed-off-by: Jens Axboe -Signed-off-by: Sasha Levin -Signed-off-by: Greg Kroah-Hartman ---- - block/blk-core.c | 31 +++++++++++++++++++++++++++++++ - block/blk-sysfs.c | 7 ------- - 2 files changed, 31 insertions(+), 7 deletions(-) - ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -681,6 +681,37 @@ void blk_cleanup_queue(struct request_qu - del_timer_sync(&q->backing_dev_info->laptop_mode_wb_timer); - blk_sync_queue(q); - -+ /* -+ * I/O scheduler exit is only safe after the sysfs scheduler attribute -+ * has been removed. -+ */ -+ WARN_ON_ONCE(q->kobj.state_in_sysfs); -+ -+ /* -+ * Since the I/O scheduler exit code may access cgroup information, -+ * perform I/O scheduler exit before disassociating from the block -+ * cgroup controller. -+ */ -+ if (q->elevator) { -+ ioc_clear_queue(q); -+ elevator_exit(q, q->elevator); -+ q->elevator = NULL; -+ } -+ -+ /* -+ * Remove all references to @q from the block cgroup controller before -+ * restoring @q->queue_lock to avoid that restoring this pointer causes -+ * e.g. blkcg_print_blkgs() to crash. -+ */ -+ blkcg_exit_queue(q); -+ -+ /* -+ * Since the cgroup code may dereference the @q->backing_dev_info -+ * pointer, only decrease its reference count after having removed the -+ * association with the block cgroup controller. -+ */ -+ bdi_put(q->backing_dev_info); -+ - if (q->mq_ops) - blk_mq_free_queue(q); - percpu_ref_exit(&q->q_usage_counter); ---- a/block/blk-sysfs.c -+++ b/block/blk-sysfs.c -@@ -801,13 +801,6 @@ static void __blk_release_queue(struct w - if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags)) - blk_stat_remove_callback(q, q->poll_cb); - blk_stat_free_callback(q->poll_cb); -- bdi_put(q->backing_dev_info); -- blkcg_exit_queue(q); -- -- if (q->elevator) { -- ioc_clear_queue(q); -- elevator_exit(q, q->elevator); -- } - - blk_free_queue_stats(q->stats); - diff --git a/queue-4.14/rcu-create-rcu-specific-workqueues-with-rescuers.patch b/queue-4.14/rcu-create-rcu-specific-workqueues-with-rescuers.patch new file mode 100644 index 00000000000..149d492d208 --- /dev/null +++ b/queue-4.14/rcu-create-rcu-specific-workqueues-with-rescuers.patch @@ -0,0 +1,111 @@ +From foo@baz Wed May 2 08:55:24 PDT 2018 +From: "Paul E. McKenney" +Date: Mon, 8 Jan 2018 14:35:52 -0800 +Subject: rcu: Create RCU-specific workqueues with rescuers + +From: "Paul E. McKenney" + +[ Upstream commit ad7c946b35ad455417fdd4bc0e17deda4011841b ] + +RCU's expedited grace periods can participate in out-of-memory deadlocks +due to all available system_wq kthreads being blocked and there not being +memory available to create more. This commit prevents such deadlocks +by allocating an RCU-specific workqueue_struct at early boot time, and +providing it with a rescuer to ensure forward progress. This uses the +shiny new init_rescuer() function provided by Tejun (but indirectly). + +This commit also causes SRCU to use this new RCU-specific +workqueue_struct. Note that SRCU's use of workqueues never blocks them +waiting for readers, so this should be safe from a forward-progress +viewpoint. Note that this moves SRCU from system_power_efficient_wq +to a normal workqueue. In the unlikely event that this results in +measurable degradation, a separate power-efficient workqueue will be +creates for SRCU. + +Reported-by: Prateek Sood +Reported-by: Tejun Heo +Signed-off-by: Paul E. McKenney +Acked-by: Tejun Heo +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + kernel/rcu/rcu.h | 1 + + kernel/rcu/srcutree.c | 8 +++----- + kernel/rcu/tree.c | 6 ++++++ + kernel/rcu/tree_exp.h | 2 +- + 4 files changed, 11 insertions(+), 6 deletions(-) + +--- a/kernel/rcu/rcu.h ++++ b/kernel/rcu/rcu.h +@@ -474,6 +474,7 @@ void show_rcu_gp_kthreads(void); + void rcu_force_quiescent_state(void); + void rcu_bh_force_quiescent_state(void); + void rcu_sched_force_quiescent_state(void); ++extern struct workqueue_struct *rcu_gp_wq; + #endif /* #else #ifdef CONFIG_TINY_RCU */ + + #ifdef CONFIG_RCU_NOCB_CPU +--- a/kernel/rcu/srcutree.c ++++ b/kernel/rcu/srcutree.c +@@ -465,8 +465,7 @@ static bool srcu_queue_delayed_work_on(i + */ + static void srcu_schedule_cbs_sdp(struct srcu_data *sdp, unsigned long delay) + { +- srcu_queue_delayed_work_on(sdp->cpu, system_power_efficient_wq, +- &sdp->work, delay); ++ srcu_queue_delayed_work_on(sdp->cpu, rcu_gp_wq, &sdp->work, delay); + } + + /* +@@ -664,8 +663,7 @@ static void srcu_funnel_gp_start(struct + rcu_seq_state(sp->srcu_gp_seq) == SRCU_STATE_IDLE) { + WARN_ON_ONCE(ULONG_CMP_GE(sp->srcu_gp_seq, sp->srcu_gp_seq_needed)); + srcu_gp_start(sp); +- queue_delayed_work(system_power_efficient_wq, &sp->work, +- srcu_get_delay(sp)); ++ queue_delayed_work(rcu_gp_wq, &sp->work, srcu_get_delay(sp)); + } + raw_spin_unlock_irqrestore_rcu_node(sp, flags); + } +@@ -1198,7 +1196,7 @@ static void srcu_reschedule(struct srcu_ + raw_spin_unlock_irq_rcu_node(sp); + + if (pushgp) +- queue_delayed_work(system_power_efficient_wq, &sp->work, delay); ++ queue_delayed_work(rcu_gp_wq, &sp->work, delay); + } + + /* +--- a/kernel/rcu/tree.c ++++ b/kernel/rcu/tree.c +@@ -4176,6 +4176,8 @@ static void __init rcu_dump_rcu_node_tre + pr_cont("\n"); + } + ++struct workqueue_struct *rcu_gp_wq; ++ + void __init rcu_init(void) + { + int cpu; +@@ -4203,6 +4205,10 @@ void __init rcu_init(void) + if (IS_ENABLED(CONFIG_TREE_SRCU)) + srcu_online_cpu(cpu); + } ++ ++ /* Create workqueue for expedited GPs and for Tree SRCU. */ ++ rcu_gp_wq = alloc_workqueue("rcu_gp", WQ_MEM_RECLAIM, 0); ++ WARN_ON(!rcu_gp_wq); + } + + #include "tree_exp.h" +--- a/kernel/rcu/tree_exp.h ++++ b/kernel/rcu/tree_exp.h +@@ -606,7 +606,7 @@ static void _synchronize_rcu_expedited(s + rew.rew_rsp = rsp; + rew.rew_s = s; + INIT_WORK_ONSTACK(&rew.rew_work, wait_rcu_exp_gp); +- schedule_work(&rew.rew_work); ++ queue_work(rcu_gp_wq, &rew.rew_work); + } + + /* Wait for expedited grace period to complete. */ diff --git a/queue-4.14/series b/queue-4.14/series index 136d460b839..79b1d0aaa01 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -504,7 +504,6 @@ drm-omap-add-pclk-setting-case-when-channel-is-dss_wb.patch drm-omapdrm-dss-move-initialization-code-from-component-bind-to-probe.patch arm-dts-dra71-evm-correct-evm_sd-regulator-max-voltage.patch drm-amdgpu-disable-gfx-ring-and-disable-pq-wptr-in-hw_fini.patch -block-fix-a-race-between-request-queue-removal-and-the-block-cgroup-controller.patch drm-amdgpu-adjust-timeout-for-ib_ring_tests-v2.patch serial-xuartps-fix-out-of-bounds-access-through-dt-alias.patch serial-sh-sci-fix-out-of-bounds-access-through-dt-alias.patch @@ -577,3 +576,5 @@ pinctrl-mcp23s08-spi-fix-regmap-debugfs-entries.patch asoc-samsung-i2s-ensure-the-rclk-rate-is-properly-determined.patch bluetooth-btusb-add-device-id-for-rtl8822be.patch kdb-make-mdr-command-repeat.patch +xhci-show-what-usb-release-number-the-xhc-supports-from-protocol-capablity.patch +rcu-create-rcu-specific-workqueues-with-rescuers.patch diff --git a/queue-4.14/xhci-show-what-usb-release-number-the-xhc-supports-from-protocol-capablity.patch b/queue-4.14/xhci-show-what-usb-release-number-the-xhc-supports-from-protocol-capablity.patch new file mode 100644 index 00000000000..4b0b3ec395b --- /dev/null +++ b/queue-4.14/xhci-show-what-usb-release-number-the-xhc-supports-from-protocol-capablity.patch @@ -0,0 +1,62 @@ +From foo@baz Wed May 2 08:53:47 PDT 2018 +From: Mathias Nyman +Date: Fri, 16 Mar 2018 16:33:06 +0200 +Subject: xhci: Show what USB release number the xHC supports from protocol capablity + +From: Mathias Nyman + +[ Upstream commit 0ee78c101425aae681c631ba59c6ac7f44b1d83a ] + +xhci driver displays the supported xHC USB revision in a message during +driver load: + +"Host supports USB 3.1 Enhanced SuperSpeed" + +Get the USB minor revision number from the xhci protocol capability. +This will show the correct supported revisions for new USB 3.2 and later +hosts + +Don't rely on the SBRN (serial bus revision number) register, it's often +showing 0x30 (USB3.0) for hosts that support USB 3.1 + +Signed-off-by: Mathias Nyman +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -4764,6 +4764,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, + * quirks + */ + struct device *dev = hcd->self.sysdev; ++ unsigned int minor_rev; + int retval; + + /* Accept arbitrarily long scatter-gather lists */ +@@ -4791,12 +4792,19 @@ int xhci_gen_setup(struct usb_hcd *hcd, + */ + hcd->has_tt = 1; + } else { +- /* Some 3.1 hosts return sbrn 0x30, can't rely on sbrn alone */ +- if (xhci->sbrn == 0x31 || xhci->usb3_rhub.min_rev >= 1) { +- xhci_info(xhci, "Host supports USB 3.1 Enhanced SuperSpeed\n"); ++ /* ++ * Some 3.1 hosts return sbrn 0x30, use xhci supported protocol ++ * minor revision instead of sbrn ++ */ ++ minor_rev = xhci->usb3_rhub.min_rev; ++ if (minor_rev) { + hcd->speed = HCD_USB31; + hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; + } ++ xhci_info(xhci, "Host supports USB 3.%x %s SuperSpeed\n", ++ minor_rev, ++ minor_rev ? "Enhanced" : ""); ++ + /* xHCI private pointer was set in xhci_pci_probe for the second + * registered roothub. + */