Thread (12 messages) flat view 12 messages, 3 authors, 2021-05-17

Re: Fwd: [Bug 213069] New: kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:147! Oops: Exception in kernel mode, sig: 5 [#1]

From: Aneesh Kumar K.V <hidden>
Date: 2021-05-17 11:15:25

Possibly related (same subject, not in this thread)

On 5/17/21 4:23 PM, Anshuman Khandual wrote:

On 5/17/21 1:14 PM, Aneesh Kumar K.V wrote:
quoted
On 5/17/21 12:55 PM, Anshuman Khandual wrote:
quoted

On 5/17/21 11:25 AM, Aneesh Kumar K.V wrote:
quoted
On 5/17/21 11:17 AM, Christophe Leroy wrote:
quoted
+aneesh
+linuxppc-dev list

Le 17/05/2021 à 07:44, Anshuman Khandual a écrit :
quoted
Hello Christophe,

DEBUG_VM_PGTABLE has now been re-enabled on powerpc recently ? was not
aware about this. From the error log, it failed explicitly on 4K page
size hash config.

static inline pmd_t hash__pmd_mkhuge(pmd_t pmd)
{
           BUG();        ------> Failed
           return pmd;
}

static inline pmd_t __pmd_mkhuge(pmd_t pmd)
{
           if (radix_enabled())
                   return radix__pmd_mkhuge(pmd);
           return hash__pmd_mkhuge(pmd);
}

pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
{
           unsigned long pmdv;

           pmdv = (pfn << PAGE_SHIFT) & PTE_RPN_MASK;

           return __pmd_mkhuge(pmd_set_protbits(__pmd(pmdv), pgprot));
}

It seems like on powerpc, where pfn_pmd() makes a huge page but which
is not supported on 4K hash config thus triggering the BUG(). But all
pfn_pmd() call sites inside the debug_vm_pgtable() test are protected
with CONFIG_TRANSPARENT_HUGEPAGE. IIUC unlike powerpc, pfn_pmd() does
not directly make a huge page on other platforms.

Looking at arch/powerpc/include/asm/book3s/64/hash-4k.h, all relevant
THP helpers has BUG() or 0 which indicates THP might not be supported
on 4K page size hash config ?

But looking at arch/powerpc/platforms/Kconfig.cputype, it seems like
HAVE_ARCH_TRANSPARENT_HUGEPAGE is invariably selected on PPC_BOOK3S_64
platforms which I assume includes 4K page size hash config as well.

Is THP some how getting enabled on this 4K page size hash config where
it should not be (thus triggering the BUG) ? OR am I missing something
here.
We should put those  pfn_pmd()  and pfn_pud() after

      if (!has_transparent_hugepage())
          return;


On hash with 4K page size, we can't support leaf page table entry and PMD and PUD level. Hence we don't support THP for them.
But could CONFIG_TRANSPARENT_HUGEPAGE be enabled on such configs ?
Otherwise, wondering how the BUG() just got triggered there.
yes. We do support THP with radix translation and 4K page size.
I was actually wondering about whether 4K page size in hash config
supports THP and could enable CONFIG_TRANSPARENT_HUGEPAGE ? But as
there is a BUG() trigger on hash__pmd_mkhuge(), it seems like THP
config should not have been enabled for such platforms but it does
for some reason. Could not we disable it ?
Hash is a translation mode which is not build time selected. Rather it 
is runtime selected. Same kernel can boot into either hash or radix 
translation. We don't support THP with 4K pagesize with hash 
translation.But the same kernel when booted in radix translation mode 
will support THP.

-aneesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help