Skip to contentSkip to conversation

ipipe: Protect ioremap_page_range also against IRQ usage by APEI

PATCH In review Jan Kiszka 2 participants 2 messages Apr 9, 2015 – Apr 12, 2015 Library code

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 ipipe: Protect ioremap_page_range also against IRQ usage by APEI

Commit 261a3fdbae added a check to prevent NMI invocation of the range pinning function. But APEI may also call ioremap_page_range from timer IRQ context. Therefore we need to extend the check.

This addresses lockups seen on long-running systems with APEI GHES enabled.

---

Jeroen, Niels, this should truly and safely fix the issue. Please give it a try!

 lib/ioremap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/ioremap.c +2 -2
index f5331c0..9b8e8d5 100644
@@ -88,9 +88,9 @@ int ioremap_page_range(unsigned long addr,
 			break;
 	} while (pgd++, addr = next, addr != end);
 
-	/* APEI may invoke this for temporarily remapping pages in NMI
+	/* APEI may invoke this for temporarily remapping pages in IRQ or NMI
 	 * context - nothing we can and need to propagate globally. */
-	if (!in_nmi()) {
+	if (!(in_irq() || in_nmi())) {
 		__ipipe_pin_range_globally(start, end);
 		flush_cache_vmap(start, end);
 	}
Signature · 1 line
2.1.4
#1 lore raw

Jan,

Quoted 2 lines

Jeroen, Niels, this should truly and safely fix the issue. Please give it a try!

I've been away for a couple of days. The moment the crash I reported occurred was right before I left so I didn't have time to look into it myself at all. But looking at what you found to (hopefully) fix it, I doubt I could have contributed much...

Anyway, the test rig is now running the patch with nothing else changed (CONFIG_ACPI_APEI_GHES=y; APEI can't be disabled in BIOS). We'll let it sit for a week.

Thanks,

Jeroen.

Quoted 22 lines
 lib/ioremap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/ioremap.c +2 -3
index f5331c0..9b8e8d5 100644
@@ -88,9 +88,9 @@ int ioremap_page_range(unsigned long addr,
                        break;
        } while (pgd++, addr = next, addr != end);
 
-       /* APEI may invoke this for temporarily remapping pages in NMI
+       /* APEI may invoke this for temporarily remapping pages in IRQ or NMI
         * context - nothing we can and need to propagate globally. */
-       if (!in_nmi()) {
+       if (!(in_irq() || in_nmi())) {
                __ipipe_pin_range_globally(start, end);
                flush_cache_vmap(start, end);
        }
--

2.1.4