From 79fd3da9cc30ec093115213adac07d98f768de18 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 11 May 2020 17:39:58 -0400 Subject: [PATCH] Fixes for 5.4 Signed-off-by: Sasha Levin --- ...redundant-cg-pg-ungate-on-runpm-ente.patch | 42 ++++++++++ ...-kfd-suspend-after-ip_suspend_phase1.patch | 45 +++++++++++ .../net-macb-fix-runtime-pm-refcounting.patch | 71 +++++++++++++++++ ...e-hang-when-ns-scanning-fails-during.patch | 48 ++++++++++++ ...vme_identify_ns_descs-error-handling.patch | 77 +++++++++++++++++++ queue-5.4/series | 8 ++ ...bes-fix-a-double-initialization-typo.patch | 41 ++++++++++ ...s-fix-missing-id-assignment-to-the-c.patch | 44 +++++++++++ ...onsole-freeing-with-a-common-interfa.patch | 62 +++++++++++++++ 9 files changed, 438 insertions(+) create mode 100644 queue-5.4/drm-amdgpu-drop-redundant-cg-pg-ungate-on-runpm-ente.patch create mode 100644 queue-5.4/drm-amdgpu-move-kfd-suspend-after-ip_suspend_phase1.patch create mode 100644 queue-5.4/net-macb-fix-runtime-pm-refcounting.patch create mode 100644 queue-5.4/nvme-fix-possible-hang-when-ns-scanning-fails-during.patch create mode 100644 queue-5.4/nvme-refactor-nvme_identify_ns_descs-error-handling.patch create mode 100644 queue-5.4/tracing-kprobes-fix-a-double-initialization-typo.patch create mode 100644 queue-5.4/tty-xilinx_uartps-fix-missing-id-assignment-to-the-c.patch create mode 100644 queue-5.4/vt-fix-unicode-console-freeing-with-a-common-interfa.patch diff --git a/queue-5.4/drm-amdgpu-drop-redundant-cg-pg-ungate-on-runpm-ente.patch b/queue-5.4/drm-amdgpu-drop-redundant-cg-pg-ungate-on-runpm-ente.patch new file mode 100644 index 00000000000..410b3f4d5d2 --- /dev/null +++ b/queue-5.4/drm-amdgpu-drop-redundant-cg-pg-ungate-on-runpm-ente.patch @@ -0,0 +1,42 @@ +From e6ac8bcb2ff0dd70404d4a542859a12c4b17c634 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Apr 2020 15:36:22 +0800 +Subject: drm/amdgpu: drop redundant cg/pg ungate on runpm enter + +From: Evan Quan + +[ Upstream commit f7b52890daba570bc8162d43c96b5583bbdd4edd ] + +CG/PG ungate is already performed in ip_suspend_phase1. Otherwise, +the CG/PG ungate will be performed twice. That will cause gfxoff +disablement is performed twice also on runpm enter while gfxoff +enablemnt once on rump exit. That will put gfxoff into disabled +state. + +Fixes: b2a7e9735ab286 ("drm/amdgpu: fix the hw hang during perform system reboot and reset") +Signed-off-by: Evan Quan +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index ca2a0770aad2e..5e1dce4241547 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -3070,9 +3070,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) + } + } + +- amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); +- amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); +- + amdgpu_ras_suspend(adev); + + r = amdgpu_device_ip_suspend_phase1(adev); +-- +2.20.1 + diff --git a/queue-5.4/drm-amdgpu-move-kfd-suspend-after-ip_suspend_phase1.patch b/queue-5.4/drm-amdgpu-move-kfd-suspend-after-ip_suspend_phase1.patch new file mode 100644 index 00000000000..69a6ffdcb81 --- /dev/null +++ b/queue-5.4/drm-amdgpu-move-kfd-suspend-after-ip_suspend_phase1.patch @@ -0,0 +1,45 @@ +From f057fabd650708da05e2cf3628e5173333ef8116 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Apr 2020 15:32:41 +0800 +Subject: drm/amdgpu: move kfd suspend after ip_suspend_phase1 + +From: Evan Quan + +[ Upstream commit c457a273e118bb96e1db8d1825f313e6cafe4258 ] + +This sequence change should be safe as what did in ip_suspend_phase1 +is to suspend DCE only. And this is a prerequisite for coming +redundant cg/pg ungate dropping. + +Fixes: 487eca11a321ef ("drm/amdgpu: fix gfx hang during suspend with video playback (v2)") +Signed-off-by: Evan Quan +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index 630e8342d1625..ca2a0770aad2e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -3073,12 +3073,12 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) + amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); + amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); + +- amdgpu_amdkfd_suspend(adev); +- + amdgpu_ras_suspend(adev); + + r = amdgpu_device_ip_suspend_phase1(adev); + ++ amdgpu_amdkfd_suspend(adev); ++ + /* evict vram memory */ + amdgpu_bo_evict_vram(adev); + +-- +2.20.1 + diff --git a/queue-5.4/net-macb-fix-runtime-pm-refcounting.patch b/queue-5.4/net-macb-fix-runtime-pm-refcounting.patch new file mode 100644 index 00000000000..ccbfaa771ab --- /dev/null +++ b/queue-5.4/net-macb-fix-runtime-pm-refcounting.patch @@ -0,0 +1,71 @@ +From 3a05301957b13ff6af72fc8e47cb0152b49f36c8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Apr 2020 13:51:20 +0300 +Subject: net: macb: Fix runtime PM refcounting + +From: Andy Shevchenko + +[ Upstream commit 0ce205d4660c312cdeb4a81066616dcc6f3799c4 ] + +The commit e6a41c23df0d, while trying to fix an issue, + + ("net: macb: ensure interface is not suspended on at91rm9200") + +introduced a refcounting regression, because in error case refcounter +must be balanced. Fix it by calling pm_runtime_put_noidle() in error case. + +While here, fix the same mistake in other couple of places. + +Fixes: e6a41c23df0d ("net: macb: ensure interface is not suspended on at91rm9200") +Cc: Alexandre Belloni +Cc: Claudiu Beznea +Signed-off-by: Andy Shevchenko +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/cadence/macb_main.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 234c13ebbc41b..dd2a605c5c2ed 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -334,8 +334,10 @@ static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum) + int status; + + status = pm_runtime_get_sync(&bp->pdev->dev); +- if (status < 0) ++ if (status < 0) { ++ pm_runtime_put_noidle(&bp->pdev->dev); + goto mdio_pm_exit; ++ } + + status = macb_mdio_wait_for_idle(bp); + if (status < 0) +@@ -367,8 +369,10 @@ static int macb_mdio_write(struct mii_bus *bus, int mii_id, int regnum, + int status; + + status = pm_runtime_get_sync(&bp->pdev->dev); +- if (status < 0) ++ if (status < 0) { ++ pm_runtime_put_noidle(&bp->pdev->dev); + goto mdio_pm_exit; ++ } + + status = macb_mdio_wait_for_idle(bp); + if (status < 0) +@@ -3691,8 +3695,10 @@ static int at91ether_open(struct net_device *dev) + int ret; + + ret = pm_runtime_get_sync(&lp->pdev->dev); +- if (ret < 0) ++ if (ret < 0) { ++ pm_runtime_put_noidle(&lp->pdev->dev); + return ret; ++ } + + /* Clear internal statistics */ + ctl = macb_readl(lp, NCR); +-- +2.20.1 + diff --git a/queue-5.4/nvme-fix-possible-hang-when-ns-scanning-fails-during.patch b/queue-5.4/nvme-fix-possible-hang-when-ns-scanning-fails-during.patch new file mode 100644 index 00000000000..ca2b056bb06 --- /dev/null +++ b/queue-5.4/nvme-fix-possible-hang-when-ns-scanning-fails-during.patch @@ -0,0 +1,48 @@ +From 3db398165eb37f110a93cb0135c10790c5e927d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 May 2020 15:44:02 -0700 +Subject: nvme: fix possible hang when ns scanning fails during error recovery + +From: Sagi Grimberg + +[ Upstream commit 59c7c3caaaf8750df4ec3255082f15eb4e371514 ] + +When the controller is reconnecting, the host fails I/O and admin +commands as the host cannot reach the controller. ns scanning may +revalidate namespaces during that period and it is wrong to remove +namespaces due to these failures as we may hang (see 205da2434301). + +One command that may fail is nvme_identify_ns_descs. Since we return +success due to having ns identify descriptor list optional, we continue +to compare ns identifiers in nvme_revalidate_disk, obviously fail and +return -ENODEV to nvme_validate_ns, which will remove the namespace. + +Exactly what we don't want to happen. + +Fixes: 22802bf742c2 ("nvme: Namepace identification descriptor list is optional") +Tested-by: Anton Eidelman +Signed-off-by: Sagi Grimberg +Reviewed-by: Keith Busch +Signed-off-by: Christoph Hellwig +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 66147df86d883..f0e0af3aa714e 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1078,7 +1078,7 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, + * Don't treat an error as fatal, as we potentially already + * have a NGUID or EUI-64. + */ +- if (status > 0) ++ if (status > 0 && !(status & NVME_SC_DNR)) + status = 0; + goto free_data; + } +-- +2.20.1 + diff --git a/queue-5.4/nvme-refactor-nvme_identify_ns_descs-error-handling.patch b/queue-5.4/nvme-refactor-nvme_identify_ns_descs-error-handling.patch new file mode 100644 index 00000000000..20844e3dbe9 --- /dev/null +++ b/queue-5.4/nvme-refactor-nvme_identify_ns_descs-error-handling.patch @@ -0,0 +1,77 @@ +From daf16d2167f86c4428b09714a9fe4a7900a8db12 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Mar 2020 14:19:35 +0100 +Subject: nvme: refactor nvme_identify_ns_descs error handling + +From: Christoph Hellwig + +[ Upstream commit fb314eb0cbb2e11540d1ae1a7b28346397f621ef ] + +Move the handling of an error into the function from the caller, and +only do it for an actual error on the admin command itself, not the +command parsing, as that should be enough to deal with devices claiming +a bogus version compliance. + +Signed-off-by: Christoph Hellwig +Signed-off-by: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 31b7dcd791c20..66147df86d883 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1071,8 +1071,17 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, + + status = nvme_submit_sync_cmd(ctrl->admin_q, &c, data, + NVME_IDENTIFY_DATA_SIZE); +- if (status) ++ if (status) { ++ dev_warn(ctrl->device, ++ "Identify Descriptors failed (%d)\n", status); ++ /* ++ * Don't treat an error as fatal, as we potentially already ++ * have a NGUID or EUI-64. ++ */ ++ if (status > 0) ++ status = 0; + goto free_data; ++ } + + for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE; pos += len) { + struct nvme_ns_id_desc *cur = data + pos; +@@ -1730,26 +1739,15 @@ static void nvme_config_write_zeroes(struct gendisk *disk, struct nvme_ns *ns) + static int nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid, + struct nvme_id_ns *id, struct nvme_ns_ids *ids) + { +- int ret = 0; +- + memset(ids, 0, sizeof(*ids)); + + if (ctrl->vs >= NVME_VS(1, 1, 0)) + memcpy(ids->eui64, id->eui64, sizeof(id->eui64)); + if (ctrl->vs >= NVME_VS(1, 2, 0)) + memcpy(ids->nguid, id->nguid, sizeof(id->nguid)); +- if (ctrl->vs >= NVME_VS(1, 3, 0)) { +- /* Don't treat error as fatal we potentially +- * already have a NGUID or EUI-64 +- */ +- ret = nvme_identify_ns_descs(ctrl, nsid, ids); +- if (ret) +- dev_warn(ctrl->device, +- "Identify Descriptors failed (%d)\n", ret); +- if (ret > 0) +- ret = 0; +- } +- return ret; ++ if (ctrl->vs >= NVME_VS(1, 3, 0)) ++ return nvme_identify_ns_descs(ctrl, nsid, ids); ++ return 0; + } + + static bool nvme_ns_ids_valid(struct nvme_ns_ids *ids) +-- +2.20.1 + diff --git a/queue-5.4/series b/queue-5.4/series index 396b83be1c6..dbc2516957f 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -1 +1,9 @@ usb-serial-qcserial-add-dw5816e-support.patch +nvme-refactor-nvme_identify_ns_descs-error-handling.patch +nvme-fix-possible-hang-when-ns-scanning-fails-during.patch +tracing-kprobes-fix-a-double-initialization-typo.patch +net-macb-fix-runtime-pm-refcounting.patch +drm-amdgpu-move-kfd-suspend-after-ip_suspend_phase1.patch +drm-amdgpu-drop-redundant-cg-pg-ungate-on-runpm-ente.patch +vt-fix-unicode-console-freeing-with-a-common-interfa.patch +tty-xilinx_uartps-fix-missing-id-assignment-to-the-c.patch diff --git a/queue-5.4/tracing-kprobes-fix-a-double-initialization-typo.patch b/queue-5.4/tracing-kprobes-fix-a-double-initialization-typo.patch new file mode 100644 index 00000000000..5445f0e8f78 --- /dev/null +++ b/queue-5.4/tracing-kprobes-fix-a-double-initialization-typo.patch @@ -0,0 +1,41 @@ +From b83c09dc708c27fef63a4bd85c69597cd70fbc5a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Apr 2020 14:49:09 +0900 +Subject: tracing/kprobes: Fix a double initialization typo + +From: Masami Hiramatsu + +[ Upstream commit dcbd21c9fca5e954fd4e3d91884907eb6d47187e ] + +Fix a typo that resulted in an unnecessary double +initialization to addr. + +Link: http://lkml.kernel.org/r/158779374968.6082.2337484008464939919.stgit@devnote2 + +Cc: Tom Zanussi +Cc: Ingo Molnar +Cc: stable@vger.kernel.org +Fixes: c7411a1a126f ("tracing/kprobe: Check whether the non-suffixed symbol is notrace") +Signed-off-by: Masami Hiramatsu +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Sasha Levin +--- + kernel/trace/trace_kprobe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c +index 2f0f7fcee73e6..fba4b48451f6c 100644 +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -454,7 +454,7 @@ static bool __within_notrace_func(unsigned long addr) + + static bool within_notrace_func(struct trace_kprobe *tk) + { +- unsigned long addr = addr = trace_kprobe_address(tk); ++ unsigned long addr = trace_kprobe_address(tk); + char symname[KSYM_NAME_LEN], *p; + + if (!__within_notrace_func(addr)) +-- +2.20.1 + diff --git a/queue-5.4/tty-xilinx_uartps-fix-missing-id-assignment-to-the-c.patch b/queue-5.4/tty-xilinx_uartps-fix-missing-id-assignment-to-the-c.patch new file mode 100644 index 00000000000..c2b73635cca --- /dev/null +++ b/queue-5.4/tty-xilinx_uartps-fix-missing-id-assignment-to-the-c.patch @@ -0,0 +1,44 @@ +From 40655c4562e3856243ff06842a32a07937269e9e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 May 2020 16:27:28 +0200 +Subject: tty: xilinx_uartps: Fix missing id assignment to the console + +From: Shubhrajyoti Datta + +[ Upstream commit 2ae11c46d5fdc46cb396e35911c713d271056d35 ] + +When serial console has been assigned to ttyPS1 (which is serial1 alias) +console index is not updated property and pointing to index -1 (statically +initialized) which ends up in situation where nothing has been printed on +the port. + +The commit 18cc7ac8a28e ("Revert "serial: uartps: Register own uart console +and driver structures"") didn't contain this line which was removed by +accident. + +Fixes: 18cc7ac8a28e ("Revert "serial: uartps: Register own uart console and driver structures"") +Signed-off-by: Shubhrajyoti Datta +Cc: stable +Signed-off-by: Michal Simek +Link: https://lore.kernel.org/r/ed3111533ef5bd342ee5ec504812240b870f0853.1588602446.git.michal.simek@xilinx.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/xilinx_uartps.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c +index fe098cf14e6a2..3cb9aacfe0b2a 100644 +--- a/drivers/tty/serial/xilinx_uartps.c ++++ b/drivers/tty/serial/xilinx_uartps.c +@@ -1445,6 +1445,7 @@ static int cdns_uart_probe(struct platform_device *pdev) + cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; + #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE + cdns_uart_uart_driver.cons = &cdns_uart_console; ++ cdns_uart_console.index = id; + #endif + + rc = uart_register_driver(&cdns_uart_uart_driver); +-- +2.20.1 + diff --git a/queue-5.4/vt-fix-unicode-console-freeing-with-a-common-interfa.patch b/queue-5.4/vt-fix-unicode-console-freeing-with-a-common-interfa.patch new file mode 100644 index 00000000000..f0a696101d6 --- /dev/null +++ b/queue-5.4/vt-fix-unicode-console-freeing-with-a-common-interfa.patch @@ -0,0 +1,62 @@ +From 2671fda29dcbc96296e94cc782bd7699653d3e9c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 2 May 2020 11:01:07 -0400 +Subject: vt: fix unicode console freeing with a common interface + +From: Nicolas Pitre + +[ Upstream commit 57d38f26d81e4275748b69372f31df545dcd9b71 ] + +By directly using kfree() in different places we risk missing one if +it is switched to using vfree(), especially if the corresponding +vmalloc() is hidden away within a common abstraction. + +Oh wait, that's exactly what happened here. + +So let's fix this by creating a common abstraction for the free case +as well. + +Signed-off-by: Nicolas Pitre +Reported-by: syzbot+0bfda3ade1ee9288a1be@syzkaller.appspotmail.com +Fixes: 9a98e7a80f95 ("vt: don't use kmalloc() for the unicode screen buffer") +Cc: +Reviewed-by: Sam Ravnborg +Link: https://lore.kernel.org/r/nycvar.YSQ.7.76.2005021043110.2671@knanqh.ubzr +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/vt/vt.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c +index 8b3ecef50394a..fd0361d72738b 100644 +--- a/drivers/tty/vt/vt.c ++++ b/drivers/tty/vt/vt.c +@@ -365,9 +365,14 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) + return uniscr; + } + ++static void vc_uniscr_free(struct uni_screen *uniscr) ++{ ++ vfree(uniscr); ++} ++ + static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr) + { +- vfree(vc->vc_uni_screen); ++ vc_uniscr_free(vc->vc_uni_screen); + vc->vc_uni_screen = new_uniscr; + } + +@@ -1230,7 +1235,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, + err = resize_screen(vc, new_cols, new_rows, user); + if (err) { + kfree(newscreen); +- kfree(new_uniscr); ++ vc_uniscr_free(new_uniscr); + return err; + } + +-- +2.20.1 + -- 2.47.3