diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:06:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:06:00 +0000 |
commit | b15a952c52a6825376d3e7f6c1bf5c886c6d8b74 (patch) | |
tree | 1500f2f8f276908a36d8126cb632c0d6b1276764 /debian/patches-rt/0051-mips-crashdump-Simplify-copy_oldmem_page.patch | |
parent | Adding upstream version 5.10.209. (diff) | |
download | linux-debian.tar.xz linux-debian.zip |
Adding debian version 5.10.209-2.debian/5.10.209-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0051-mips-crashdump-Simplify-copy_oldmem_page.patch')
-rw-r--r-- | debian/patches-rt/0051-mips-crashdump-Simplify-copy_oldmem_page.patch | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/debian/patches-rt/0051-mips-crashdump-Simplify-copy_oldmem_page.patch b/debian/patches-rt/0051-mips-crashdump-Simplify-copy_oldmem_page.patch new file mode 100644 index 000000000..837a4a04e --- /dev/null +++ b/debian/patches-rt/0051-mips-crashdump-Simplify-copy_oldmem_page.patch @@ -0,0 +1,95 @@ +From 1aeac707162ce43fc0ae9c45df5a8a4535de2332 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner <tglx@linutronix.de> +Date: Tue, 3 Nov 2020 10:27:40 +0100 +Subject: [PATCH 051/323] mips/crashdump: Simplify copy_oldmem_page() +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.10/older/patches-5.10.204-rt100.tar.xz + +Replace kmap_atomic_pfn() with kmap_local_pfn() which is preemptible and +can take page faults. + +Remove the indirection of the dump page and the related cruft which is not +longer required. + +Signed-off-by: Thomas Gleixner <tglx@linutronix.de> +Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> +Cc: linux-mips@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + arch/mips/kernel/crash_dump.c | 42 ++++++----------------------------- + 1 file changed, 7 insertions(+), 35 deletions(-) + +diff --git a/arch/mips/kernel/crash_dump.c b/arch/mips/kernel/crash_dump.c +index 01b2bd95ba1f..9aba83e1eeb4 100644 +--- a/arch/mips/kernel/crash_dump.c ++++ b/arch/mips/kernel/crash_dump.c +@@ -5,8 +5,6 @@ + #include <linux/uaccess.h> + #include <linux/slab.h> + +-static void *kdump_buf_page; +- + /** + * copy_oldmem_page - copy one page from "oldmem" + * @pfn: page frame number to be copied +@@ -17,51 +15,25 @@ static void *kdump_buf_page; + * @userbuf: if set, @buf is in user address space, use copy_to_user(), + * otherwise @buf is in kernel address space, use memcpy(). + * +- * Copy a page from "oldmem". For this page, there is no pte mapped ++ * Copy a page from "oldmem". For this page, there might be no pte mapped + * in the current kernel. +- * +- * Calling copy_to_user() in atomic context is not desirable. Hence first +- * copying the data to a pre-allocated kernel page and then copying to user +- * space in non-atomic context. + */ +-ssize_t copy_oldmem_page(unsigned long pfn, char *buf, +- size_t csize, unsigned long offset, int userbuf) ++ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, ++ unsigned long offset, int userbuf) + { + void *vaddr; + + if (!csize) + return 0; + +- vaddr = kmap_atomic_pfn(pfn); ++ vaddr = kmap_local_pfn(pfn); + + if (!userbuf) { +- memcpy(buf, (vaddr + offset), csize); +- kunmap_atomic(vaddr); ++ memcpy(buf, vaddr + offset, csize); + } else { +- if (!kdump_buf_page) { +- pr_warn("Kdump: Kdump buffer page not allocated\n"); +- +- return -EFAULT; +- } +- copy_page(kdump_buf_page, vaddr); +- kunmap_atomic(vaddr); +- if (copy_to_user(buf, (kdump_buf_page + offset), csize)) +- return -EFAULT; ++ if (copy_to_user(buf, vaddr + offset, csize)) ++ csize = -EFAULT; + } + + return csize; + } +- +-static int __init kdump_buf_page_init(void) +-{ +- int ret = 0; +- +- kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL); +- if (!kdump_buf_page) { +- pr_warn("Kdump: Failed to allocate kdump buffer page\n"); +- ret = -ENOMEM; +- } +- +- return ret; +-} +-arch_initcall(kdump_buf_page_init); +-- +2.43.0 + |