• Heiko Carstens's avatar
    s390/pageattr: allow kernel page table splitting · e8a97e42
    Heiko Carstens authored
    set_memory_ro() and set_memory_rw() currently only work on 4k
    mappings, which is good enough for module code aka the vmalloc area.
    
    However we stumbled already twice into the need to make this also work
    on larger mappings:
    - the ro after init patch set
    - the crash kernel resize code
    
    Therefore this patch implements automatic kernel page table splitting
    if e.g. set_memory_ro() would be called on parts of a 2G mapping.
    This works quite the same as the x86 code, but is much simpler.
    
    In order to make this work and to be architecturally compliant we now
    always use the csp, cspg or crdte instructions to replace valid page
    table entries. This means that set_memory_ro() and set_memory_rw()
    will be much more expensive than before. In order to avoid huge
    latencies the code contains a couple of cond_resched() calls.
    
    The current code only splits page tables, but does not merge them if
    it would be possible.  The reason for this is that currently there is
    no real life scenarion where this would really happen. All current use
    cases that I know of only change access rights once during the life
    time. If that should change we can still implement kernel page table
    merging at a later time.
    Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
    Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    e8a97e42
pgtable.h 41.6 KB