mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 22:42:04 +00:00
9471f1f2f5
This modifies our user mode stack expansion code to always take the mmap_lock for writing before modifying the VM layout. It's actually something we always technically should have done, but because we didn't strictly need it, we were being lazy ("opportunistic" sounds so much better, doesn't it?) about things, and had this hack in place where we would extend the stack vma in-place without doing the proper locking. And it worked fine. We just needed to change vm_start (or, in the case of grow-up stacks, vm_end) and together with some special ad-hoc locking using the anon_vma lock and the mm->page_table_lock, it all was fairly straightforward. That is, it was all fine until Ruihan Li pointed out that now that the vma layout uses the maple tree code, we *really* don't just change vm_start and vm_end any more, and the locking really is broken. Oops. It's not actually all _that_ horrible to fix this once and for all, and do proper locking, but it's a bit painful. We have basically three different cases of stack expansion, and they all work just a bit differently: - the common and obvious case is the page fault handling. It's actually fairly simple and straightforward, except for the fact that we have something like 24 different versions of it, and you end up in a maze of twisty little passages, all alike. - the simplest case is the execve() code that creates a new stack. There are no real locking concerns because it's all in a private new VM that hasn't been exposed to anybody, but lockdep still can end up unhappy if you get it wrong. - and finally, we have GUP and page pinning, which shouldn't really be expanding the stack in the first place, but in addition to execve() we also use it for ptrace(). And debuggers do want to possibly access memory under the stack pointer and thus need to be able to expand the stack as a special case. None of these cases are exactly complicated, but the page fault case in particular is just repeated slightly differently many many times. And ia64 in particular has a fairly complicated situation where you can have both a regular grow-down stack _and_ a special grow-up stack for the register backing store. So to make this slightly more manageable, the bulk of this series is to first create a helper function for the most common page fault case, and convert all the straightforward architectures to it. Thus the new 'lock_mm_and_find_vma()' helper function, which ends up being used by x86, arm, powerpc, mips, riscv, alpha, arc, csky, hexagon, loongarch, nios2, sh, sparc32, and xtensa. So we not only convert more than half the architectures, we now have more shared code and avoid some of those twisty little passages. And largely due to this common helper function, the full diffstat of this series ends up deleting more lines than it adds. That still leaves eight architectures (ia64, m68k, microblaze, openrisc, parisc, s390, sparc64 and um) that end up doing 'expand_stack()' manually because they are doing something slightly different from the normal pattern. Along with the couple of special cases in execve() and GUP. So there's a couple of patches that first create 'locked' helper versions of the stack expansion functions, so that there's a obvious path forward in the conversion. The execve() case is then actually pretty simple, and is a nice cleanup from our old "grow-up stackls are special, because at execve time even they grow down". The #ifdef CONFIG_STACK_GROWSUP in that code just goes away, because it's just more straightforward to write out the stack expansion there manually, instead od having get_user_pages_remote() do it for us in some situations but not others and have to worry about locking rules for GUP. And the final step is then to just convert the remaining odd cases to a new world order where 'expand_stack()' is called with the mmap_lock held for reading, but where it might drop it and upgrade it to a write, only to return with it held for reading (in the success case) or with it completely dropped (in the failure case). In the process, we remove all the stack expansion from GUP (where dropping the lock wouldn't be ok without special rules anyway), and add it in manually to __access_remote_vm() for ptrace(). Thanks to Adrian Glaubitz and Frank Scheiner who tested the ia64 cases. Everything else here felt pretty straightforward, but the ia64 rules for stack expansion are really quite odd and very different from everything else. Also thanks to Vegard Nossum who caught me getting one of those odd conditions entirely the wrong way around. Anyway, I think I want to actually move all the stack expansion code to a whole new file of its own, rather than have it split up between mm/mmap.c and mm/memory.c, but since this will have to be backported to the initial maple tree vma introduction anyway, I tried to keep the patches _fairly_ minimal. Also, while I don't think it's valid to expand the stack from GUP, the final patch in here is a "warn if some crazy GUP user wants to try to expand the stack" patch. That one will be reverted before the final release, but it's left to catch any odd cases during the merge window and release candidates. Reported-by: Ruihan Li <lrh2000@pku.edu.cn> * branch 'expand-stack': gup: add warning if some caller would seem to want stack expansion mm: always expand the stack with the mmap write lock held execve: expand new process stack manually ahead of time mm: make find_extend_vma() fail if write lock not held powerpc/mm: convert coprocessor fault to lock_mm_and_find_vma() mm/fault: convert remaining simple cases to lock_mm_and_find_vma() arm/mm: Convert to using lock_mm_and_find_vma() riscv/mm: Convert to using lock_mm_and_find_vma() mips/mm: Convert to using lock_mm_and_find_vma() powerpc/mm: Convert to using lock_mm_and_find_vma() arm64/mm: Convert to using lock_mm_and_find_vma() mm: make the page fault mmap locking killable mm: introduce new 'lock_mm_and_find_vma()' page fault helper
609 lines
17 KiB
Plaintext
609 lines
17 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0
|
|
config LOONGARCH
|
|
bool
|
|
default y
|
|
select ACPI
|
|
select ACPI_GENERIC_GSI if ACPI
|
|
select ACPI_MCFG if ACPI
|
|
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
|
|
select ARCH_BINFMT_ELF_STATE
|
|
select ARCH_ENABLE_MEMORY_HOTPLUG
|
|
select ARCH_ENABLE_MEMORY_HOTREMOVE
|
|
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
|
|
select ARCH_HAS_CPU_FINALIZE_INIT
|
|
select ARCH_HAS_FORTIFY_SOURCE
|
|
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
|
|
select ARCH_HAS_PTE_SPECIAL
|
|
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
|
|
select ARCH_INLINE_READ_LOCK if !PREEMPTION
|
|
select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
|
|
select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION
|
|
select ARCH_INLINE_READ_UNLOCK if !PREEMPTION
|
|
select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION
|
|
select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_LOCK if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION
|
|
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_LOCK if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION
|
|
select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION
|
|
select ARCH_KEEP_MEMBLOCK
|
|
select ARCH_MIGHT_HAVE_PC_PARPORT
|
|
select ARCH_MIGHT_HAVE_PC_SERIO
|
|
select ARCH_SPARSEMEM_ENABLE
|
|
select ARCH_STACKWALK
|
|
select ARCH_SUPPORTS_ACPI
|
|
select ARCH_SUPPORTS_ATOMIC_RMW
|
|
select ARCH_SUPPORTS_HUGETLBFS
|
|
select ARCH_SUPPORTS_NUMA_BALANCING
|
|
select ARCH_USE_BUILTIN_BSWAP
|
|
select ARCH_USE_CMPXCHG_LOCKREF
|
|
select ARCH_USE_QUEUED_RWLOCKS
|
|
select ARCH_USE_QUEUED_SPINLOCKS
|
|
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
|
|
select ARCH_WANT_LD_ORPHAN_WARN
|
|
select ARCH_WANT_OPTIMIZE_VMEMMAP
|
|
select ARCH_WANTS_NO_INSTR
|
|
select BUILDTIME_TABLE_SORT
|
|
select COMMON_CLK
|
|
select CPU_PM
|
|
select EFI
|
|
select GENERIC_CLOCKEVENTS
|
|
select GENERIC_CMOS_UPDATE
|
|
select GENERIC_CPU_AUTOPROBE
|
|
select GENERIC_ENTRY
|
|
select GENERIC_GETTIMEOFDAY
|
|
select GENERIC_IOREMAP if !ARCH_IOREMAP
|
|
select GENERIC_IRQ_MULTI_HANDLER
|
|
select GENERIC_IRQ_PROBE
|
|
select GENERIC_IRQ_SHOW
|
|
select GENERIC_LIB_ASHLDI3
|
|
select GENERIC_LIB_ASHRDI3
|
|
select GENERIC_LIB_CMPDI2
|
|
select GENERIC_LIB_LSHRDI3
|
|
select GENERIC_LIB_UCMPDI2
|
|
select GENERIC_LIB_DEVMEM_IS_ALLOWED
|
|
select GENERIC_PCI_IOMAP
|
|
select GENERIC_SCHED_CLOCK
|
|
select GENERIC_SMP_IDLE_THREAD
|
|
select GENERIC_TIME_VSYSCALL
|
|
select GPIOLIB
|
|
select HAS_IOPORT
|
|
select HAVE_ARCH_AUDITSYSCALL
|
|
select HAVE_ARCH_MMAP_RND_BITS if MMU
|
|
select HAVE_ARCH_SECCOMP_FILTER
|
|
select HAVE_ARCH_TRACEHOOK
|
|
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
|
|
select HAVE_ASM_MODVERSIONS
|
|
select HAVE_CONTEXT_TRACKING_USER
|
|
select HAVE_C_RECORDMCOUNT
|
|
select HAVE_DEBUG_STACKOVERFLOW
|
|
select HAVE_DMA_CONTIGUOUS
|
|
select HAVE_DYNAMIC_FTRACE
|
|
select HAVE_DYNAMIC_FTRACE_WITH_ARGS
|
|
select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
|
|
select HAVE_DYNAMIC_FTRACE_WITH_REGS
|
|
select HAVE_EBPF_JIT
|
|
select HAVE_EFFICIENT_UNALIGNED_ACCESS if !ARCH_STRICT_ALIGN
|
|
select HAVE_EXIT_THREAD
|
|
select HAVE_FAST_GUP
|
|
select HAVE_FTRACE_MCOUNT_RECORD
|
|
select HAVE_FUNCTION_ARG_ACCESS_API
|
|
select HAVE_FUNCTION_ERROR_INJECTION
|
|
select HAVE_FUNCTION_GRAPH_TRACER
|
|
select HAVE_FUNCTION_TRACER
|
|
select HAVE_GENERIC_VDSO
|
|
select HAVE_HW_BREAKPOINT if PERF_EVENTS
|
|
select HAVE_IOREMAP_PROT
|
|
select HAVE_IRQ_EXIT_ON_IRQ_STACK
|
|
select HAVE_IRQ_TIME_ACCOUNTING
|
|
select HAVE_KPROBES
|
|
select HAVE_KPROBES_ON_FTRACE
|
|
select HAVE_KRETPROBES
|
|
select HAVE_MOD_ARCH_SPECIFIC
|
|
select HAVE_NMI
|
|
select HAVE_PCI
|
|
select HAVE_PERF_EVENTS
|
|
select HAVE_PERF_REGS
|
|
select HAVE_PERF_USER_STACK_DUMP
|
|
select HAVE_REGS_AND_STACK_ACCESS_API
|
|
select HAVE_RSEQ
|
|
select HAVE_SAMPLE_FTRACE_DIRECT
|
|
select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
|
|
select HAVE_SETUP_PER_CPU_AREA if NUMA
|
|
select HAVE_STACKPROTECTOR
|
|
select HAVE_SYSCALL_TRACEPOINTS
|
|
select HAVE_TIF_NOHZ
|
|
select HAVE_VIRT_CPU_ACCOUNTING_GEN if !SMP
|
|
select IRQ_FORCED_THREADING
|
|
select IRQ_LOONGARCH_CPU
|
|
select LOCK_MM_AND_FIND_VMA
|
|
select MMU_GATHER_MERGE_VMAS if MMU
|
|
select MODULES_USE_ELF_RELA if MODULES
|
|
select NEED_PER_CPU_EMBED_FIRST_CHUNK
|
|
select NEED_PER_CPU_PAGE_FIRST_CHUNK
|
|
select OF
|
|
select OF_EARLY_FLATTREE
|
|
select PCI
|
|
select PCI_DOMAINS_GENERIC
|
|
select PCI_ECAM if ACPI
|
|
select PCI_LOONGSON
|
|
select PCI_MSI_ARCH_FALLBACKS
|
|
select PCI_QUIRKS
|
|
select PERF_USE_VMALLOC
|
|
select RTC_LIB
|
|
select SMP
|
|
select SPARSE_IRQ
|
|
select SYSCTL_ARCH_UNALIGN_ALLOW
|
|
select SYSCTL_ARCH_UNALIGN_NO_WARN
|
|
select SYSCTL_EXCEPTION_TRACE
|
|
select SWIOTLB
|
|
select TRACE_IRQFLAGS_SUPPORT
|
|
select USE_PERCPU_NUMA_NODE_ID
|
|
select USER_STACKTRACE_SUPPORT
|
|
select ZONE_DMA32
|
|
|
|
config 32BIT
|
|
bool
|
|
|
|
config 64BIT
|
|
def_bool y
|
|
|
|
config CPU_HAS_FPU
|
|
bool
|
|
default y
|
|
|
|
config CPU_HAS_PREFETCH
|
|
bool
|
|
default y
|
|
|
|
config GENERIC_BUG
|
|
def_bool y
|
|
depends on BUG
|
|
|
|
config GENERIC_BUG_RELATIVE_POINTERS
|
|
def_bool y
|
|
depends on GENERIC_BUG
|
|
|
|
config GENERIC_CALIBRATE_DELAY
|
|
def_bool y
|
|
|
|
config GENERIC_CSUM
|
|
def_bool y
|
|
|
|
config GENERIC_HWEIGHT
|
|
def_bool y
|
|
|
|
config L1_CACHE_SHIFT
|
|
int
|
|
default "6"
|
|
|
|
config LOCKDEP_SUPPORT
|
|
bool
|
|
default y
|
|
|
|
config STACKTRACE_SUPPORT
|
|
bool
|
|
default y
|
|
|
|
# MACH_LOONGSON32 and MACH_LOONGSON64 are deliberately carried over from the
|
|
# MIPS Loongson code, to preserve Loongson-specific code paths in drivers that
|
|
# are shared between architectures, and specifically expecting the symbols.
|
|
config MACH_LOONGSON32
|
|
def_bool 32BIT
|
|
|
|
config MACH_LOONGSON64
|
|
def_bool 64BIT
|
|
|
|
config FIX_EARLYCON_MEM
|
|
def_bool y
|
|
|
|
config PAGE_SIZE_4KB
|
|
bool
|
|
|
|
config PAGE_SIZE_16KB
|
|
bool
|
|
|
|
config PAGE_SIZE_64KB
|
|
bool
|
|
|
|
config PGTABLE_2LEVEL
|
|
bool
|
|
|
|
config PGTABLE_3LEVEL
|
|
bool
|
|
|
|
config PGTABLE_4LEVEL
|
|
bool
|
|
|
|
config PGTABLE_LEVELS
|
|
int
|
|
default 2 if PGTABLE_2LEVEL
|
|
default 3 if PGTABLE_3LEVEL
|
|
default 4 if PGTABLE_4LEVEL
|
|
|
|
config SCHED_OMIT_FRAME_POINTER
|
|
bool
|
|
default y
|
|
|
|
config AS_HAS_EXPLICIT_RELOCS
|
|
def_bool $(as-instr,x:pcalau12i \$t0$(comma)%pc_hi20(x))
|
|
|
|
menu "Kernel type and options"
|
|
|
|
source "kernel/Kconfig.hz"
|
|
|
|
choice
|
|
prompt "Page Table Layout"
|
|
default 16KB_2LEVEL if 32BIT
|
|
default 16KB_3LEVEL if 64BIT
|
|
help
|
|
Allows choosing the page table layout, which is a combination
|
|
of page size and page table levels. The size of virtual memory
|
|
address space are determined by the page table layout.
|
|
|
|
config 4KB_3LEVEL
|
|
bool "4KB with 3 levels"
|
|
select PAGE_SIZE_4KB
|
|
select PGTABLE_3LEVEL
|
|
help
|
|
This option selects 4KB page size with 3 level page tables, which
|
|
support a maximum of 39 bits of application virtual memory.
|
|
|
|
config 4KB_4LEVEL
|
|
bool "4KB with 4 levels"
|
|
select PAGE_SIZE_4KB
|
|
select PGTABLE_4LEVEL
|
|
help
|
|
This option selects 4KB page size with 4 level page tables, which
|
|
support a maximum of 48 bits of application virtual memory.
|
|
|
|
config 16KB_2LEVEL
|
|
bool "16KB with 2 levels"
|
|
select PAGE_SIZE_16KB
|
|
select PGTABLE_2LEVEL
|
|
help
|
|
This option selects 16KB page size with 2 level page tables, which
|
|
support a maximum of 36 bits of application virtual memory.
|
|
|
|
config 16KB_3LEVEL
|
|
bool "16KB with 3 levels"
|
|
select PAGE_SIZE_16KB
|
|
select PGTABLE_3LEVEL
|
|
help
|
|
This option selects 16KB page size with 3 level page tables, which
|
|
support a maximum of 47 bits of application virtual memory.
|
|
|
|
config 64KB_2LEVEL
|
|
bool "64KB with 2 levels"
|
|
select PAGE_SIZE_64KB
|
|
select PGTABLE_2LEVEL
|
|
help
|
|
This option selects 64KB page size with 2 level page tables, which
|
|
support a maximum of 42 bits of application virtual memory.
|
|
|
|
config 64KB_3LEVEL
|
|
bool "64KB with 3 levels"
|
|
select PAGE_SIZE_64KB
|
|
select PGTABLE_3LEVEL
|
|
help
|
|
This option selects 64KB page size with 3 level page tables, which
|
|
support a maximum of 55 bits of application virtual memory.
|
|
|
|
endchoice
|
|
|
|
config CMDLINE
|
|
string "Built-in kernel command line"
|
|
help
|
|
For most platforms, the arguments for the kernel's command line
|
|
are provided at run-time, during boot. However, there are cases
|
|
where either no arguments are being provided or the provided
|
|
arguments are insufficient or even invalid.
|
|
|
|
When that occurs, it is possible to define a built-in command
|
|
line here and choose how the kernel should use it later on.
|
|
|
|
choice
|
|
prompt "Kernel command line type"
|
|
default CMDLINE_BOOTLOADER
|
|
help
|
|
Choose how the kernel will handle the provided built-in command
|
|
line.
|
|
|
|
config CMDLINE_BOOTLOADER
|
|
bool "Use bootloader kernel arguments if available"
|
|
help
|
|
Prefer the command-line passed by the boot loader if available.
|
|
Use the built-in command line as fallback in case we get nothing
|
|
during boot. This is the default behaviour.
|
|
|
|
config CMDLINE_EXTEND
|
|
bool "Use built-in to extend bootloader kernel arguments"
|
|
help
|
|
The command-line arguments provided during boot will be
|
|
appended to the built-in command line. This is useful in
|
|
cases where the provided arguments are insufficient and
|
|
you don't want to or cannot modify them.
|
|
|
|
config CMDLINE_FORCE
|
|
bool "Always use the built-in kernel command string"
|
|
help
|
|
Always use the built-in command line, even if we get one during
|
|
boot. This is useful in case you need to override the provided
|
|
command line on systems where you don't have or want control
|
|
over it.
|
|
|
|
endchoice
|
|
|
|
config DMI
|
|
bool "Enable DMI scanning"
|
|
select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
|
|
default y
|
|
help
|
|
This enables SMBIOS/DMI feature for systems, and scanning of
|
|
DMI to identify machine quirks.
|
|
|
|
config EFI
|
|
bool "EFI runtime service support"
|
|
select UCS2_STRING
|
|
select EFI_RUNTIME_WRAPPERS
|
|
help
|
|
This enables the kernel to use EFI runtime services that are
|
|
available (such as the EFI variable services).
|
|
|
|
config EFI_STUB
|
|
bool "EFI boot stub support"
|
|
default y
|
|
depends on EFI
|
|
select EFI_GENERIC_STUB
|
|
help
|
|
This kernel feature allows the kernel to be loaded directly by
|
|
EFI firmware without the use of a bootloader.
|
|
|
|
config SMP
|
|
bool "Multi-Processing support"
|
|
help
|
|
This enables support for systems with more than one CPU. If you have
|
|
a system with only one CPU, say N. If you have a system with more
|
|
than one CPU, say Y.
|
|
|
|
If you say N here, the kernel will run on uni- and multiprocessor
|
|
machines, but will use only one CPU of a multiprocessor machine. If
|
|
you say Y here, the kernel will run on many, but not all,
|
|
uniprocessor machines. On a uniprocessor machine, the kernel
|
|
will run faster if you say N here.
|
|
|
|
See also the SMP-HOWTO available at <http://www.tldp.org/docs.html#howto>.
|
|
|
|
If you don't know what to do here, say N.
|
|
|
|
config HOTPLUG_CPU
|
|
bool "Support for hot-pluggable CPUs"
|
|
depends on SMP
|
|
select GENERIC_IRQ_MIGRATION
|
|
help
|
|
Say Y here to allow turning CPUs off and on. CPUs can be
|
|
controlled through /sys/devices/system/cpu.
|
|
(Note: power management support will enable this option
|
|
automatically on SMP systems. )
|
|
Say N if you want to disable CPU hotplug.
|
|
|
|
config NR_CPUS
|
|
int "Maximum number of CPUs (2-256)"
|
|
range 2 256
|
|
depends on SMP
|
|
default "64"
|
|
help
|
|
This allows you to specify the maximum number of CPUs which this
|
|
kernel will support.
|
|
|
|
config NUMA
|
|
bool "NUMA Support"
|
|
select SMP
|
|
select ACPI_NUMA if ACPI
|
|
help
|
|
Say Y to compile the kernel with NUMA (Non-Uniform Memory Access)
|
|
support. This option improves performance on systems with more
|
|
than one NUMA node; on single node systems it is generally better
|
|
to leave it disabled.
|
|
|
|
config NODES_SHIFT
|
|
int
|
|
default "6"
|
|
depends on NUMA
|
|
|
|
config ARCH_FORCE_MAX_ORDER
|
|
int "Maximum zone order"
|
|
default "13" if PAGE_SIZE_64KB
|
|
default "11" if PAGE_SIZE_16KB
|
|
default "10"
|
|
help
|
|
The kernel memory allocator divides physically contiguous memory
|
|
blocks into "zones", where each zone is a power of two number of
|
|
pages. This option selects the largest power of two that the kernel
|
|
keeps in the memory allocator. If you need to allocate very large
|
|
blocks of physically contiguous memory, then you may need to
|
|
increase this value.
|
|
|
|
The page size is not necessarily 4KB. Keep this in mind
|
|
when choosing a value for this option.
|
|
|
|
config ARCH_IOREMAP
|
|
bool "Enable LoongArch DMW-based ioremap()"
|
|
help
|
|
We use generic TLB-based ioremap() by default since it has page
|
|
protection support. However, you can enable LoongArch DMW-based
|
|
ioremap() for better performance.
|
|
|
|
config ARCH_WRITECOMBINE
|
|
bool "Enable WriteCombine (WUC) for ioremap()"
|
|
help
|
|
LoongArch maintains cache coherency in hardware, but when paired
|
|
with LS7A chipsets the WUC attribute (Weak-ordered UnCached, which
|
|
is similar to WriteCombine) is out of the scope of cache coherency
|
|
machanism for PCIe devices (this is a PCIe protocol violation, which
|
|
may be fixed in newer chipsets).
|
|
|
|
This means WUC can only used for write-only memory regions now, so
|
|
this option is disabled by default, making WUC silently fallback to
|
|
SUC for ioremap(). You can enable this option if the kernel is ensured
|
|
to run on hardware without this bug.
|
|
|
|
You can override this setting via writecombine=on/off boot parameter.
|
|
|
|
config ARCH_STRICT_ALIGN
|
|
bool "Enable -mstrict-align to prevent unaligned accesses" if EXPERT
|
|
default y
|
|
help
|
|
Not all LoongArch cores support h/w unaligned access, we can use
|
|
-mstrict-align build parameter to prevent unaligned accesses.
|
|
|
|
CPUs with h/w unaligned access support:
|
|
Loongson-2K2000/2K3000/3A5000/3C5000/3D5000.
|
|
|
|
CPUs without h/w unaligned access support:
|
|
Loongson-2K500/2K1000.
|
|
|
|
This option is enabled by default to make the kernel be able to run
|
|
on all LoongArch systems. But you can disable it manually if you want
|
|
to run kernel only on systems with h/w unaligned access support in
|
|
order to optimise for performance.
|
|
|
|
config KEXEC
|
|
bool "Kexec system call"
|
|
select KEXEC_CORE
|
|
help
|
|
kexec is a system call that implements the ability to shutdown your
|
|
current kernel, and to start another kernel. It is like a reboot
|
|
but it is independent of the system firmware. And like a reboot
|
|
you can start any kernel with it, not just Linux.
|
|
|
|
The name comes from the similarity to the exec system call.
|
|
|
|
config CRASH_DUMP
|
|
bool "Build kdump crash kernel"
|
|
select RELOCATABLE
|
|
help
|
|
Generate crash dump after being started by kexec. This should
|
|
be normally only set in special crash dump kernels which are
|
|
loaded in the main kernel with kexec-tools into a specially
|
|
reserved region and then later executed after a crash by
|
|
kdump/kexec.
|
|
|
|
For more details see Documentation/admin-guide/kdump/kdump.rst
|
|
|
|
config RELOCATABLE
|
|
bool "Relocatable kernel"
|
|
help
|
|
This builds the kernel as a Position Independent Executable (PIE),
|
|
which retains all relocation metadata required, so as to relocate
|
|
the kernel binary at runtime to a different virtual address from
|
|
its link address.
|
|
|
|
config RANDOMIZE_BASE
|
|
bool "Randomize the address of the kernel (KASLR)"
|
|
depends on RELOCATABLE
|
|
help
|
|
Randomizes the physical and virtual address at which the
|
|
kernel image is loaded, as a security feature that
|
|
deters exploit attempts relying on knowledge of the location
|
|
of kernel internals.
|
|
|
|
The kernel will be offset by up to RANDOMIZE_BASE_MAX_OFFSET.
|
|
|
|
If unsure, say N.
|
|
|
|
config RANDOMIZE_BASE_MAX_OFFSET
|
|
hex "Maximum KASLR offset" if EXPERT
|
|
depends on RANDOMIZE_BASE
|
|
range 0x0 0x10000000
|
|
default "0x01000000"
|
|
help
|
|
When KASLR is active, this provides the maximum offset that will
|
|
be applied to the kernel image. It should be set according to the
|
|
amount of physical RAM available in the target system.
|
|
|
|
This is limited by the size of the lower address memory, 256MB.
|
|
|
|
config SECCOMP
|
|
bool "Enable seccomp to safely compute untrusted bytecode"
|
|
depends on PROC_FS
|
|
default y
|
|
help
|
|
This kernel feature is useful for number crunching applications
|
|
that may need to compute untrusted bytecode during their
|
|
execution. By using pipes or other transports made available to
|
|
the process as file descriptors supporting the read/write
|
|
syscalls, it's possible to isolate those applications in
|
|
their own address space using seccomp. Once seccomp is
|
|
enabled via /proc/<pid>/seccomp, it cannot be disabled
|
|
and the task is only allowed to execute a few safe syscalls
|
|
defined by each seccomp mode.
|
|
|
|
If unsure, say Y. Only embedded should say N here.
|
|
|
|
endmenu
|
|
|
|
config ARCH_SELECT_MEMORY_MODEL
|
|
def_bool y
|
|
|
|
config ARCH_FLATMEM_ENABLE
|
|
def_bool y
|
|
depends on !NUMA
|
|
|
|
config ARCH_SPARSEMEM_ENABLE
|
|
def_bool y
|
|
select SPARSEMEM_VMEMMAP_ENABLE
|
|
help
|
|
Say Y to support efficient handling of sparse physical memory,
|
|
for architectures which are either NUMA (Non-Uniform Memory Access)
|
|
or have huge holes in the physical address space for other reasons.
|
|
See <file:Documentation/mm/numa.rst> for more.
|
|
|
|
config ARCH_ENABLE_THP_MIGRATION
|
|
def_bool y
|
|
depends on TRANSPARENT_HUGEPAGE
|
|
|
|
config ARCH_MEMORY_PROBE
|
|
def_bool y
|
|
depends on MEMORY_HOTPLUG
|
|
|
|
config MMU
|
|
bool
|
|
default y
|
|
|
|
config ARCH_MMAP_RND_BITS_MIN
|
|
default 12
|
|
|
|
config ARCH_MMAP_RND_BITS_MAX
|
|
default 18
|
|
|
|
menu "Power management options"
|
|
|
|
config ARCH_SUSPEND_POSSIBLE
|
|
def_bool y
|
|
|
|
config ARCH_HIBERNATION_POSSIBLE
|
|
def_bool y
|
|
|
|
source "kernel/power/Kconfig"
|
|
source "drivers/acpi/Kconfig"
|
|
|
|
endmenu
|
|
|
|
source "drivers/firmware/Kconfig"
|