HomeFreeBSD

amd64: Make it possible to grow the KERNBASE region of KVA

Description

amd64: Make it possible to grow the KERNBASE region of KVA

pmap_growkernel() may be called when mapping a region above KERNBASE,
typically for a kernel module. If we have enough PTPs left over from
bootstrap, pmap_growkernel() does nothing. However, it's possible to
run out, and in this case pmap_growkernel() will try to grow the kernel
map all the way from kernel_vm_end to somewhere past KERNBASE, which can
easily run the system out of memory. This happens with large kernel
modules such as the nvidia GPU driver. There is also a WIP dtrace
provider which needs to map KVA in the region above KERNBASE (to provide
trampolines which allow a copy of traced kernel instruction to be
executed), and its allocations could potentially trigger this scenario.

This change modifies pmap_growkernel() to manage the two regions
separately, allowing them to grow independently. The end of the
KERNBASE region is tracked by modifying "nkpt".

PR: 265019
Reviewed by: alc, imp, kib

(cherry picked from commit 0b29f5efcc7ee8271ad2f6b6447898b489d618ec)

Details

Provenance
markjAuthored on Sep 24 2022, 1:19 PM
Parents
rG298d7504ae5b: stty(1): provide details about interaction with job control
Branches
Unknown
Tags
Unknown