From 48d2cf4063e73e6ce0dd8526ba218c37a78970ba Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2018 09:27:47 +0200 Subject: [PATCH] 4.14-stable patches added patches: block-do-not-use-interruptible-wait-anywhere.patch mtd-rawnand-denali_dt-set-clk_x_rate-to-200-mhz-unconditionally.patch pci-hv-disable-enable-irqs-rather-than-bh-in-hv_compose_msi_msg.patch --- ...-not-use-interruptible-wait-anywhere.patch | 72 ++++++++++++++++++ ...lk_x_rate-to-200-mhz-unconditionally.patch | 49 +++++++++++++ ...rather-than-bh-in-hv_compose_msi_msg.patch | 73 +++++++++++++++++++ queue-4.14/series | 3 + 4 files changed, 197 insertions(+) create mode 100644 queue-4.14/block-do-not-use-interruptible-wait-anywhere.patch create mode 100644 queue-4.14/mtd-rawnand-denali_dt-set-clk_x_rate-to-200-mhz-unconditionally.patch create mode 100644 queue-4.14/pci-hv-disable-enable-irqs-rather-than-bh-in-hv_compose_msi_msg.patch diff --git a/queue-4.14/block-do-not-use-interruptible-wait-anywhere.patch b/queue-4.14/block-do-not-use-interruptible-wait-anywhere.patch new file mode 100644 index 00000000000..5b7845c83f1 --- /dev/null +++ b/queue-4.14/block-do-not-use-interruptible-wait-anywhere.patch @@ -0,0 +1,72 @@ +From 1dc3039bc87ae7d19a990c3ee71cfd8a9068f428 Mon Sep 17 00:00:00 2001 +From: Alan Jenkins +Date: Thu, 12 Apr 2018 19:11:58 +0100 +Subject: block: do not use interruptible wait anywhere + +From: Alan Jenkins + +commit 1dc3039bc87ae7d19a990c3ee71cfd8a9068f428 upstream. + +When blk_queue_enter() waits for a queue to unfreeze, or unset the +PREEMPT_ONLY flag, do not allow it to be interrupted by a signal. + +The PREEMPT_ONLY flag was introduced later in commit 3a0a529971ec +("block, scsi: Make SCSI quiesce and resume work reliably"). Note the SCSI +device is resumed asynchronously, i.e. after un-freezing userspace tasks. + +So that commit exposed the bug as a regression in v4.15. A mysterious +SIGBUS (or -EIO) sometimes happened during the time the device was being +resumed. Most frequently, there was no kernel log message, and we saw Xorg +or Xwayland killed by SIGBUS.[1] + +[1] E.g. https://bugzilla.redhat.com/show_bug.cgi?id=1553979 + +Without this fix, I get an IO error in this test: + +# dd if=/dev/sda of=/dev/null iflag=direct & \ + while killall -SIGUSR1 dd; do sleep 0.1; done & \ + echo mem > /sys/power/state ; \ + sleep 5; killall dd # stop after 5 seconds + +The interruptible wait was added to blk_queue_enter in +commit 3ef28e83ab15 ("block: generic request_queue reference counting"). +Before then, the interruptible wait was only in blk-mq, but I don't think +it could ever have been correct. + +Reviewed-by: Bart Van Assche +Cc: stable@vger.kernel.org +Signed-off-by: Alan Jenkins +Signed-off-by: Jens Axboe +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + block/blk-core.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -779,7 +779,6 @@ EXPORT_SYMBOL(blk_alloc_queue); + int blk_queue_enter(struct request_queue *q, bool nowait) + { + while (true) { +- int ret; + + if (percpu_ref_tryget_live(&q->q_usage_counter)) + return 0; +@@ -796,13 +795,11 @@ int blk_queue_enter(struct request_queue + */ + smp_rmb(); + +- ret = wait_event_interruptible(q->mq_freeze_wq, +- !atomic_read(&q->mq_freeze_depth) || +- blk_queue_dying(q)); ++ wait_event(q->mq_freeze_wq, ++ !atomic_read(&q->mq_freeze_depth) || ++ blk_queue_dying(q)); + if (blk_queue_dying(q)) + return -ENODEV; +- if (ret) +- return ret; + } + } + diff --git a/queue-4.14/mtd-rawnand-denali_dt-set-clk_x_rate-to-200-mhz-unconditionally.patch b/queue-4.14/mtd-rawnand-denali_dt-set-clk_x_rate-to-200-mhz-unconditionally.patch new file mode 100644 index 00000000000..b44f96ee53d --- /dev/null +++ b/queue-4.14/mtd-rawnand-denali_dt-set-clk_x_rate-to-200-mhz-unconditionally.patch @@ -0,0 +1,49 @@ +From 3f6e6986045d47f87bd982910821b7ab9758487e Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Sat, 23 Jun 2018 01:06:34 +0900 +Subject: mtd: rawnand: denali_dt: set clk_x_rate to 200 MHz unconditionally + +From: Masahiro Yamada + +commit 3f6e6986045d47f87bd982910821b7ab9758487e upstream. + +Since commit 1bb88666775e ("mtd: nand: denali: handle timing parameters +by setup_data_interface()"), denali_dt.c gets the clock rate from the +clock driver. The driver expects the frequency of the bus interface +clock, whereas the clock driver of SOCFPGA provides the core clock. +Thus, the setup_data_interface() hook calculates timing parameters +based on a wrong frequency. + +To make it work without relying on the clock driver, hard-code the clock +frequency, 200MHz. This is fine for existing DT of UniPhier, and also +fixes the issue of SOCFPGA because both platforms use 200 MHz for the +bus interface clock. + +Fixes: 1bb88666775e ("mtd: nand: denali: handle timing parameters by setup_data_interface()") +Cc: linux-stable #4.14+ +Reported-by: Philipp Rosenberger +Suggested-by: Boris Brezillon +Signed-off-by: Masahiro Yamada +Tested-by: Richard Weinberger +Signed-off-by: Boris Brezillon +Signed-off-by: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/nand/denali_dt.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/denali_dt.c ++++ b/drivers/mtd/nand/denali_dt.c +@@ -122,7 +122,11 @@ static int denali_dt_probe(struct platfo + if (ret) + return ret; + +- denali->clk_x_rate = clk_get_rate(dt->clk); ++ /* ++ * Hardcode the clock rate for the backward compatibility. ++ * This works for both SOCFPGA and UniPhier. ++ */ ++ denali->clk_x_rate = 200000000; + + ret = denali_init(denali); + if (ret) diff --git a/queue-4.14/pci-hv-disable-enable-irqs-rather-than-bh-in-hv_compose_msi_msg.patch b/queue-4.14/pci-hv-disable-enable-irqs-rather-than-bh-in-hv_compose_msi_msg.patch new file mode 100644 index 00000000000..403ac44fa87 --- /dev/null +++ b/queue-4.14/pci-hv-disable-enable-irqs-rather-than-bh-in-hv_compose_msi_msg.patch @@ -0,0 +1,73 @@ +From 35a88a18d7ea58600e11590405bc93b08e16e7f5 Mon Sep 17 00:00:00 2001 +From: Dexuan Cui +Date: Mon, 9 Jul 2018 13:16:07 -0500 +Subject: PCI: hv: Disable/enable IRQs rather than BH in hv_compose_msi_msg() + +From: Dexuan Cui + +commit 35a88a18d7ea58600e11590405bc93b08e16e7f5 upstream. + +Commit de0aa7b2f97d ("PCI: hv: Fix 2 hang issues in hv_compose_msi_msg()") +uses local_bh_disable()/enable(), because hv_pci_onchannelcallback() can +also run in tasklet context as the channel event callback, so bottom halves +should be disabled to prevent a race condition. + +With CONFIG_PROVE_LOCKING=y in the recent mainline, or old kernels that +don't have commit f71b74bca637 ("irq/softirqs: Use lockdep to assert IRQs +are disabled/enabled"), when the upper layer IRQ code calls +hv_compose_msi_msg() with local IRQs disabled, we'll see a warning at the +beginning of __local_bh_enable_ip(): + + IRQs not enabled as expected + WARNING: CPU: 0 PID: 408 at kernel/softirq.c:162 __local_bh_enable_ip + +The warning exposes an issue in de0aa7b2f97d: local_bh_enable() can +potentially call do_softirq(), which is not supposed to run when local IRQs +are disabled. Let's fix this by using local_irq_save()/restore() instead. + +Note: hv_pci_onchannelcallback() is not a hot path because it's only called +when the PCI device is hot added and removed, which is infrequent. + +Fixes: de0aa7b2f97d ("PCI: hv: Fix 2 hang issues in hv_compose_msi_msg()") +Signed-off-by: Dexuan Cui +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Bjorn Helgaas +Reviewed-by: Haiyang Zhang +Cc: stable@vger.kernel.org +Cc: Stephen Hemminger +Cc: K. Y. Srinivasan +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/host/pci-hyperv.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/pci/host/pci-hyperv.c ++++ b/drivers/pci/host/pci-hyperv.c +@@ -1091,6 +1091,7 @@ static void hv_compose_msi_msg(struct ir + struct pci_bus *pbus; + struct pci_dev *pdev; + struct cpumask *dest; ++ unsigned long flags; + struct compose_comp_ctxt comp; + struct tran_int_desc *int_desc; + struct { +@@ -1182,14 +1183,15 @@ static void hv_compose_msi_msg(struct ir + * the channel callback directly when channel->target_cpu is + * the current CPU. When the higher level interrupt code + * calls us with interrupt enabled, let's add the +- * local_bh_disable()/enable() to avoid race. ++ * local_irq_save()/restore() to avoid race: ++ * hv_pci_onchannelcallback() can also run in tasklet. + */ +- local_bh_disable(); ++ local_irq_save(flags); + + if (hbus->hdev->channel->target_cpu == smp_processor_id()) + hv_pci_onchannelcallback(hbus); + +- local_bh_enable(); ++ local_irq_restore(flags); + + if (hpdev->state == hv_pcichild_ejecting) { + dev_err_once(&hbus->hdev->device, diff --git a/queue-4.14/series b/queue-4.14/series index 1c299055bcb..9fb7029068a 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -54,3 +54,6 @@ xhci-fix-usb3-null-pointer-dereference-at-logical-disconnect.patch media-rc-oops-in-ir_timer_keyup-after-device-unplug.patch clocksource-initialize-cs-wd_list.patch crypto-af_alg-initialize-sg_num_bytes-in-error-code-path.patch +mtd-rawnand-denali_dt-set-clk_x_rate-to-200-mhz-unconditionally.patch +block-do-not-use-interruptible-wait-anywhere.patch +pci-hv-disable-enable-irqs-rather-than-bh-in-hv_compose_msi_msg.patch -- 2.47.3