]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Mar 2024 09:20:29 +0000 (10:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Mar 2024 09:20:29 +0000 (10:20 +0100)
added patches:
mm-memory-failure-fix-an-incorrect-use-of-tail-pages.patch
mm-migrate-set-swap-entry-values-of-thp-tail-pages-properly.patch
serial-sc16is7xx-convert-from-_raw_-to-_noinc_-regmap-functions-for-fifo.patch

queue-5.10/mm-memory-failure-fix-an-incorrect-use-of-tail-pages.patch [new file with mode: 0644]
queue-5.10/mm-migrate-set-swap-entry-values-of-thp-tail-pages-properly.patch [new file with mode: 0644]
queue-5.10/serial-sc16is7xx-convert-from-_raw_-to-_noinc_-regmap-functions-for-fifo.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/mm-memory-failure-fix-an-incorrect-use-of-tail-pages.patch b/queue-5.10/mm-memory-failure-fix-an-incorrect-use-of-tail-pages.patch
new file mode 100644 (file)
index 0000000..3b3876b
--- /dev/null
@@ -0,0 +1,35 @@
+From liushixin2@huawei.com  Sat Mar 30 10:10:31 2024
+From: Liu Shixin <liushixin2@huawei.com>
+Date: Thu, 7 Mar 2024 20:48:41 +0800
+Subject: mm/memory-failure: fix an incorrect use of tail pages
+To: Matthew Wilcox <willy@infradead.org>, Andrew Morton <akpm@linux-foundation.org>, Sasha Levin <sashal@kernel.org>, Dan Williams <dan.j.williams@intel.com>, Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <stable@vger.kernel.org>, Liu Shixin <liushixin2@huawei.com>
+Message-ID: <20240307124841.2838010-1-liushixin2@huawei.com>
+
+From: Liu Shixin <liushixin2@huawei.com>
+
+When backport commit c79c5a0a00a9 to 5.10-stable, there is a mistake change.
+The head page instead of tail page should be passed to try_to_unmap(),
+otherwise unmap will failed as follows.
+
+ Memory failure: 0x121c10: failed to unmap page (mapcount=1)
+ Memory failure: 0x121c10: recovery action for unmapping failed page: Ignored
+
+Fixes: 70168fdc743b ("mm/memory-failure: check the mapcount of the precise page")
+Signed-off-by: Liu Shixin <liushixin2@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/memory-failure.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/memory-failure.c
++++ b/mm/memory-failure.c
+@@ -1075,7 +1075,7 @@ static bool hwpoison_user_mappings(struc
+                               unmap_success = false;
+                       }
+               } else {
+-                      unmap_success = try_to_unmap(p, ttu);
++                      unmap_success = try_to_unmap(hpage, ttu);
+               }
+       }
+       if (!unmap_success)
diff --git a/queue-5.10/mm-migrate-set-swap-entry-values-of-thp-tail-pages-properly.patch b/queue-5.10/mm-migrate-set-swap-entry-values-of-thp-tail-pages-properly.patch
new file mode 100644 (file)
index 0000000..3a74cd5
--- /dev/null
@@ -0,0 +1,55 @@
+From stable+bounces-26999-greg=kroah.com@vger.kernel.org Wed Mar  6 16:51:44 2024
+From: Zi Yan <zi.yan@sent.com>
+Date: Wed,  6 Mar 2024 10:51:35 -0500
+Subject: mm/migrate: set swap entry values of THP tail pages properly.
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Zi Yan <ziy@nvidia.com>, linux-mm@kvack.org, Charan Teja Kalla <quic_charante@quicinc.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Huang Ying <ying.huang@intel.com>, Naoya Horiguchi <naoya.horiguchi@linux.dev>
+Message-ID: <20240306155135.118231-1-zi.yan@sent.com>
+
+From: Zi Yan <ziy@nvidia.com>
+
+The tail pages in a THP can have swap entry information stored in their
+private field. When migrating to a new page, all tail pages of the new
+page need to update ->private to avoid future data corruption.
+
+This fix is stable-only, since after commit 07e09c483cbe ("mm/huge_memory:
+work on folio->swap instead of page->private when splitting folio"),
+subpages of a swapcached THP no longer requires the maintenance.
+
+Adding THPs to the swapcache was introduced in commit
+38d8b4e6bdc87 ("mm, THP, swap: delay splitting THP during swap out"),
+where each subpage of a THP added to the swapcache had its own swapcache
+entry and required the ->private field to point to the correct swapcache
+entry. Later, when THP migration functionality was implemented in commit
+616b8371539a6 ("mm: thp: enable thp migration in generic path"),
+it initially did not handle the subpages of swapcached THPs, failing to
+update their ->private fields or replace the subpage pointers in the
+swapcache. Subsequently, commit e71769ae5260 ("mm: enable thp migration
+for shmem thp") addressed the swapcache update aspect. This patch fixes
+the update of subpage ->private fields.
+
+Closes: https://lore.kernel.org/linux-mm/1707814102-22682-1-git-send-email-quic_charante@quicinc.com/
+Fixes: 616b8371539a ("mm: thp: enable thp migration in generic path")
+Signed-off-by: Zi Yan <ziy@nvidia.com>
+Acked-by: David Hildenbrand <david@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/migrate.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/mm/migrate.c
++++ b/mm/migrate.c
+@@ -447,8 +447,12 @@ int migrate_page_move_mapping(struct add
+       if (PageSwapBacked(page)) {
+               __SetPageSwapBacked(newpage);
+               if (PageSwapCache(page)) {
++                      int i;
++
+                       SetPageSwapCache(newpage);
+-                      set_page_private(newpage, page_private(page));
++                      for (i = 0; i < (1 << compound_order(page)); i++)
++                              set_page_private(newpage + i,
++                                               page_private(page + i));
+               }
+       } else {
+               VM_BUG_ON_PAGE(PageSwapCache(page), page);
diff --git a/queue-5.10/serial-sc16is7xx-convert-from-_raw_-to-_noinc_-regmap-functions-for-fifo.patch b/queue-5.10/serial-sc16is7xx-convert-from-_raw_-to-_noinc_-regmap-functions-for-fifo.patch
new file mode 100644 (file)
index 0000000..7b8c925
--- /dev/null
@@ -0,0 +1,83 @@
+From dbf4ab821804df071c8b566d9813083125e6d97b Mon Sep 17 00:00:00 2001
+From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+Date: Mon, 11 Dec 2023 12:13:52 -0500
+Subject: serial: sc16is7xx: convert from _raw_ to _noinc_ regmap functions for FIFO
+
+From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+
+commit dbf4ab821804df071c8b566d9813083125e6d97b upstream.
+
+The SC16IS7XX IC supports a burst mode to access the FIFOs where the
+initial register address is sent ($00), followed by all the FIFO data
+without having to resend the register address each time. In this mode, the
+IC doesn't increment the register address for each R/W byte.
+
+The regmap_raw_read() and regmap_raw_write() are functions which can
+perform IO over multiple registers. They are currently used to read/write
+from/to the FIFO, and although they operate correctly in this burst mode on
+the SPI bus, they would corrupt the regmap cache if it was not disabled
+manually. The reason is that when the R/W size is more than 1 byte, these
+functions assume that the register address is incremented and handle the
+cache accordingly.
+
+Convert FIFO R/W functions to use the regmap _noinc_ versions in order to
+remove the manual cache control which was a workaround when using the
+_raw_ versions. FIFO registers are properly declared as volatile so
+cache will not be used/updated for FIFO accesses.
+
+Fixes: dfeae619d781 ("serial: sc16is7xx")
+Cc:  <stable@vger.kernel.org>
+Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+Link: https://lore.kernel.org/r/20231211171353.2901416-6-hugo@hugovil.com
+Cc: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/sc16is7xx.c |   15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+--- a/drivers/tty/serial/sc16is7xx.c
++++ b/drivers/tty/serial/sc16is7xx.c
+@@ -376,9 +376,7 @@ static void sc16is7xx_fifo_read(struct u
+       const u8 line = sc16is7xx_line(port);
+       u8 addr = (SC16IS7XX_RHR_REG << SC16IS7XX_REG_SHIFT) | line;
+-      regcache_cache_bypass(s->regmap, true);
+-      regmap_raw_read(s->regmap, addr, s->buf, rxlen);
+-      regcache_cache_bypass(s->regmap, false);
++      regmap_noinc_read(s->regmap, addr, s->buf, rxlen);
+ }
+ static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send)
+@@ -394,9 +392,7 @@ static void sc16is7xx_fifo_write(struct
+       if (unlikely(!to_send))
+               return;
+-      regcache_cache_bypass(s->regmap, true);
+-      regmap_raw_write(s->regmap, addr, s->buf, to_send);
+-      regcache_cache_bypass(s->regmap, false);
++      regmap_noinc_write(s->regmap, addr, s->buf, to_send);
+ }
+ static void sc16is7xx_port_update(struct uart_port *port, u8 reg,
+@@ -489,6 +485,11 @@ static bool sc16is7xx_regmap_precious(st
+       return false;
+ }
++static bool sc16is7xx_regmap_noinc(struct device *dev, unsigned int reg)
++{
++      return reg == SC16IS7XX_RHR_REG;
++}
++
+ static int sc16is7xx_set_baud(struct uart_port *port, int baud)
+ {
+       struct sc16is7xx_port *s = dev_get_drvdata(port->dev);
+@@ -1439,6 +1440,8 @@ static struct regmap_config regcfg = {
+       .cache_type = REGCACHE_RBTREE,
+       .volatile_reg = sc16is7xx_regmap_volatile,
+       .precious_reg = sc16is7xx_regmap_precious,
++      .writeable_noinc_reg = sc16is7xx_regmap_noinc,
++      .readable_noinc_reg = sc16is7xx_regmap_noinc,
+ };
+ #ifdef CONFIG_SERIAL_SC16IS7XX_SPI
index 07125ae5b335f271f99c92b64891360990d85295..891980b0f6ad13a39992f2aa5b4cc707d760883f 100644 (file)
@@ -149,3 +149,6 @@ kvm-x86-export-rfds_no-and-rfds_clear-to-guests.patch
 perf-core-fix-reentry-problem-in-perf_output_read_group.patch
 efivarfs-request-at-most-512-bytes-for-variable-names.patch
 powerpc-xor_vmx-add-mhard-float-to-cflags.patch
+serial-sc16is7xx-convert-from-_raw_-to-_noinc_-regmap-functions-for-fifo.patch
+mm-memory-failure-fix-an-incorrect-use-of-tail-pages.patch
+mm-migrate-set-swap-entry-values-of-thp-tail-pages-properly.patch