]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Thu, 16 Apr 2020 12:44:22 +0000 (08:44 -0400)
committerSasha Levin <sashal@kernel.org>
Thu, 16 Apr 2020 12:44:22 +0000 (08:44 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch [new file with mode: 0644]
queue-4.9/drm-remove-pagereserved-manipulation-from-drm_pci_al.patch [new file with mode: 0644]
queue-4.9/ipmi-fix-hung-processes-in-__get_guid.patch [new file with mode: 0644]
queue-4.9/misc-echo-remove-unnecessary-parentheses-and-simplif.patch [new file with mode: 0644]
queue-4.9/powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch b/queue-4.9/drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch
new file mode 100644 (file)
index 0000000..b1f6b63
--- /dev/null
@@ -0,0 +1,94 @@
+From 09275be6b0f118001c03f401cbfb0de66828d522 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 Jan 2020 14:43:20 -0500
+Subject: drm/dp_mst: Fix clearing payload state on topology disable
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Lyude Paul <lyude@redhat.com>
+
+[ Upstream commit 8732fe46b20c951493bfc4dba0ad08efdf41de81 ]
+
+The issues caused by:
+
+commit 64e62bdf04ab ("drm/dp_mst: Remove VCPI while disabling topology
+mgr")
+
+Prompted me to take a closer look at how we clear the payload state in
+general when disabling the topology, and it turns out there's actually
+two subtle issues here.
+
+The first is that we're not grabbing &mgr.payload_lock when clearing the
+payloads in drm_dp_mst_topology_mgr_set_mst(). Seeing as the canonical
+lock order is &mgr.payload_lock -> &mgr.lock (because we always want
+&mgr.lock to be the inner-most lock so topology validation always
+works), this makes perfect sense. It also means that -technically- there
+could be racing between someone calling
+drm_dp_mst_topology_mgr_set_mst() to disable the topology, along with a
+modeset occurring that's modifying the payload state at the same time.
+
+The second is the more obvious issue that Wayne Lin discovered, that
+we're not clearing proposed_payloads when disabling the topology.
+
+I actually can't see any obvious places where the racing caused by the
+first issue would break something, and it could be that some of our
+higher-level locks already prevent this by happenstance, but better safe
+then sorry. So, let's make it so that drm_dp_mst_topology_mgr_set_mst()
+first grabs &mgr.payload_lock followed by &mgr.lock so that we never
+race when modifying the payload state. Then, we also clear
+proposed_payloads to fix the original issue of enabling a new topology
+with a dirty payload state. This doesn't clear any of the drm_dp_vcpi
+structures, but those are getting destroyed along with the ports anyway.
+
+Changes since v1:
+* Use sizeof(mgr->payloads[0])/sizeof(mgr->proposed_vcpis[0]) instead -
+  vsyrjala
+
+Cc: Sean Paul <sean@poorly.run>
+Cc: Wayne Lin <Wayne.Lin@amd.com>
+Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Cc: stable@vger.kernel.org # v4.4+
+Signed-off-by: Lyude Paul <lyude@redhat.com>
+Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20200122194321.14953-1-lyude@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
+index 592ebcd440b6d..8dbcb498d56c3 100644
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c
+@@ -2034,6 +2034,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
+       int ret = 0;
+       struct drm_dp_mst_branch *mstb = NULL;
++      mutex_lock(&mgr->payload_lock);
+       mutex_lock(&mgr->lock);
+       if (mst_state == mgr->mst_state)
+               goto out_unlock;
+@@ -2096,7 +2097,10 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
+               /* this can fail if the device is gone */
+               drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
+               ret = 0;
+-              memset(mgr->payloads, 0, mgr->max_payloads * sizeof(struct drm_dp_payload));
++              memset(mgr->payloads, 0,
++                     mgr->max_payloads * sizeof(mgr->payloads[0]));
++              memset(mgr->proposed_vcpis, 0,
++                     mgr->max_payloads * sizeof(mgr->proposed_vcpis[0]));
+               mgr->payload_mask = 0;
+               set_bit(0, &mgr->payload_mask);
+               mgr->vcpi_mask = 0;
+@@ -2104,6 +2108,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
+ out_unlock:
+       mutex_unlock(&mgr->lock);
++      mutex_unlock(&mgr->payload_lock);
+       if (mstb)
+               drm_dp_put_mst_branch_device(mstb);
+       return ret;
+-- 
+2.20.1
+
diff --git a/queue-4.9/drm-remove-pagereserved-manipulation-from-drm_pci_al.patch b/queue-4.9/drm-remove-pagereserved-manipulation-from-drm_pci_al.patch
new file mode 100644 (file)
index 0000000..0812e74
--- /dev/null
@@ -0,0 +1,98 @@
+From b5c91db1102d7b45bfdeb585bbf030280cd43737 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 2 Feb 2020 17:16:31 +0000
+Subject: drm: Remove PageReserved manipulation from drm_pci_alloc
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+[ Upstream commit ea36ec8623f56791c6ff6738d0509b7920f85220 ]
+
+drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma
+facilities, and we have no special reason within the drm layer to behave
+differently. In particular, since
+
+commit de09d31dd38a50fdce106c15abd68432eebbd014
+Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
+Date:   Fri Jan 15 16:51:42 2016 -0800
+
+    page-flags: define PG_reserved behavior on compound pages
+
+    As far as I can see there's no users of PG_reserved on compound pages.
+    Let's use PF_NO_COMPOUND here.
+
+it has been illegal to combine GFP_COMP with SetPageReserved, so lets
+stop doing both and leave the dma layer to its own devices.
+
+Reported-by: Taketo Kabe
+Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027
+Fixes: de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: <stable@vger.kernel.org> # v4.5+
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_pci.c | 25 ++-----------------------
+ 1 file changed, 2 insertions(+), 23 deletions(-)
+
+diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
+index 3ceea9cb9d3e4..d5de4dd19701b 100644
+--- a/drivers/gpu/drm/drm_pci.c
++++ b/drivers/gpu/drm/drm_pci.c
+@@ -42,8 +42,6 @@
+ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
+ {
+       drm_dma_handle_t *dmah;
+-      unsigned long addr;
+-      size_t sz;
+       /* pci_alloc_consistent only guarantees alignment to the smallest
+        * PAGE_SIZE order which is greater than or equal to the requested size.
+@@ -57,22 +55,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
+               return NULL;
+       dmah->size = size;
+-      dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL | __GFP_COMP);
++      dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL);
+       if (dmah->vaddr == NULL) {
+               kfree(dmah);
+               return NULL;
+       }
+-      memset(dmah->vaddr, 0, size);
+-
+-      /* XXX - Is virt_to_page() legal for consistent mem? */
+-      /* Reserve */
+-      for (addr = (unsigned long)dmah->vaddr, sz = size;
+-           sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+-              SetPageReserved(virt_to_page((void *)addr));
+-      }
+-
+       return dmah;
+ }
+@@ -85,19 +74,9 @@ EXPORT_SYMBOL(drm_pci_alloc);
+  */
+ void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
+ {
+-      unsigned long addr;
+-      size_t sz;
+-
+-      if (dmah->vaddr) {
+-              /* XXX - Is virt_to_page() legal for consistent mem? */
+-              /* Unreserve */
+-              for (addr = (unsigned long)dmah->vaddr, sz = dmah->size;
+-                   sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+-                      ClearPageReserved(virt_to_page((void *)addr));
+-              }
++      if (dmah->vaddr)
+               dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr,
+                                 dmah->busaddr);
+-      }
+ }
+ /**
+-- 
+2.20.1
+
diff --git a/queue-4.9/ipmi-fix-hung-processes-in-__get_guid.patch b/queue-4.9/ipmi-fix-hung-processes-in-__get_guid.patch
new file mode 100644 (file)
index 0000000..e860fd6
--- /dev/null
@@ -0,0 +1,72 @@
+From aecb6fd808e34d071628009f9640ce3509aef5d6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 3 Apr 2020 17:04:08 +0800
+Subject: ipmi: fix hung processes in __get_guid()
+
+From: Wen Yang <wenyang@linux.alibaba.com>
+
+[ Upstream commit 32830a0534700f86366f371b150b17f0f0d140d7 ]
+
+The wait_event() function is used to detect command completion.
+When send_guid_cmd() returns an error, smi_send() has not been
+called to send data. Therefore, wait_event() should not be used
+on the error path, otherwise it will cause the following warning:
+
+[ 1361.588808] systemd-udevd   D    0  1501   1436 0x00000004
+[ 1361.588813]  ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40
+[ 1361.677952]  ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010
+[ 1361.767077]  00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000
+[ 1361.856199] Call Trace:
+[ 1361.885578]  [<ffffffff8173ca3b>] ? __schedule+0x23b/0x780
+[ 1361.951406]  [<ffffffff8173cfb6>] schedule+0x36/0x80
+[ 1362.010979]  [<ffffffffa071f178>] get_guid+0x118/0x150 [ipmi_msghandler]
+[ 1362.091281]  [<ffffffff810d5350>] ? prepare_to_wait_event+0x100/0x100
+[ 1362.168533]  [<ffffffffa071f755>] ipmi_register_smi+0x405/0x940 [ipmi_msghandler]
+[ 1362.258337]  [<ffffffffa0230ae9>] try_smi_init+0x529/0x950 [ipmi_si]
+[ 1362.334521]  [<ffffffffa022f350>] ? std_irq_setup+0xd0/0xd0 [ipmi_si]
+[ 1362.411701]  [<ffffffffa0232bd2>] init_ipmi_si+0x492/0x9e0 [ipmi_si]
+[ 1362.487917]  [<ffffffffa0232740>] ? ipmi_pci_probe+0x280/0x280 [ipmi_si]
+[ 1362.568219]  [<ffffffff810021a0>] do_one_initcall+0x50/0x180
+[ 1362.636109]  [<ffffffff812231b2>] ? kmem_cache_alloc_trace+0x142/0x190
+[ 1362.714330]  [<ffffffff811b2ae1>] do_init_module+0x5f/0x200
+[ 1362.781208]  [<ffffffff81123ca8>] load_module+0x1898/0x1de0
+[ 1362.848069]  [<ffffffff811202e0>] ? __symbol_put+0x60/0x60
+[ 1362.913886]  [<ffffffff8130696b>] ? security_kernel_post_read_file+0x6b/0x80
+[ 1362.998514]  [<ffffffff81124465>] SYSC_finit_module+0xe5/0x120
+[ 1363.068463]  [<ffffffff81124465>] ? SYSC_finit_module+0xe5/0x120
+[ 1363.140513]  [<ffffffff811244be>] SyS_finit_module+0xe/0x10
+[ 1363.207364]  [<ffffffff81003c04>] do_syscall_64+0x74/0x180
+
+Fixes: 50c812b2b951 ("[PATCH] ipmi: add full sysfs support")
+Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
+Cc: Corey Minyard <minyard@acm.org>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: openipmi-developer@lists.sourceforge.net
+Cc: linux-kernel@vger.kernel.org
+Cc: stable@vger.kernel.org # 2.6.17-
+Message-Id: <20200403090408.58745-1-wenyang@linux.alibaba.com>
+Signed-off-by: Corey Minyard <cminyard@mvista.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/ipmi/ipmi_msghandler.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
+index 5d509ccf1299c..74044b52d2c6d 100644
+--- a/drivers/char/ipmi/ipmi_msghandler.c
++++ b/drivers/char/ipmi/ipmi_msghandler.c
+@@ -2646,7 +2646,9 @@ get_guid(ipmi_smi_t intf)
+       if (rv)
+               /* Send failed, no GUID available. */
+               intf->bmc->guid_set = 0;
+-      wait_event(intf->waitq, intf->bmc->guid_set != 2);
++      else
++              wait_event(intf->waitq, intf->bmc->guid_set != 2);
++
+       intf->null_user_handler = NULL;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.9/misc-echo-remove-unnecessary-parentheses-and-simplif.patch b/queue-4.9/misc-echo-remove-unnecessary-parentheses-and-simplif.patch
new file mode 100644 (file)
index 0000000..4043141
--- /dev/null
@@ -0,0 +1,56 @@
+From 5c35660d38630f26766c5f23fbe40344c6dbdb1b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Sep 2018 23:43:37 -0700
+Subject: misc: echo: Remove unnecessary parentheses and simplify check for
+ zero
+
+From: Nathan Chancellor <natechancellor@gmail.com>
+
+[ Upstream commit 85dc2c65e6c975baaf36ea30f2ccc0a36a8c8add ]
+
+Clang warns when multiple pairs of parentheses are used for a single
+conditional statement.
+
+drivers/misc/echo/echo.c:384:27: warning: equality comparison with
+extraneous parentheses [-Wparentheses-equality]
+        if ((ec->nonupdate_dwell == 0)) {
+             ~~~~~~~~~~~~~~~~~~~~^~~~
+drivers/misc/echo/echo.c:384:27: note: remove extraneous parentheses
+around the comparison to silence this warning
+        if ((ec->nonupdate_dwell == 0)) {
+            ~                    ^   ~
+drivers/misc/echo/echo.c:384:27: note: use '=' to turn this equality
+comparison into an assignment
+        if ((ec->nonupdate_dwell == 0)) {
+                                 ^~
+                                 =
+1 warning generated.
+
+Remove them and while we're at it, simplify the zero check as '!var' is
+used more than 'var == 0'.
+
+Reported-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/echo/echo.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/misc/echo/echo.c b/drivers/misc/echo/echo.c
+index 9597e9523cac4..fff13176f9b8b 100644
+--- a/drivers/misc/echo/echo.c
++++ b/drivers/misc/echo/echo.c
+@@ -454,7 +454,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
+        */
+       ec->factor = 0;
+       ec->shift = 0;
+-      if ((ec->nonupdate_dwell == 0)) {
++      if (!ec->nonupdate_dwell) {
+               int p, logp, shift;
+               /* Determine:
+-- 
+2.20.1
+
diff --git a/queue-4.9/powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch b/queue-4.9/powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch
new file mode 100644 (file)
index 0000000..7ce8d8a
--- /dev/null
@@ -0,0 +1,80 @@
+From e61532cf6c9721037c1be64ec64c4ea13888a954 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 23 Jan 2020 11:19:25 +0000
+Subject: powerpc/fsl_booke: Avoid creating duplicate tlb1 entry
+
+From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
+
+[ Upstream commit aa4113340ae6c2811e046f08c2bc21011d20a072 ]
+
+In the current implementation, the call to loadcam_multi() is wrapped
+between switch_to_as1() and restore_to_as0() calls so, when it tries
+to create its own temporary AS=1 TLB1 entry, it ends up duplicating
+the existing one created by switch_to_as1(). Add a check to skip
+creating the temporary entry if already running in AS=1.
+
+Fixes: d9e1831a4202 ("powerpc/85xx: Load all early TLB entries at once")
+Cc: stable@vger.kernel.org # v4.4+
+Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
+Acked-by: Scott Wood <oss@buserror.net>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20200123111914.2565-1-laurentiu.tudor@nxp.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/mm/tlb_nohash_low.S | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S
+index eabecfcaef7cf..204b4d9c44248 100644
+--- a/arch/powerpc/mm/tlb_nohash_low.S
++++ b/arch/powerpc/mm/tlb_nohash_low.S
+@@ -400,7 +400,7 @@ _GLOBAL(set_context)
+  * extern void loadcam_entry(unsigned int index)
+  *
+  * Load TLBCAM[index] entry in to the L2 CAM MMU
+- * Must preserve r7, r8, r9, and r10
++ * Must preserve r7, r8, r9, r10 and r11
+  */
+ _GLOBAL(loadcam_entry)
+       mflr    r5
+@@ -436,6 +436,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
+  */
+ _GLOBAL(loadcam_multi)
+       mflr    r8
++      /* Don't switch to AS=1 if already there */
++      mfmsr   r11
++      andi.   r11,r11,MSR_IS
++      bne     10f
+       /*
+        * Set up temporary TLB entry that is the same as what we're
+@@ -461,6 +465,7 @@ _GLOBAL(loadcam_multi)
+       mtmsr   r6
+       isync
++10:
+       mr      r9,r3
+       add     r10,r3,r4
+ 2:    bl      loadcam_entry
+@@ -469,6 +474,10 @@ _GLOBAL(loadcam_multi)
+       mr      r3,r9
+       blt     2b
++      /* Don't return to AS=0 if we were in AS=1 at function start */
++      andi.   r11,r11,MSR_IS
++      bne     3f
++
+       /* Return to AS=0 and clear the temporary entry */
+       mfmsr   r6
+       rlwinm. r6,r6,0,~(MSR_IS|MSR_DS)
+@@ -484,6 +493,7 @@ _GLOBAL(loadcam_multi)
+       tlbwe
+       isync
++3:
+       mtlr    r8
+       blr
+ #endif
+-- 
+2.20.1
+
index b8d08c11d148b24733ac28ca18336fca8397381c..720dd2bb2ce85d2e8ab42cc573ce66f13507a6e7 100644 (file)
@@ -57,3 +57,8 @@ hfsplus-fix-crash-and-filesystem-corruption-when-deleting-files.patch
 libata-return-correct-status-in-sata_pmp_eh_recover_pm-when-ata_dflag_detach-is-set.patch
 powerpc-64-tm-don-t-let-userspace-set-regs-trap-via-sigreturn.patch
 btrfs-fix-crash-during-unmount-due-to-race-with-dela.patch
+drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch
+drm-remove-pagereserved-manipulation-from-drm_pci_al.patch
+ipmi-fix-hung-processes-in-__get_guid.patch
+powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch
+misc-echo-remove-unnecessary-parentheses-and-simplif.patch