From 118953c341f406b73735424632f325c2382a6c1f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 9 Jul 2023 11:35:44 +0200 Subject: [PATCH] 6.3-stable patches added patches: bootmem-remove-the-vmemmap-pages-from-kmemleak-in-free_bootmem_page.patch mm-call-arch_swap_restore-from-do_swap_page.patch --- ...s-from-kmemleak-in-free_bootmem_page.patch | 49 +++++++++++++++++++ ...explicitly-specify-update-type-per-p.patch | 9 +--- ...-arch_swap_restore-from-do_swap_page.patch | 48 ++++++++++++++++++ queue-6.3/series | 2 + 4 files changed, 101 insertions(+), 7 deletions(-) create mode 100644 queue-6.3/bootmem-remove-the-vmemmap-pages-from-kmemleak-in-free_bootmem_page.patch create mode 100644 queue-6.3/mm-call-arch_swap_restore-from-do_swap_page.patch diff --git a/queue-6.3/bootmem-remove-the-vmemmap-pages-from-kmemleak-in-free_bootmem_page.patch b/queue-6.3/bootmem-remove-the-vmemmap-pages-from-kmemleak-in-free_bootmem_page.patch new file mode 100644 index 00000000000..4c7b000f9ed --- /dev/null +++ b/queue-6.3/bootmem-remove-the-vmemmap-pages-from-kmemleak-in-free_bootmem_page.patch @@ -0,0 +1,49 @@ +From 028725e73375a1ff080bbdf9fb503306d0116f28 Mon Sep 17 00:00:00 2001 +From: Liu Shixin +Date: Tue, 4 Jul 2023 18:19:42 +0800 +Subject: bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page + +From: Liu Shixin + +commit 028725e73375a1ff080bbdf9fb503306d0116f28 upstream. + +commit dd0ff4d12dd2 ("bootmem: remove the vmemmap pages from kmemleak in +put_page_bootmem") fix an overlaps existing problem of kmemleak. But the +problem still existed when HAVE_BOOTMEM_INFO_NODE is disabled, because in +this case, free_bootmem_page() will call free_reserved_page() directly. + +Fix the problem by adding kmemleak_free_part() in free_bootmem_page() when +HAVE_BOOTMEM_INFO_NODE is disabled. + +Link: https://lkml.kernel.org/r/20230704101942.2819426-1-liushixin2@huawei.com +Fixes: f41f2ed43ca5 ("mm: hugetlb: free the vmemmap pages associated with each HugeTLB page") +Signed-off-by: Liu Shixin +Acked-by: Muchun Song +Cc: Matthew Wilcox +Cc: Mike Kravetz +Cc: Oscar Salvador +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/bootmem_info.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/include/linux/bootmem_info.h ++++ b/include/linux/bootmem_info.h +@@ -3,6 +3,7 @@ + #define __LINUX_BOOTMEM_INFO_H + + #include ++#include + + /* + * Types for free bootmem stored in page->lru.next. These have to be in +@@ -59,6 +60,7 @@ static inline void get_page_bootmem(unsi + + static inline void free_bootmem_page(struct page *page) + { ++ kmemleak_free_part(page_to_virt(page), PAGE_SIZE); + free_reserved_page(page); + } + #endif diff --git a/queue-6.3/drm-amd-display-explicitly-specify-update-type-per-p.patch b/queue-6.3/drm-amd-display-explicitly-specify-update-type-per-p.patch index 38f04ac9b09..bc4ee94a5b3 100644 --- a/queue-6.3/drm-amd-display-explicitly-specify-update-type-per-p.patch +++ b/queue-6.3/drm-amd-display-explicitly-specify-update-type-per-p.patch @@ -27,14 +27,12 @@ Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- - drivers/gpu/drm/amd/display/dc/core/dc.c | 3 --- + drivers/gpu/drm/amd/display/dc/core/dc.c | 3 --- 1 file changed, 3 deletions(-) -diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c -index 9ec0a343efadb..e6e26fe1be0f8 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c -@@ -2540,9 +2540,6 @@ static enum surface_update_type det_surface_update(const struct dc *dc, +@@ -2526,9 +2526,6 @@ static enum surface_update_type det_surf enum surface_update_type overall_type = UPDATE_TYPE_FAST; union surface_update_flags *update_flags = &u->surface->update_flags; @@ -44,6 +42,3 @@ index 9ec0a343efadb..e6e26fe1be0f8 100644 if (!is_surface_in_context(context, u->surface) || u->surface->force_full_update) { update_flags->raw = 0xFFFFFFFF; return UPDATE_TYPE_FULL; --- -2.39.2 - diff --git a/queue-6.3/mm-call-arch_swap_restore-from-do_swap_page.patch b/queue-6.3/mm-call-arch_swap_restore-from-do_swap_page.patch new file mode 100644 index 00000000000..1c5b4c38ac1 --- /dev/null +++ b/queue-6.3/mm-call-arch_swap_restore-from-do_swap_page.patch @@ -0,0 +1,48 @@ +From 6dca4ac6fc91fd41ea4d6c4511838d37f4e0eab2 Mon Sep 17 00:00:00 2001 +From: Peter Collingbourne +Date: Mon, 22 May 2023 17:43:08 -0700 +Subject: mm: call arch_swap_restore() from do_swap_page() + +From: Peter Collingbourne + +commit 6dca4ac6fc91fd41ea4d6c4511838d37f4e0eab2 upstream. + +Commit c145e0b47c77 ("mm: streamline COW logic in do_swap_page()") moved +the call to swap_free() before the call to set_pte_at(), which meant that +the MTE tags could end up being freed before set_pte_at() had a chance to +restore them. Fix it by adding a call to the arch_swap_restore() hook +before the call to swap_free(). + +Link: https://lkml.kernel.org/r/20230523004312.1807357-2-pcc@google.com +Link: https://linux-review.googlesource.com/id/I6470efa669e8bd2f841049b8c61020c510678965 +Fixes: c145e0b47c77 ("mm: streamline COW logic in do_swap_page()") +Signed-off-by: Peter Collingbourne +Reported-by: Qun-wei Lin +Closes: https://lore.kernel.org/all/5050805753ac469e8d727c797c2218a9d780d434.camel@mediatek.com/ +Acked-by: David Hildenbrand +Acked-by: "Huang, Ying" +Reviewed-by: Steven Price +Acked-by: Catalin Marinas +Cc: [6.1+] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/memory.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -3915,6 +3915,13 @@ vm_fault_t do_swap_page(struct vm_fault + } + + /* ++ * Some architectures may have to restore extra metadata to the page ++ * when reading from swap. This metadata may be indexed by swap entry ++ * so this must be called before swap_free(). ++ */ ++ arch_swap_restore(entry, folio); ++ ++ /* + * Remove the swap entry and conditionally try to free up the swapcache. + * We're already holding a reference on the page but haven't mapped it + * yet. diff --git a/queue-6.3/series b/queue-6.3/series index 1b6fd0470fb..e7ac03cee96 100644 --- a/queue-6.3/series +++ b/queue-6.3/series @@ -1,3 +1,4 @@ +mm-call-arch_swap_restore-from-do_swap_page.patch drm-use-mgr-dev-in-drm_dbg_kms-in-drm_dp_add_payload_part2.patch fs-pipe-reveal-missing-function-protoypes.patch block-fix-the-type-of-the-second-bdev_op_is_zoned_wr.patch @@ -163,6 +164,7 @@ drm-amd-display-add-logging-for-display-mall-refresh.patch drm-amd-display-fix-is_timing_changed-prototype.patch radeon-avoid-double-free-in-ci_dpm_init.patch drm-amd-display-explicitly-specify-update-type-per-p.patch +bootmem-remove-the-vmemmap-pages-from-kmemleak-in-free_bootmem_page.patch drm-i915-guc-more-debug-print-updates-guc-slpc.patch drm-i915-guc-slpc-provide-sysfs-for-efficient-freq.patch drm-bridge-it6505-move-a-variable-assignment-behind-.patch -- 2.47.3