* [PATCH] powerpc/eeh: Handle hugepages in ioremap space
@ 2019-07-10 15:05 Oliver O'Halloran
2019-07-11 7:47 ` Sachin Sant
2019-07-15 5:24 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Oliver O'Halloran @ 2019-07-10 15:05 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sachin Sant, Oliver O'Halloran, Nicholas Piggin
In commit 4a7b06c157a2 ("powerpc/eeh: Handle hugepages in ioremap
space") support for using hugepages in the vmalloc and ioremap areas was
enabled for radix. Unfortunately this broke EEH MMIO error checking.
Detection works by inserting a hook which checks the results of the
ioreadXX() set of functions. When a read returns a 0xFFs response we
need to check for an error which we do by mapping the (virtual) MMIO
address back to a physical address, then mapping physical address to a
PCI device via an interval tree.
When translating virt -> phys we currently assume the ioremap space is
only populated by PAGE_SIZE mappings. If a hugepage mapping is found we
emit a WARN_ON(), but otherwise handles the check as though a normal
page was found. In pathalogical cases such as copying a buffer
containing a lot of 0xFFs from BAR memory this can result in the system
not booting because it's too busy printing WARN_ON()s.
There's no real reason to assume huge pages can't be present and we're
prefectly capable of handling them, so do that.
Cc: Nicholas Piggin <npiggin@gmail.com>
Fixes: 4a7b06c157a2 ("powerpc/eeh: Handle hugepages in ioremap space")
Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
I'm assuming that we aren't going to be doing THP in the ioremap area.
---
arch/powerpc/kernel/eeh.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 4557fb1aeb2c..976ca0496442 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -354,10 +354,19 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
ptep = find_init_mm_pte(token, &hugepage_shift);
if (!ptep)
return token;
- WARN_ON(hugepage_shift);
- pa = pte_pfn(*ptep) << PAGE_SHIFT;
- return pa | (token & (PAGE_SIZE-1));
+ pa = pte_pfn(*ptep);
+
+ /* On radix we can do hugepage mappings for io, so handle that */
+ if (hugepage_shift) {
+ pa <<= hugepage_shift;
+ pa |= token & ((1ul << hugepage_shift) - 1);
+ } else {
+ pa <<= PAGE_SHIFT;
+ pa |= token & (PAGE_SIZE - 1);
+ }
+
+ return pa;
}
/*
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/eeh: Handle hugepages in ioremap space
2019-07-10 15:05 [PATCH] powerpc/eeh: Handle hugepages in ioremap space Oliver O'Halloran
@ 2019-07-11 7:47 ` Sachin Sant
2019-07-15 5:24 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Sachin Sant @ 2019-07-11 7:47 UTC (permalink / raw)
To: Oliver O'Halloran; +Cc: linuxppc-dev, Nicholas Piggin
> On 10-Jul-2019, at 8:35 PM, Oliver O'Halloran <oohall@gmail.com> wrote:
>
> In commit 4a7b06c157a2 ("powerpc/eeh: Handle hugepages in ioremap
> space") support for using hugepages in the vmalloc and ioremap areas was
> enabled for radix. Unfortunately this broke EEH MMIO error checking.
>
> Detection works by inserting a hook which checks the results of the
> ioreadXX() set of functions. When a read returns a 0xFFs response we
> need to check for an error which we do by mapping the (virtual) MMIO
> address back to a physical address, then mapping physical address to a
> PCI device via an interval tree.
>
> When translating virt -> phys we currently assume the ioremap space is
> only populated by PAGE_SIZE mappings. If a hugepage mapping is found we
> emit a WARN_ON(), but otherwise handles the check as though a normal
> page was found. In pathalogical cases such as copying a buffer
> containing a lot of 0xFFs from BAR memory this can result in the system
> not booting because it's too busy printing WARN_ON()s.
>
> There's no real reason to assume huge pages can't be present and we're
> prefectly capable of handling them, so do that.
>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Fixes: 4a7b06c157a2 ("powerpc/eeh: Handle hugepages in ioremap space")
> Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Thanks
-Sachin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/eeh: Handle hugepages in ioremap space
2019-07-10 15:05 [PATCH] powerpc/eeh: Handle hugepages in ioremap space Oliver O'Halloran
2019-07-11 7:47 ` Sachin Sant
@ 2019-07-15 5:24 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2019-07-15 5:24 UTC (permalink / raw)
To: Oliver O'Halloran, linuxppc-dev
Cc: Sachin Sant, Oliver O'Halloran, Nicholas Piggin
On Wed, 2019-07-10 at 15:05:17 UTC, Oliver O'Halloran wrote:
> In commit 4a7b06c157a2 ("powerpc/eeh: Handle hugepages in ioremap
> space") support for using hugepages in the vmalloc and ioremap areas was
> enabled for radix. Unfortunately this broke EEH MMIO error checking.
>
> Detection works by inserting a hook which checks the results of the
> ioreadXX() set of functions. When a read returns a 0xFFs response we
> need to check for an error which we do by mapping the (virtual) MMIO
> address back to a physical address, then mapping physical address to a
> PCI device via an interval tree.
>
> When translating virt -> phys we currently assume the ioremap space is
> only populated by PAGE_SIZE mappings. If a hugepage mapping is found we
> emit a WARN_ON(), but otherwise handles the check as though a normal
> page was found. In pathalogical cases such as copying a buffer
> containing a lot of 0xFFs from BAR memory this can result in the system
> not booting because it's too busy printing WARN_ON()s.
>
> There's no real reason to assume huge pages can't be present and we're
> prefectly capable of handling them, so do that.
>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Fixes: 4a7b06c157a2 ("powerpc/eeh: Handle hugepages in ioremap space")
> Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/33439620680be5225c1b8806579a291e0d761ca0
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-15 5:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 15:05 [PATCH] powerpc/eeh: Handle hugepages in ioremap space Oliver O'Halloran
2019-07-11 7:47 ` Sachin Sant
2019-07-15 5:24 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.