summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:49:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:49:59 +0000
commit01997497f915e8f79871f3f2acb55ac465051d24 (patch)
tree1ce1afd7246e1014199e15cbf854bf7924458e5d /debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch
parentAdding upstream version 6.1.76. (diff)
downloadlinux-01997497f915e8f79871f3f2acb55ac465051d24.tar.xz
linux-01997497f915e8f79871f3f2acb55ac465051d24.zip
Adding debian version 6.1.76-1.debian/6.1.76-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch')
-rw-r--r--debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch b/debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch
new file mode 100644
index 000000000..b4b695541
--- /dev/null
+++ b/debian/patches-rt/0053-io-mapping-don-t-disable-preempt-on-RT-in-io_mapping.patch
@@ -0,0 +1,93 @@
+From 53c6a09e670e985d37ca05785a0155ab51b49cf4 Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 10 Mar 2023 17:29:05 +0100
+Subject: [PATCH 53/62] io-mapping: don't disable preempt on RT in
+ io_mapping_map_atomic_wc().
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.1/older/patches-6.1.69-rt21.tar.xz
+
+io_mapping_map_atomic_wc() disables preemption and pagefaults for
+historical reasons. The conversion to io_mapping_map_local_wc(), which
+only disables migration, cannot be done wholesale because quite some call
+sites need to be updated to accommodate with the changed semantics.
+
+On PREEMPT_RT enabled kernels the io_mapping_map_atomic_wc() semantics are
+problematic due to the implicit disabling of preemption which makes it
+impossible to acquire 'sleeping' spinlocks within the mapped atomic
+sections.
+
+PREEMPT_RT replaces the preempt_disable() with a migrate_disable() for
+more than a decade. It could be argued that this is a justification to do
+this unconditionally, but PREEMPT_RT covers only a limited number of
+architectures and it disables some functionality which limits the coverage
+further.
+
+Limit the replacement to PREEMPT_RT for now. This is also done
+kmap_atomic().
+
+Link: https://lkml.kernel.org/r/20230310162905.O57Pj7hh@linutronix.de
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Reported-by: Richard Weinberger <richard.weinberger@gmail.com>
+ Link: https://lore.kernel.org/CAFLxGvw0WMxaMqYqJ5WgvVSbKHq2D2xcXTOgMCpgq9nDC-MWTQ@mail.gmail.com
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+(cherry picked from commit 7eb16f23b9a415f062db22739e59bb144e0b24ab)
+Signed-off-by: Clark Williams <clark.williams@gmail.com>
+---
+ include/linux/io-mapping.h | 20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
+index 66a774d2710e..b08532b8fba7 100644
+--- a/include/linux/io-mapping.h
++++ b/include/linux/io-mapping.h
+@@ -69,7 +69,10 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping,
+
+ BUG_ON(offset >= mapping->size);
+ phys_addr = mapping->base + offset;
+- preempt_disable();
++ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
++ preempt_disable();
++ else
++ migrate_disable();
+ pagefault_disable();
+ return __iomap_local_pfn_prot(PHYS_PFN(phys_addr), mapping->prot);
+ }
+@@ -79,7 +82,10 @@ io_mapping_unmap_atomic(void __iomem *vaddr)
+ {
+ kunmap_local_indexed((void __force *)vaddr);
+ pagefault_enable();
+- preempt_enable();
++ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
++ preempt_enable();
++ else
++ migrate_enable();
+ }
+
+ static inline void __iomem *
+@@ -162,7 +168,10 @@ static inline void __iomem *
+ io_mapping_map_atomic_wc(struct io_mapping *mapping,
+ unsigned long offset)
+ {
+- preempt_disable();
++ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
++ preempt_disable();
++ else
++ migrate_disable();
+ pagefault_disable();
+ return io_mapping_map_wc(mapping, offset, PAGE_SIZE);
+ }
+@@ -172,7 +181,10 @@ io_mapping_unmap_atomic(void __iomem *vaddr)
+ {
+ io_mapping_unmap(vaddr);
+ pagefault_enable();
+- preempt_enable();
++ if (!IS_ENABLED(CONFIG_PREEMPT_RT))
++ preempt_enable();
++ else
++ migrate_enable();
+ }
+
+ static inline void __iomem *
+--
+2.43.0
+