• Michael Ellerman's avatar
    powerpc/mm/radix: Remove the retry in the split mapping logic · 57306c66
    Michael Ellerman authored
    When we have CONFIG_STRICT_KERNEL_RWX enabled, we want to split the
    linear mapping at the text/data boundary so we can map the kernel
    text read only.
    
    The current logic uses a goto inside the for loop, which works, but is
    hard to reason about.
    
    When we hit the goto retry case we set max_mapping_size to PMD_SIZE
    and go back to the start.
    
    Setting max_mapping_size means we skip the PUD case and go to the PMD
    case.
    
    We know we will pass the alignment and gap checks because the only
    reason we are there is we hit the goto retry, and that is guarded by
    mapping_size == PUD_SIZE, which means addr is PUD aligned and gap is
    greater or equal to PUD_SIZE.
    
    So the only part of the check that can fail is the mmu_psize_defs
    check for the 2M page size.
    
    If we just duplicate that check we can avoid the goto, and we get the
    same result.
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    57306c66
pgtable-radix.c 26.2 KB