summaryrefslogtreecommitdiff
path: root/arch/alpha
AgeCommit message (Collapse)Author
7 daysMerge tag 'perf-urgent-2026-10-25' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull perf events fixes from Ingo Molnar: - Fix Alpha build failure caused by a semantic conflict between perf and arch-alpha changes (Thomas Weißschuh) - Fix UAF in attach_task_ctx_data() (Lee Jia Jie) - Fix perf_remove_from_context() event scheduling (Peter Zijlstra) * tag 'perf-urgent-2026-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Fix perf_remove_from_context() event scheduling perf: Fix UAF in attach_task_ctx_data() alpha: add simd_enabled argument to perf_reg_validate()
9 daysMerge tag 'mm-stable-2026-10-19-21-33' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull MM updates from Andrew Morton: - "selftests/mm: improve khugepaged coverage" (Kiryl Shutsemau): Give khugepaged a proper workout. Extend the tests to all supported mTHP orders, check exactly which windows collapsed, and make scan completion deterministic. Race collapse against faults, pinning, fork and remap; verify that the contents survive. Add coverage for whole-page-table zaps and memory pressure too. - "selftests/mm: separate GUP microbenchmarking from functional testing" (Sarthak Sharma): Untangle GUP benchmarking from correctness testing. Move the benchmark into tools/mm, add a standalone harness-based GUP selftest, and move shared helpers into tools/lib/mm. Give each tool one job instead of mixing timing measurements with correctness checks. Cover the mapping, pinning and batch-size combinations explicitly. - "mm: Switch device DAX to section-based vmemmap optimization" (Muchun Song): Apply section-based vmemmap optimization to device DAX. Rework the backing metadata layout to save memory while preserving the handling of device memory hotplug and its different alignment and lifetime requirements. - "mm: Introduce section-based vmemmap optimization for HugeTLB" (Muchun Song): Cut the memory consumed by HugeTLB's struct page array with section-based vmemmap optimization. Arrange the metadata so large huge pages need fewer backing pages, while keeping initialization, teardown and the various hugepage configurations straight. - "mm/huge_memory: clean up and decouple the anon and file split helpers" (Kairui Song): Separate anonymous and file-backed folio splitting, which have rather different locking and bookkeeping requirements. Move the work into separate helpers, drop dead checks and tidy swap-cache handling. Fix error paths, including one that could leave a folio frozen. Keep the swap cache cases separate from file-cache splitting. - "mm: Unconditional per-VMA locks and cleanups" (Dave Hansen): Make per-VMA locking unconditional and clean up the old conditional code around it. This removes configuration-dependent plumbing and lets callers depend on one locking model rather than carrying both cases along. - "memcg: remove the v1 soft limit" (Shakeel Butt): Remove the old cgroup v1 memory soft-limit machinery. This has long since been superseded by the newer memory-control interfaces; hauling around a separate reclaim scheme for it no longer buys us much. - "read proc/pid/smaps_rollup under per-vma lock" (Suren Baghdasaryan): Read /proc/PID/smaps_rollup using per-VMA locks where possible, rather than holding mmap_lock across the entire walk. Retain the contention fallback and add tearing tests. This considerably reduces latency when another thread is busy changing its mappings. - "mm/damon: introduce data access-as-a-data attribute" (SJ Park): Teach DAMON to expose memory access observations as data attributes, making them available to the probe and filtering machinery. Extend the interfaces, documentation and tests so the new information can be used rather than merely collected. - "Remove PG_private by using page/folio->private checks instead" (Zi Yan): Get rid of PG_private and use the folio's private pointer to say whether private data is attached. Convert the filesystem users, including erofs, f2fs and md, and clean up the old accessors and flags. There are a few special cases, notably swapcache and hugetlb, which need explicit care. - "mm: make userland page table freeing RCU-safe" (Lorenzo Stoakes): Make freeing userspace page tables safe against RCU readers. Sort out the page-table lifetime and locking rules so walkers cannot stumble over freed tables while mappings are being torn down. - "make unused huge shrinker memcg aware" (Qi Zheng): Make shmem's unused-huge-folio shrinker aware of memory cgroups, so reclaim can find those folios under the right memcg. Wire up the per-memcg tracking and its lifetime rules, and give the shrinklist its own lockdep class to avoid spurious dependency reports. - "mm: Drop pxd_ERROR()" (Anshuman Khandual): Remove the old pxd_ERROR() page-table checks and their architecture-specific baggage. Simplify the common page-table interfaces and callers now that these checks no longer serve a useful purpose. - "memcg: group struct fields by access pattern" (Shakeel Butt): Rearrange memcg's hot and cold fields according to how they're actually accessed. Keep frequently updated counters and their neighboring state from fighting over cachelines and reduce needless cacheline traffic. - "mm/damon/core: fix the size charged for a filter-trimmed region" (Donggeun Yoo): Fix DAMOS quota accounting when a filter trims a monitoring region. Charge only the part left after filtering, not the original region, and add KUnit coverage. Previously the excluded memory could eat into the quota and make schemes run more slowly than requested. - "mm/damon: add kunit and selftests for probes and probe weights" (SJ Park): Add more tests for DAMON probes and their weights, including validation and the results reported to userspace. This is mostly about catching regressions in the newer probe infrastructure before they become harder to diagnose. - "mm: memcontrol: constify the read side of the read side of the memcg API" (Tal Zussman): Mark the read-only parts of the memcg interface const, from folio and lruvec accessors to counters and swap helpers. Most of this is mechanical, but it makes the contracts clearer and lets the compiler catch accidental writes. - "mm/damon/vaddr: support {prep,apply}_probes" (SJ Park): Support the new prepare/apply probe operations in DAMON's virtual-address backend. This brings vaddr monitoring into line with the probe infrastructure and makes the added probe types useful there too. - "mm/mglru: clean up folio counters and flag usage" (Kairui Song): Simplify MGLRU's folio counters and flag handling. Remove redundant accounting paths and make the state transitions easier to follow without changing the intended reclaim policy. - "arch, mm/execmem: resolve confusion about set_direct_map_valid_noflush()" (Mike Rapoport (Microsoft)): Clarify and straighten out the set_direct_map_valid_noflush() interface across architectures and execmem. Make the requested mapping changes and the callers' expectations agree, rather than relying on subtly different architecture behavior. - "mm: zswap: free cold writeback folios promptly" (Alexandre Ghiti): Free zswap writeback folios as soon as their disk write completes. They are cold temporary buffers, so putting them on the LRU only makes reclaim rediscover them later. Extend swap-cache dropbehind and let zswap keep these folios off the LRU altogether. - "mm: gup: cleanup gup_fast call chain" (Aristeu Rozanski): Clean up the GUP-fast call chain and simplify how the fast-path helpers pass their arguments and results around. Keep the page-pin behavior the same while making the call sequence easier to maintain. - "mm: optimize zone-device memmap initialization" (Li Zhe): Speed up initialization of zone-device struct pages. Avoid redundant work when setting up large device-memory ranges, where touching every descriptor can get expensive. - "mm/zswap: shrink zswap_entry via a pool id" (Jianyue Wu): Reduce the size of zswap_entry by storing a compact pool identifier instead of a full pointer. Keep the pool lookup and lifetime handling correct while saving per-entry metadata. - "mm/damon: support access monitoring of hugetlb-backed memory" (Krishna Iyer): Let DAMON monitor hugetlb-backed memory too. Extend the relevant access checks and add coverage so those mappings no longer fall through a hole in the monitoring machinery. - "mm/execmem: fixes and cleanups for the ROX cache" (Mike Rapoport): Tidy execmem's read-only-executable cache and fix its handling of the awkward allocation and release cases. The aim is to make the cache's ownership and permission transitions more predictable. - "zsmallc: remove old object read API" (Sergey Senozhatsky): Drop zsmalloc's old object-read API and move its remaining users to the supported access mechanism. This removes a duplicate interface which we no longer need. - "mm/mempolicy: stop copying state in the interleave paths" (Gregory Price): Stop copying mempolicy state in the interleave paths when a reference to the existing policy will do. This avoids extra work and makes the ownership rules less obscure. - "mm/mglru: speed up inc_min_seq() and fix cold/hot inversions" (Barry Song): Make MGLRU's generation advancement cheaper and fix cases where cold and hot folios end up in the wrong order. Adjust the counter and list handling so reclaim doesn't keep passing over the better eviction candidates. - "mm: Fix MF_DELAYED handling on memory failure" (Lisa Wang): Treat MF_DELAYED as a partially completed memory-failure operation, not an outright failure. Propagate that result correctly through shmem and the generic handler, fix the extra-reference accounting, and add tests for the resulting SIGBUS behavior. - "tools/mm/page_owner_sort: fix --sort, add module filter, improve usage" (Ye Liu): Fix page_owner_sort's --sort handling, add module-based filtering and make the usage output more helpful. This makes the tool less frustrating when tracking down who is holding on to pages. - "mm/damon: move damos filter range arguments validation to core" (SJ Park): Move DAMOS filter range validation into the core, where all callers can share it. Also close the sysfs read-twice races which could pass inconsistent ranges, and add tests for invalid input. - "mm/damon: misc cleanups" (Zenghui Yu): Clean up a collection of small DAMON rough edges in the core, interfaces and tests. No large behavior change here, just simpler code and fewer opportunities for confusion. - "mm/damon: cleanup code, add test cases, and update guidances in docs" (SJ Park): Clean up DAMON's core and interfaces, add missing test cases and bring the documentation into line with the code. These changes should make the newer facilities easier to understand and maintain. - "mm/damon: introduce hugepage_size probe filter" (SJ Park): Add a DAMON probe filter for hugepage size. Let users select a range of folio sizes through sysfs, validate the range and document the new interface, so monitoring can concentrate on memory backed by the desired hugepage sizes. - "selftests/mm: pagemap_ioctl test fixes and cleanups" (Zenghui Yu): Fix some pagemap ioctl test assumptions and clean up their setup and reporting. Make failures point to the operation that went wrong rather than to test harness bookkeeping. - "mm: avoid large folio splits when swap is unavailable" (Johannes Weiner): Avoid splitting large folios merely to attempt swap when no swap space is available. There is little point paying for an expensive split when reclaim cannot actually swap the resulting pages out. - "mm: workingset: fix the shadow node budget under MGLRU" (Hui Zhu): Fix the workingset shadow-node budget with MGLRU enabled. Keep the shadow entries within the intended limits so refault tracking does not quietly consume more metadata than it should. - "selftests/mm: TAP output and global-state fixes" (Song Hu): Fix selftests which produce misleading TAP output or fail to restore global settings after a run. A test ought to leave the system as it found it, particularly when a whole suite follows behind. - "mm: remove page_swap_entry()" (Tal Zussman): Remove page_swap_entry() and convert its remaining users to the folio and swap-entry helpers. Lose an old page-level interface and make the swap paths a little more consistent. - "mm: refactor zonelist constructors and iterators" (Gregory Price): Refactor the zonelist construction and walk helpers to reduce duplicated logic. Keep the allocation ordering rules intact while making it clearer how zones are selected. - "mm: kmemleak: batch the struct page scan" (Breno Leitao): Scan adjacent struct pages in batches instead of taking kmemleak_lock once for every single page. This preserves scan coverage and the lock-hold bound, while cutting overhead substantially on debug kernels. - "mm/damon: misc improvements in tests and documents" (Zenghui Yu): Fix some DAMON selftests which leave kdamond running or fail under Python safe-path mode, and improve the KUnit coverage and documentation. Nothing especially glamorous, but these are worth doing. - "mm/damon: introduce probe_hits_wsum DAMOS core filter" (SJ Park): Add a DAMOS core filter using weighted probe-hit counts. This gives schemes another way to select regions based on what the monitoring probes observed. - "mm/mglru: fix ineffective memory protection for non-kswapd reclaim" (Ridong Chen): Fix MGLRU's memory protection handling for reclaim outside kswapd. The protection settings weren't having the intended effect in these paths, leaving protected memory more exposed than requested. - "mm/damon: improve readability, clarity and test coverage" (SJ Park): Simplify a handful of DAMON core helpers, clarify their behavior and expand test coverage. There are no intended userspace-visible changes in this batch. - "mm: replace PF_KCOMPACTD/PF_KSWAPD with kthread_func()" (Kefeng Wang): Stop identifying reclaim and compaction workers through the PF_KSWAPD and PF_KCOMPACTD task flags. Use their kthread functions instead and remove the redundant flag plumbing. - "mm/hugetlb: fix surplus accounting and availability checks during demotion" (Longlong Xia): Fix HugeTLB surplus accounting and availability checks when demoting huge pages. Keep the counters and reservation decisions consistent as one huge page turns into several smaller ones. - "mm/damon: add kunit tests for probe_hits handling and probe params validation" (Jason Angelov): Add KUnit tests for DAMON probe-hit handling and invalid probe parameters. These cover edge cases that were too easy to miss in ordinary monitoring tests. - "mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms" (SJ Park): Fix a few DAMON bugs in KUnit tests, quota-goal handling and the sysfs refresh interval. Small fixes, but the incorrect results and control behavior were real. - "mm: zswap: optimize zswap invalidate and store" (Kefeng Wang): Simplify zswap's invalidate and store paths to avoid avoidable lookups and work. Keep the entry lifetime rules intact while making those frequent operations cheaper. - "mm: replace custom ratelimiting logic" (Pedro Falcato): Replace hand-rolled MM rate limiting with the common kernel helpers. There is no need to maintain another local version of the same mechanism. - "mm/vmalloc: minor cleanups" (Ye Liu): Tidy some vmalloc initialization and reporting code, and pull duplicated vmap-area insertion work into a helper. No functional changes are intended. - "mm/mglru: clean up isolate_folios for readability and clarity" (Ridong Chen): Clean up MGLRU's isolate_folios() so the decisions are easier to read and verify. Keep reclaim behavior unchanged while removing unnecessary twists in the control flow. - "Catch automatic storage in IDA and Maple Tree definitions" (Yury Norov): Catch IDA and maple-tree definitions placed in automatic storage where the lifetime rules are wrong or easy to get wrong. Add checks so such mistakes are harder to slip through unnoticed. - "mm, swap: some random fixes and cleanups" (Kemeng Shi): Fix and simplify a few unrelated swap paths, removing redundant work and tidying up error handling. A small collection of things which were better fixed than left lying around. - "mm/page_io: folio conversion cleanups" (Tal Zussman): Finish some page-to-folio conversions in swap I/O, removing obsolete wrappers and using folio operations consistently. The I/O behavior is intended to remain the same. - "mm/swap: skip empty clusters in the swapoff scan" (Youngjun Park): Skip empty swap clusters during swapoff instead of walking slots which have nothing to release. This avoids pointless work on sparsely used swap devices. - "mm: trace: decode architecture-specific VMA flags" (Meijing Zhao): Teach the VMA trace output to decode architecture-specific flags, rather than leaving them as unexplained bits. That should make tracing a good deal more useful when debugging unusual mappings. - "mm, swap: don't spin on a bad swap entry" (Breno Leitao): Stop repeatedly retrying a swap entry which is already known to be bad. Make the error path terminate cleanly instead of wasting CPU chasing an entry that cannot be used. - "mm/page_isolation: fix UBSAN shift-out-of-bounds in isolate_single_pageblock" (Qi Xi): Fix an out-of-range shift in isolate_single_pageblock() and tighten its associated boundary handling. UBSAN found the issue; the result should be more robust pageblock isolation. - "mm: khugepaged: fix tracepoint UAF" (Vernon Yang): Fix a use-after-free in khugepaged tracepoint handling. Make sure the information recorded by tracing stays valid for as long as the trace event needs it. - "mm/damon: fix DAMOS bugs in core, paddr and vaddr" (SJ Park): Fix several DAMOS problems across the core and physical- and virtual-address backends. The changes close error cases and bring the implementations back into agreement. - "mm/hugetlb_cgroup: move the per-node usage along with the folio" (Hongfu Li): Move HugeTLB per-node usage accounting when folios migrate between nodes or are reparented to another cgroup. Otherwise numa_stat can retain stale charges and even underflow when the folio is freed. - "docs/core-api: memory-allocation: add k[mz]alloc_obj() and clarify kmalloc" (Mike Rapoport): Document the typed k[mz]alloc_obj() allocation helpers and clear up some kmalloc guidance. Make it easier for callers to choose the right interface. - "selftests/mm: Validate selections and scope memfd_secret setup" (Tianyi Chen): Check selftest selections before running and confine memfd_secret setup to the cases that actually need it. Avoid confusing failures caused by the test harness itself. - "mm/damon: move zero damos quota target_value handling to the core layer" (SJ Park): Handle a zero DAMOS quota goal target in the core rather than making each user of the interface invent its own rule. Keep quota decisions consistent across callers. - "mm/damon: Introduce a huge page collapsing mechanism using auto tuning" (Asier Gutierrez): Add an auto-tuned DAMON mechanism for collapsing huge pages. Use monitoring feedback to decide when collapse is worthwhile rather than forcing one fixed policy onto every workload. - "kmemleak: fix stale documentation and raise the verbose default" (Breno Leitao): Bring the kmemleak documentation up to date and require a third confirming scan before verbose kernels print a suspected leak. The extra scan helps suppress transient false positives in noisy debug builds. - "mm/memory: improve insert_pages() error handling" (Avi Weiss): Tighten insert_pages() error handling so partial failures are reported and cleaned up consistently. The caller should not have to guess how far the operation got. - "mm/damon: allow NULL or unstarted damon_ctx parameter for damon_call()" (SJ Park): Make damon_call() handle NULL and not-yet-started contexts safely. Simplify the rules for callers and avoid an indefinite wait on an invalid state. - "mm/damon: introduce pgidle_set probe filter type" (SJ Park): Add a pgidle_set DAMON probe filter, giving monitoring users another way to select pages by their idle-tracking state. Wire it through the filter interfaces and tests. - "mm/damon/core: remove unused helper functions" (Cheng-Han Wu): Remove DAMON core helpers which no longer have callers. Keep the API surface smaller rather than retaining dead code just in case. - "mm: stop calling pmd_folio() on special PMDs" (Gregory Price): Avoid calling pmd_folio() on special PMD mappings that have no struct page. The old assumption could fault in procfs walkers; use the normal-folio checks and handle those mappings properly. - "mm: remove three unused helpers from mm.h" (Tal Zussman): Remove three unused helpers from mm.h. Fewer obsolete interfaces for the next person to stumble over. - "mm/damon: improvements in efficiency, error handling, documents" (Liew Rui Yan): Skip needless DAMOS quota work once the quota is full, propagate a missing sysfs error and tidy a couple of comments. The ignored error could make a monitoring-start request appear successful when it wasn't. - "docs/mm/damon/design: add explanation of nr_snapshots" (Liew Rui Yan): Explain DAMON's nr_snapshots accounting in the design documentation and straighten out the associated terminology. Make it clearer what users should expect from that counter. - "selftests/cgroup: fixes for test_zswap on single core VM" (Wilson Felipe Pereira): Fix two test_zswap failures on single-CPU VMs. Wait for the exiting child's cgroup to become unpopulated before reconfiguring it, and avoid another test assumption which breaks under constrained scheduling. - "docs/ksm: fix advisor documentation and comment" (Jinjiang Tu): Correct the KSM advisor documentation and a misleading code comment. Keep the description aligned with how the advisor actually works. - "Fix bugs in HugeTLB allocation when mem_cgroup_charge_hugetlb() fails" (Ackerley Tng): Fix HugeTLB allocation cleanup when the memcg charge fails. Make sure failure exits undo what was allocated rather than leaving stale accounting or resources behind. - "mm, memcg: fix memory.peak reset clobbering other fds' watermark" (Ridong Chen): Fix memory.peak reset handling so resetting one file descriptor doesn't overwrite the watermark kept for another. Keep those per-open measurements independent as intended. - "mm: reject zone device folios in more folio walkers" (Gregory Price): Reject zone-device folios in page walkers that cannot safely handle them. Extend the existing checks rather than assuming every folio has ordinary system-memory backing. - "percpu: remove code with no effect" (Sang-Heon Jeon): Remove a few pieces of percpu code which no longer do anything. There is no reason to keep maintaining dead paths. * tag 'mm-stable-2026-10-19-21-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (539 commits) mm: shmem: assign a lock class to the unused huge shrinklist mm: vmscan: put rotation-missed folios at the LRU tail mm: kmemleak: scan the struct page array in MAX_SCAN_SIZE batches mm: kmemleak: move the struct page scan into a helper mm/damon: document that a zero sample_interval is accepted mm/damon: fix typos in comments mm/damon/sysfs: propagate damon_call() error in turn_damon_on mm/damon/core: skip quota score setup when the quota is full mm/damon/tests/core-kunit: test the size charged for a filter-trimmed region mm/damon/core: charge only the part of a region the filter left mm: disallow raw PFN mappings of huge/shared zeropage selftests/mm: zap whole PTE tables in the khugepaged race harness selftests/mm: add memory-pressure threads to the khugepaged race harness selftests/mm: race the collapse of windows with holes selftests/mm: add khugepaged race harness selftests/mm: check that one khugepaged pass collapses one window selftests/mm: run every supported collapse order by default selftests/mm: cover a shared-source collapse write race selftests/mm: parameterize the mixed-source collapse case by source order selftests/mm: add order-parameterized khugepaged collapse cases ...
10 daysMerge tag 'alpha-fixes-v7.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha Pull alpha floating point emulation fix from Matt Turner: "Make the FP emulation determine tininess after rounding, as the hardware does. soft-fp always determined it before rounding, so an operation that trapped for software completion could report an underflow the same operation would not report when it did not trap. glibc's math testsuite catches the disagreement. This adds _FP_TININESS_AFTER_ROUNDING to the shared soft-fp code in include/math-emu/, as glibc's copy already has, and sets it only for alpha. It defaults to zero, so powerpc, sh and sparc are unchanged. This is the last patch of a three-patch series; the first two were merged for v7.3" * tag 'alpha-fixes-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha: alpha: determine tininess after rounding in the FP emulation
11 daysMerge tag 'kbuild-7.4-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull Kbuild / Kconfig updates from Nathan Chancellor: "Kbuild: - Suppress compiler flags in debug info for external module builds - Use '-fmacro-prefix-map' in more places in the build - Merge initial set of changes from Lorenzo's speed up series, along with some fixes found through testing: - Avoid allocating .modinfo in vmlinux - Speed up kallsyms by indexing symbols by token and outputting binary data to disk directly then including in assembly via .incbin - Don't sort $(NM) output when unnecessary - Only emit relocations on the final vmlinx link - Reimplement mksysmap in C - Move many cc-option and ld-option calls into the Kconfig stage to cache their results - Use pigz for gzip compression when available - Move gen_init_cpio and gen_initramfs.sh from usr/ to scripts/ - Add a TOML configuration to scripts/container and update documentation accordingly - Add a generic, opt-in mechanism for checking that headers can compile standalone - Update machine function splitting argument for LLVM 24 rename in AutoFDO build - Miscellaneous minor clean ups, fixes, and hardening, mostly found/fixed via LLMs Kconfig: - Turn recursive ranges into an error - Fix savedefconfig for defaults that were adjusted for being out of range and revert a previously applied workaround - Improvements and hardening around integer and hexadecimal values - Emit a warning when selecting or implying a choice symbol, which has no effect - Emit a warning when KCONFIG_PROBABILITY is malformed - Introduce def_string / def_int / def_hex to mirror the existing def_bool / def_tristate to succinctly set a value and type at the same time. - Add cc-option-str and ld-option-str macros to act like Kbuild's cc-option and ld-option, returning the string when the option is supported, allowing many checks to be moved into Kconfig - Minor usability improvements to Kconfig tests" * tag 'kbuild-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (59 commits) kbuild: AutoFDO: Update split machine function argument for upstream rename kbuild: Mark the initcall ordering recipe as recursive kbuild: Mark the gzip recipes as recursive localmodconfig: Explicitly report boolean configs during integrity check scripts/make_fit: Ignore schema checks when decomposing DTBs clang-tools: Import os for broken pipe handling kconfig: use the value argument in sym_get_near_range_bound() kconfig: fix infinite loop in conf_choice() when no choice value is visible kconfig: cleanup stale comment about 'keys' array kconfig: Improve ergonomics around disabling warnings with cc-option scripts/Kconfig.toolchain: Drop compiler symbols from dependencies checkkconfigsymbols.py: Parse Git status output line by line gen_init_cpio: stop parsing on lines with a missing argument list .gitignore: drop Module.markers .gitignore: ignore pacman package signatures kbuild: add header check facility as a manually run static analyzer Documentation: dev-tools: refer to user ID rather than id Documentation: dev-tools: update container.rst with config file scripts: add TOML config to container tool kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments ...
11 daysMerge __{get,put}_user() removal branchLinus Torvalds
This is long over-due: the __get_user() and __put_user() functions are entirely historical, and are never the rigth thing to use any more. And when mis-used (read: every case) they are not only slower than the right thing, but also insecure because they don't check the user address range. Most of the usage sites have been converted long ago, but various left-overs remained. So this started out as a single patch that I wrote as a "show people how to convert __{get,put}_user() to modern code". In particular, Thomas last year implemented the very nice new scoped user access region helpers (see commit e497310b4ffb: "uaccess: Provide scoped user access regions") that makes the modern interfaces particularly easy to use and really removes any excuse for the old horrors. That small example patch then grew to this, partly using Claude as a glorified coccinelle script to apply the pattern to other places. There were a few different reasons for using __put_user() and __get_user() rather than the alternatives, but the original historical one was performance: when doing multiple accesses off the same base pointer, doing a single range check followed by multiple non-checked accesses used to create smaller and faster code. The keyword here is "used to". It hasn't been true for years, because the range check isn't actually the real cost these days. The real cost of user accesses on modern hardware is turning the user accesses on and off in the first place (on x86, using the STAC/CLAC instructions). Those sequences get turned into 'scoped_user_read_access() { }' blocks, see for example that first patch in the series: "signal: use scoped user access for old-style sigaction". Another, historical reason for using __get_user() and friends is that you actually want to do a kernel pointer access, but the pointer might not be entirely reliable (typically during fault handling), so you want to have exception handling for the kernel access. The modern way to do that kind of non-faulting kernel access is using "get_kernel_nofault()", but some code predates that helper existing at all, and used __get_user() as a way to just get a memory access with exception handling. For that pattern, see for example "alpha: use get_kernel_nofault() in dik_show_code()" A third bad reason for using __get_user() and friends was that the proper get_user() had a "might_fault()" in it, and code that ran in atomic regions but hadn't disabled page faults would result in a warning. That kind of code needs to explicitly disable page faults, because "atomic region" is not well defined at run-time and can be invisible (eg a preempt-off region in a non-preemptible kernel). See "vdpa_sim: disable page faults around vringh_need_notify_iotlb()" for an example of that pattern, where the local_bh_disable() now also grows a pagefault_disable(), which makes the normal get_user() no longer warn about the user access in non-process context, because it can see that the potential page fault will not cause problems. And finally, the really nasty reason to use __get_user() and friends: pointers that can be either kernel pointers or user pointers. We've gotten rid of almost all such cases, but a couple remained. See for example "x86/sev: Use explicit user-or-kernel accessors for #VC memory operands". NOTE! This series removes all __get/put_user() calls from generic code but only does the final removal of the whole interface on x86. Other architectures have not been entirely converted, for a variety of reasons: - arm64 makes __{get,put}_user() be exactly the same as {get,put}_user() so it's harmless and didn't have the dangers of the legacy use cases. - any architecture that uses <asm-generic/uaccess.h> will still use __{get,put}_user as the underlying helper function name - several architectures had some legacy uses that weren't entirely trivial and I didn't want to extend this patch series to things that I don't know and that don't really matter. but I did do a couple of the obvious "follows the exact same pattern" just because it could be done mindlessly and automatically. Let's see if I broke anything, but we should have done this years ago. * uaccess-cleanups: (48 commits) drm/i915/gem: ignore errors on presumed_offset write-back powerpc/align: use get_user_instr() for a user-mode instruction powerpc/signal64: use scoped user access in setup_trampoline() powerpc/signal64: use get_user() for the single context reads powerpc/signal32: use get_user() for the single context reads KVM: PPC: Book3S HV: use get_user()/put_user() for the HPT fd powerpc/powernv: use get_user()/put_user() in the LPC debugfs files s390: use get_user()/put_user() instead of the unchecked variants ARM: OABI: use scoped user access in epoll_put_uevent() ARM: signal: stop using __put_user() for the signal frame ARM: signal: check the FDPIC function descriptor address alpha: split the prefetch check in do_page_fault() by mode openrisc: use get_kernel_nofault() in show_registers() alpha: use get_kernel_nofault() in dik_show_code() nios2: use scoped user access for the signal frame nios2: check the signal frame address before writing to it hexagon: use scoped user access for the signal frame alpha: use scoped user access when setting up signal frames alpha: use scoped user access in the sigreturn path alpha: use scoped user access in osf_sigaction() ...
12 daysalpha: add simd_enabled argument to perf_reg_validate()Thomas Weißschuh
Align the alpha function with the generic function signature. The alpha function was added in commit 9280e99d87dd ("alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP support") while the generic function signature was changed in commit a2c64c74c029 ("perf: Enhance perf_reg_validate() with simd_enabled argument"). After both commits landed in Linus' tree the signatures now differ, resulting in a build error: arch/alpha/kernel/perf_regs.c:46:5: error: conflicting types for 'perf_reg_validate'; have 'int(u64)' {aka 'int(long long unsigned int)'} 46 | int perf_reg_validate(u64 mask) | ^~~~~~~~~~~~~~~~~ In file included from include/linux/perf_event.h:50, from arch/alpha/kernel/perf_regs.c:4: include/linux/perf_regs.h:13:5: note: previous declaration of 'perf_reg_validate' with type 'int(u64, bool)' {aka 'int(long long unsigned int, _Bool)'} 13 | int perf_reg_validate(u64 mask, bool simd_enabled); | ^~~~~~~~~~~~~~~~~ Add the missing argument. Fixes: 742f62b63904 ("Merge tag 'alpha-for-v7.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha") Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Link: https://patch.msgid.link/20261021-alpha-perf_reg_validate-v1-1-a8e8cc23ea7a@linutronix.de
12 daysalpha: determine tininess after rounding in the FP emulationMatt Turner
IEEE 754 lets an architecture determine tininess of a floating-point result either before or after rounding, but requires the same choice for every operation. Alpha determines it after rounding, and stdlib's tst-tininess confirms the hardware does so for the results it produces itself. The soft-fp emulation has no notion of the distinction and always determines tininess before rounding, so a result that the hardware would not consider tiny is reported as underflowing whenever the instruction happens to trap for software completion. The two paths then disagree on the same machine. A multiply of the largest subnormal double by 1 + 2^-52 rounds up to the smallest normal and raises no underflow when the operands are normal, but raises it when an operand is subnormal and the instruction traps: glibc math testsuite, test-float32x-float64-mul: Failure: mul_double (0x3.ffffffffffffcp-1024, 0x1.0000000000001p+0): Exception "Underflow" set Add _FP_TININESS_AFTER_ROUNDING, as glibc's copy of soft-fp has, and set it for alpha. It determines tininess by rounding a copy of the result as if the exponent range were unbounded, which is what the definition asks for. A plain check of whether the rounded result came out normal is not equivalent: it differs for values that are still tiny once rounded with an unbounded exponent range but reach the smallest normal on the coarser subnormal grid. That plain check is what the hardware itself does (it decides tininess from the delivered result), and it is why a divide such as -0x4p-128 / 0x1.000002p+0 in FE_DOWNWARD delivers -0x1p-126 and raises nothing although the result is tiny after rounding. Such cases do not trap, so the emulation never sees them; where it does get control, it follows the definition rather than reproducing that deviation, which is what glibc's soft-fp does as well. The macro defaults to zero, so powerpc, sh and sparc keep determining tininess before rounding as they do now. Cc: stable@vger.kernel.org # 5.15+ Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20260803-alpha-fp-exceptions-v1-3-c99d75608e60@gmail.com Signed-off-by: Matt Turner <mattst88@gmail.com>
12 daysMerge tag 'alpha-for-v7.4-tag' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha Pull alpha updates from Magnus Lindholm: "This completes Alpha's conversion to GENERIC_ENTRY and enables a range of kernel features through Kconfig updates, including UBSAN, gcov, kmemleak, page-table checking, fast GUP and sparse IRQs. It includes TLB and MMU context fixes prompted by glibc test-suite failures, HugeTLB support for 64KB, 512KB and 4MB pages, and fixes for poisoned-page faults and page-table checking. Machine-check handling is improved on Tsunami platforms, with bounded EV6 logout decoding, Clipper environmental event reporting and safer firmware console-log scanning. Other changes add self-extracting compressed kernels with support for all kernel compression formats, Alpha-specific XZ tuning, perf register and user-stack sampling, and Alpha support in the seccomp selftests. The series also fixes user stack-pointer reporting and IRQ entry ordering, adds 128-bit shift helpers, cleans up linker sections, and updates Kconfig help" * tag 'alpha-for-v7.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/lindholm/alpha: (57 commits) alpha: add bounded Clipper console-log scanning alpha: decode Clipper environmental events alpha: decode and acknowledge Tsunami system machine checks alpha: bound EV6 logout decoding by the processor area alpha: describe the Tsunami system machine check frame alpha: move Tsunami machine check handling to err_tsunami.c alpha: fill in pc for software event samples alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP support alpha: use user_stack_pointer() in KSTK_ESP() and dump_elf_thread() alpha: stop storing the user stack pointer in pt_regs alpha: fix stale user_stack_pointer() selftests/seccomp: add Alpha support to seccomp_bpf alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms alpha: do not clear remote MMU contexts in migrate_flush_tlb_page() alpha: invalidate the local context in flush_icache_user_page() alpha: invalidate the local context in flush_tlb_mm() alpha: fix the local TLB invalidate in the UP flush_tlb_page() alpha: fix the local TLB invalidate in flush_tlb_page() alpha: invalidate the local context in flush_tlb_page() alpha: only use a targeted tbi() when the target mm is really current ...
12 daysalpha: split the prefetch check in do_page_fault() by modeLinus Torvalds
Before EV6, a load into $31 or $f31 could fault, so do_page_fault() reads the faulting instruction and skips it if it is such a prefetch. The PC can be a user or a kernel address, since the check runs for faults from either mode, and it reads it with __get_user() either way. That only works because alpha's __get_user() does no address check. It also ignores the error, relying on the fault fixup zeroing the instruction, which does not decode as a prefetch. Move the check into is_prefetch(), and read the instruction with get_user() for a user-mode PC and get_kernel_nofault() for a kernel one. A failed read now explicitly means "not a prefetch". This is part of getting rid of __get_user() and __put_user() entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 daysalpha: use get_kernel_nofault() in dik_show_code()Linus Torvalds
dik_show_code() dumps the instructions around the PC when the kernel dies. Both callers, die_if_kernel() and the kernel unaligned-access handler, only get there for a kernel-mode PC: die_if_kernel() returns early for user mode, and user-mode unaligned traps go to do_entUnaUser() instead. It reads that kernel text with __get_user() through a cast to a user pointer. That works only because alpha's __get_user() does no address check, and it predates get_kernel_nofault(), which is the interface for exactly this: a kernel address that may not be mapped, read with page faults disabled. This is part of getting rid of __get_user() and __put_user() entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 daysalpha: use scoped user access when setting up signal framesLinus Torvalds
setup_sigcontext() writes the whole register set with __put_user() and __copy_to_user(), OR-ing the errors together, relying on its callers' access_ok() on the frame. setup_frame() and setup_rt_frame() write the sigreturn trampoline, and setup_rt_frame() the ucontext header, the same way. Do those writes inside scoped_user_write_access() with unsafe_put_user() and unsafe_copy_to_user(). on_sig_stack() is evaluated before the scope, and the instruction cache flush stays outside it. The up-front access_ok() calls stay: setup_rt_frame() still needs its own for the __copy_to_user() of the signal mask. A fault part way through now stops at the first failing write instead of carrying on. Either way the frame setup fails and the task gets SIGSEGV. alpha has no user_access_begin(), so the accesses themselves are the same as before. This is part of getting rid of __get_user() and __put_user() entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 daysalpha: use scoped user access in the sigreturn pathLinus Torvalds
restore_sigcontext() reads the whole saved register set with __get_user() and __copy_from_user(), OR-ing the errors together. It relies on its callers having done access_ok(): do_sigreturn() on the sigcontext, do_rt_sigreturn() on the enclosing ucontext. Make it do its own check, with a scoped_user_read_access() around unsafe_get_user() and unsafe_copy_from_user(). do_sigreturn() then only needs the same for the signal mask. do_rt_sigreturn() keeps its access_ok(), which its own __copy_from_user() of the mask still needs. A fault part way through the frame now stops the restore there, instead of carrying on with zeroes and still writing the user stack pointer. Either way the sigreturn fails and the task gets SIGSEGV. alpha has no user_access_begin(), so the accesses themselves are the same as before. This is part of getting rid of __get_user() and __put_user() entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 daysalpha: use scoped user access in osf_sigaction()Linus Torvalds
osf_sigaction() does one access_ok() on each user structure and then reads or writes its fields with __get_user() or __put_user(), the same pattern as the generic old-style sigaction(). Convert it the same way, to scoped_user_{read,write}_access() with unsafe_{get,put}_user(). alpha has no user_access_begin(), so the scope is the same access_ok() followed by the same plain accesses, and the generated code does not change. This is part of getting rid of __get_user() and __put_user() entirely. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-10-18alpha: add bounded Clipper console-log scanningMagnus Lindholm
Clipper console logs have an HWRPB byte count. Bound wrapper and child traversal by that count before decoding embedded processor and system logout frames. Print the wrapper name and event/halt timestamp, halt code, and recorded CPU ID for processor packets. Acknowledge the log only after a complete termination packet. Retain the firmware pointer on unknown or incomplete wrappers and print at most 1 KiB of raw bytes using print_hex_dump(). This avoids the generic scanner's unconditional acknowledgment after a parsing failure. The ES40 record observed during testing is class 5, type 4. Its wrapper layout is unknown and remains raw and unacknowledged; it may therefore be printed again at each boot. Successful decoding of a nonempty hardware log remains unverified. Keep console scanning independent of the live machine-check and environmental handlers and restrict it to Clipper. Console environmental payloads also remain raw: ES40 Service Guide Table D-18's sys_offset conflicts with its field offsets. No register layout is assumed for unverified extended subpacket types 6 and 7. The scanner invokes the payload decoder directly during PCI init; no generic subpacket-handler registration is needed. Mark its helpers __init and retain the PCI init hook in sys_dp264.c. Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: decode Clipper environmental eventsMagnus Lindholm
Restrict ES40 live environmental decoding to Clipper. Validate frame bounds and string-table masks, and separate fault bits from status context. Report valid notifications even when no recognized fault bits are set, so door-closed and supply-return notifications remain visible. A single status snapshot does not establish a recovery transition. Keep SMIR bit 0 and inverted halt/reset bits as raw context. During the ES40 PSU cable test, bit 0 remained set after the individual PSU failure indication cleared. Its polarity/latching is unverified, so do not call it a current PSU failure. Use mask 0x14 for the remaining SMIR faults. Decode only QW1 through QW7 as live environmental status, as documented in the ES40 Service Guide, Tables D-20 and D-21. Use plain door-status messages. Preserve unknown or truncated frames in bounded raw dumps. Firmware console-log scanning is independent of the live environmental handler. Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: decode and acknowledge Tsunami system machine checksMagnus Lindholm
Decode PCI and ECC transactions separately, honor invalid transaction information, and select Pchip errors using the logout summary. Report master aborts without importing Titan-specific dismissal policy. Delegate processor vectors to the bounded EV6 decoder. On system vectors 660/620, capture live PERROR and MISC before acknowledging their defined W1C bits and report live status absent from the saved frame. Leave live chipset registers alone on CPU and environmental vectors: HRM 10.2.5.6 warns that PERROR can have INV set before the error reaches DRIR. Consuming that state from a CPU vector could lose the transaction and its pending system-error notification. Leave PERRMASK as configured by firmware. HRM 10.2.5.7 says a cleared mask bit prevents the corresponding PERROR bit from being set, including by PERRSET. Table 10-43 gives a reset value of zero, so this reporting depends on firmware enabling the errors; changing masks does not establish that previously latched state is cleared. Table 10-42 marks PERROR bit 9 reserved (MBZ/RAZ); remove the obsolete RTO definition and reserve its bitfield. Use the system vector and frame bounds without restricting the reason code to the ES40 values. Preserve invalid frames and unknown environmental layouts in bounded raw dumps. Print CPU registers for uncorrectable system errors, including the PC needed to diagnose NXM. Gate correctable system register dumps on CONFIG_VERBOSE_MCHECK and alpha_verbose_mcheck while retaining their error decode. Keep transaction information unavailable whenever SERR is set, as required by HRM 8.8.2.6. Table 10-42 selects ECC fields for CRE/UECC. The first error freezes PERROR and only LOST can be set afterwards, so mixed error bits were detected together. The expected-probe path has no active Tsunami writer. Reporting and acknowledgment do not establish recovery; panic policy remains separate. Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: bound EV6 logout decoding by the processor areaMagnus Lindholm
The ES40 Service Guide, Table D-19, documents a correctable frame with its system area at 0x58 and total size 0x80. The existing EV6 decoder interprets system words as extended CPU registers and reads past its end. This establishes the layout for ES40; whether Titan and Nautilus PALcode also emits this short frame has not been verified. Validate the processor area before decoding it and only print extended registers when present. Preserve rejected frames with a raw dump rather than trusting their invalid offsets. Cap the dump at 1 KiB and round down to complete quadwords. This still relies on firmware supplying an accessible frame of its advertised size; the cap is not pointer validation. Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: describe the Tsunami system machine check frameMagnus Lindholm
Define the five system-specific quadwords in the SRM logout frame, as documented in the AlphaServer ES40 Service Guide, Table D-19. Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: move Tsunami machine check handling to err_tsunami.cMagnus Lindholm
Move the existing handler and PCI error clearing helpers without changing their behavior. Build the error objects for ALPHA_TSUNAMI so that all Tsunami configurations, including non-generic Shark, can use them. Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: fill in pc for software event samplesMatt Turner
Context switch and tracepoint events have no trap frame, so perf builds one with perf_fetch_caller_regs(). Alpha does not define perf_arch_fetch_caller_regs(), which leaves that pt_regs zeroed, and these samples report pc as 0. Record the caller's address as pc. The zero ps already marks the frame as kernel mode, and pt_regs has nowhere to keep sp, so pc is all that can be filled in. perf_fetch_caller_regs() gets that address from CALLER_ADDR0, which alpha defines as 0 when CONFIG_FRAME_POINTER is disabled. Finding the level zero return address does not need a frame pointer, so make alpha_ftrace_return_address0() available in both configurations. Only ftrace_return_address(n) still depends on frame pointers. Reported-by: Magnus Lindholm <linmag7@gmail.com> Closes: https://lore.kernel.org/all/CA%2B%3DFv5S8-Zk8-LUpZnWiBfTGSQXthepmRc_-a9O%2BpEPmVW0mRA@mail.gmail.com/ Suggested-by: Magnus Lindholm <linmag7@gmail.com> Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Acked-by: Ian Rogers <irogers@google.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261018-alpha-perf-regs-v3-v3-5-52be85332c57@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: add HAVE_PERF_REGS and HAVE_PERF_USER_STACK_DUMP supportMatt Turner
Let perf sample registers and dump the user stack, which is what the perf tool needs for --call-graph dwarf. The register indices follow the hardware numbering, so r0-r30 map directly to DWARF register numbers, with pc after them. r9-r15 are callee-saved and live in switch_stack rather than pt_regs, so they cannot be sampled. Without r15 an unwinder cannot recover the CFA of a first frame that uses $15 as its frame pointer. sp is not in pt_regs either: for user frames it comes from user_stack_pointer(), and for kernel frames (PERF_SAMPLE_REGS_INTR) it is the end of the trap frame, as in stacktrace.c. Software events such as context switches and tracepoints hand perf a per-CPU pt_regs filled in by perf_fetch_caller_regs() instead of a trap frame. It is not on the stack and has no room for sp, so report sp as 0 there rather than the address of the per-CPU buffer. Assisted-by: Claude:claude-opus-5-5 Acked-by: Ian Rogers <irogers@google.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261018-alpha-perf-regs-v3-v3-4-52be85332c57@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: use user_stack_pointer() in KSTK_ESP() and dump_elf_thread()Matt Turner
Both open-code the same PCB lookup. Assisted-by: Claude:claude-opus-5-5 Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Acked-by: Ian Rogers <irogers@google.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261018-alpha-perf-regs-v3-v3-3-52be85332c57@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: stop storing the user stack pointer in pt_regsMatt Turner
Nothing reads pt_regs->usp now that user_stack_pointer() uses the PCB. Drop the stores, which saves a PAL_rdusp call on every syscall, and give the field back its old name. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Acked-by: Ian Rogers <irogers@google.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261018-alpha-perf-regs-v3-v3-2-52be85332c57@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: fix stale user_stack_pointer()Matt Turner
PALcode keeps the user stack pointer in the PCB, not the trap frame, so pt_regs->usp is only valid where entry code stores it: entSys, do_entArith() and do_entIF(). Interrupts, page faults and unaligned traps leave it stale, and ptrace and /proc/<pid>/syscall read it through user_stack_pointer(). A user-mode pt_regs is at the top of its task's stack, so find the thread_info from it and use rdusp() for current or pcb.usp otherwise, as KSTK_ESP() and the regset code already do. Fixes: 8a2857bc2b30 ("alpha: enable regset-based ptrace and core dumps") Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Acked-by: Ian Rogers <irogers@google.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261018-alpha-perf-regs-v3-v3-1-52be85332c57@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: do not skip TLB shootdown IPIs for kthread-borrowed mmsMagnus Lindholm
flush_tlb_mm(), flush_tlb_page() and flush_icache_user_page() skip the shootdown IPI when mm_users <= 1, on the assumption that no other CPU can be running the mm. A task that borrows an mm through kthread_use_mm() takes mmgrab() rather than mmget(), so it never appears in mm_users, and kthread_use_mm() may be handed an mm that is already the caller's active_mm and loaded on that CPU. Such a CPU was not only left without an IPI, its mm->context[cpu] was cleared from under it. mm->context[cpu] is already the record of which CPUs hold an ASN for the mm. Test it rather than clearing it: take the shortcut only when no other CPU has one, and otherwise fall through to the IPI, which invalidates those CPUs properly. A CPU that merely ran the mm in the past also holds a context and now costs an IPI, which errs in the safe direction. Change ipi_flush_tlb_mm(), ipi_flush_icache_page() and the migration callback ipi_flush_mm_and_page() to test current->mm, like ipi_flush_tlb_page(). A CPU that only retains the mm lazily then clears its own slot through flush_tlb_other(), rather than publishing a new ASN on every IPI or migration rendezvous. The migration callback still does its per-VA tbi() afterwards. Returning to the mm allocates a fresh ASN through ev5_switch_mm(), or through the direct-load path when kthread_use_mm() switches current's mm. Once these historical slots are gone, the shortcut is available again if mm_users remains at most one and no other CPU has taken or kept a context. An explicit kthread_use_mm() borrower has current->mm set and still receives the invalidate it needs. The caller-side tests in flush_tlb_mm() and flush_icache_user_page() remain current->active_mm. A kernel thread that flushes its lazily held mm can therefore publish its own context slot. Those branches also perform the shortcut check, which excludes the calling CPU's slot, so leave them unchanged. This is distinct from a remote lazy CPU keeping its slot populated through repeated callbacks. Together with the preceding patch, dropping these clearing loops leaves every runtime write to mm->context[] targeting the writing CPU's own slot, so the array becomes a lockless publication of which CPUs may be using the mm, with a single writer per slot. Mark the two stores that are now observed from other CPUs; flush_tlb_other() already uses WRITE_ONCE(). The uniprocessor flush_icache_user_page() is left alone, as nothing reads another CPU's slot there, and init_new_context() runs before the mm is shared. Order the slot reads after the page-table changes with smp_mb(). On the publishing CPU, the store in ev5_switch_mm() precedes the mb() in Alpha's arch_spin_unlock(), when finish_lock_switch() drops the rq lock. This relies on Alpha's unlock implementation, not a generic scheduler promise of a full barrier on unlock; document that reliance at the store. Also issue smp_mb() after publishing in __load_new_mm_context(), before loading and using the mm. This covers every caller, including check_mmu_context(), which can publish a replacement after finish_lock_switch() has already run. This requires the preceding removal of remote slot clearing from migrate_flush_tlb_page(). It also requires the stale-TLB series to set need_new_asn on both the reused and newly allocated ASN paths. Otherwise an IPI between finish_lock_switch() and check_mmu_context() can zero a new slot while asn_lock is set, and the task can return to user space with a live ASN that the shortcut cannot see. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: <stable@vger.kernel.org> # 53ab52cfe5ce: alpha: load the MMU context when switch_mm() switches the current task Cc: <stable@vger.kernel.org> # 01df8f401888: alpha: run check_mmu_context() from finish_arch_post_lock_switch() Cc: <stable@vger.kernel.org> # ef43cfc28c42: alpha: only use a targeted tbi() when the target mm is really current Cc: <stable@vger.kernel.org> # 738cf8f7a78f: alpha: invalidate the local context in flush_tlb_page() Cc: <stable@vger.kernel.org> # 62c92086f30e: alpha: fix the local TLB invalidate in flush_tlb_page() Cc: <stable@vger.kernel.org> # 3faee097b939: alpha: fix the local TLB invalidate in the UP flush_tlb_page() Cc: <stable@vger.kernel.org> # b2c3b654bb64: alpha: invalidate the local context in flush_tlb_mm() Cc: <stable@vger.kernel.org> # f19ae6f51a38: alpha: invalidate the local context in flush_icache_user_page() Cc: <stable@vger.kernel.org> # 471e7f9c890b: alpha: do not clear remote MMU contexts in migrate_flush_tlb_page() Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010144621.974850-3-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: do not clear remote MMU contexts in migrate_flush_tlb_page()Magnus Lindholm
After the on_each_cpu() rendezvous, migrate_flush_tlb_page() walks the other CPUs and zeroes their mm->context[cpu] when mm_users is at most one, described as mimicking flush_tlb_mm()'s mm_users<=1 optimization. It is not one. flush_tlb_mm() tests mm_users before deciding whether to send the IPIs; here every CPU has already been visited and waited for, so nothing is saved. The callback has also just set each CPU's own slot correctly, so the loop only overwrites it, and does so while that CPU may still be running in the address space. Remove it. The shootdown shortcuts in flush_tlb_mm(), flush_tlb_page() and flush_icache_user_page() clear remote slots too; once the next patch removes those as well, every runtime update of mm->context[cpu] is made by CPU cpu itself. That patch relies on the invariant when it reads those slots to decide whether a shootdown can be skipped, so this one is tagged for stable as its prerequisite. Fixes: dd5712f3379c ("alpha: fix user-space corruption during memory compaction") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010144621.974850-2-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: invalidate the local context in flush_icache_user_page()Magnus Lindholm
flush_icache_user_page() has the same caller-CPU omission that the previous patch fixed in flush_tlb_mm(): when the target mm is not the calling CPU's active_mm nothing happens locally, and smp_call_function() handles only the other CPUs, so this CPU may later reuse the old ASN together with the translations it still holds. This matters here in particular because the function exists for operating on another process's mappings: the comment above it describes setting breakpoints through ptrace, and access_remote_vm() reaches it through copy_to_user_page(). The calling CPU is therefore often running something other than the target mm. As in flush_tlb_mm(), the uniprocessor implementation in asm/cacheflush.h already has the missing case. No imb() is needed, here or in ipi_flush_icache_page(). Alpha's user-space I-cache flush works by allocating a new ASN rather than by invalidating the I-cache: the entries stay, but they are tagged with the old ASN and can no longer match. An imb() is only required when the ASN space wraps and numbers are reused, and __get_new_mm_context() already does one in that case. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-9-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: invalidate the local context in flush_tlb_mm()Magnus Lindholm
flush_tlb_mm() has the same caller-CPU omission that was fixed in flush_tlb_page(): when the target mm is not the calling CPU's active_mm nothing happens locally, and smp_call_function() handles only the other CPUs, so this CPU may later reuse the old ASN together with the translations it still holds. The active_mm test itself is left alone here. That path calls flush_tlb_current(), which loads a fresh context through __load_new_mm_context() rather than issuing a targeted tbi() against whatever ASN happens to be loaded, so it does not depend on which context is current. The uniprocessor implementation in asm/tlbflush.h already has the missing branch. Counted over a fork-heavy run, flush_tlb_mm() was entered with the mm not this CPU's active_mm 2934 times, and 632 times while otherwise idle. The proposed Alpha hugetlb support routes hugetlb invalidations through flush_tlb_range(), which calls this function. Unmapping or migrating a hugetlb folio from another context will also need this local invalidate. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-8-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: fix the local TLB invalidate in the UP flush_tlb_page()Magnus Lindholm
The uniprocessor flush_tlb_page() in asm/tlbflush.h has the same wrong test as the SMP one: a targeted tbi() is only guaranteed to invalidate the intended translations when the target mm's context is loaded, but the gate is current->active_mm, which a lazily borrowed mm also satisfies. Test current->mm instead. The else branch it falls to already exists here, so unlike the SMP side this is the whole fix. arch/alpha/kernel/smp.c is not built with CONFIG_SMP=n, so this is how the same defect reaches a uniprocessor, where the flusher kworker necessarily shares the only CPU with the writer. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-7-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: fix the local TLB invalidate in flush_tlb_page()Magnus Lindholm
flush_tlb_page() invalidates the calling CPU itself before asking the others, and gates that on current->active_mm. For a non-executable vma that means a targeted tbi(2, addr), which acts on the context currently loaded and is only guaranteed to invalidate the intended translations when the target mm's context is the loaded one. A lazy active_mm does not establish that, so as in ipi_flush_tlb_page() the target mm's stale translations can survive, and nothing forces the old ASN to be retired afterwards. Test current->mm instead. A lazy caller then takes the flush_tlb_other() branch added by the previous patch, retiring its local context. Adding that branch first preserves the local invalidate at every step, including on EV7 where a targeted tbi() against a foreign ASN appeared to work. Which callers reach here with a foreign mm depends on the configuration. folio_mkclean(), from the writeback flusher kworker that has no mm of its own, accounted for about half the calls during writeback of a shared mapping and none at all on anonymous memory. Those counts were measured with CONFIG_COMPACTION=n: with COMPACTION=y, asm/pgtable.h overrides ptep_clear_flush() to call migrate_flush_tlb_page(), which rendezvouses with every CPU and handles the context itself, so folio_mkclean() does not reach this function. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-6-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: invalidate the local context in flush_tlb_page()Magnus Lindholm
When the target mm is not the calling CPU's active_mm, flush_tlb_page() does nothing locally, and smp_call_function() reaches only the other CPUs. This CPU may still hold translations for the mm and can later reuse the old ASN together with them. Add the missing else branch. flush_tlb_other() clears mm->context[cpu] so a fresh ASN is taken at the next switch. Add this before changing the current->active_mm test to current->mm: that change will also send lazy callers here, so their local invalidate must already be in place. The uniprocessor implementations of flush_tlb_mm() and flush_icache_user_page() in asm/tlbflush.h and asm/cacheflush.h already contain exactly this branch. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-5-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: only use a targeted tbi() when the target mm is really currentMagnus Lindholm
ipi_flush_tlb_page() gates a targeted tbi() on current->active_mm. tbi() acts on the address space context currently loaded on the CPU, so it is only guaranteed to reach an mm's translations when a thread of that mm is running there. current->active_mm is not sufficient: under lazy TLB an idle or kernel task keeps an mm as its active_mm while a different ASN is loaded, so the invalidate is issued against the wrong context and the stale entry can survive. Nothing retires the old ASN afterwards either, mm->context[cpu] still being valid, so the resuming thread can reuse it. Test current->mm instead and otherwise fall back to flush_tlb_other(), which clears mm->context[cpu] and forces a fresh ASN at the next switch whatever is loaded now. For an mm borrowed through kthread_use_mm(), patch 1 of this series installs the context before the task can take a shootdown IPI. The current->mm test therefore covers that case as well. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-4-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: run check_mmu_context() from finish_arch_post_lock_switch()Magnus Lindholm
check_mmu_context() clears asn_lock and acts on need_new_asn, but it runs only as the tail of switch_to(), after alpha_switch_to() returns. A newly forked user task never gets there: its first context switch resumes at ret_from_fork and reaches schedule_tail() without returning to the code following alpha_switch_to(). asn_lock is left set on that CPU, so the new user task can run with interrupts enabled while shootdown IPIs keep taking the deferred path. The handshake meant to complete those invalidations never runs. New kernel threads also reach schedule_tail(), but context_switch() does not call switch_mm() for a task without an mm. They therefore do not set asn_lock in the first place and are not affected by this bug. Move check_mmu_context() to finish_arch_post_lock_switch(), which is called by finish_task_switch() for both existing and newly created tasks. Drop the now redundant call from switch_to(). The hook runs after finish_lock_switch() releases the rq lock and enables interrupts. An IPI arriving before asn_lock is cleared retires the slot through flush_tlb_other(); an IPI arriving afterwards can flush directly, since PAL_swpctx has already installed the incoming context. Set need_new_asn whether ev5_switch_mm() reuses or allocates an ASN. An IPI in that interval can zero either slot. Without this, the allocated case can return to user space with a live ASN but a zero context slot, which a later context-based shootdown shortcut could mistake for an inactive CPU. check_mmu_context() reloads only when the slot is zero. Call the hook unconditionally. Alpha selects ARCH_NO_PREEMPT, and neither kthread_use_mm() nor sched_force_init_mm() sleeps between the direct switch and this hook. RCU_STRICT_GRACE_PERIOD can enable PREEMPT_COUNT, but cannot make those callers migrate there. Testing preemptible() would only leave asn_lock set in that configuration. This requires the preceding direct-switch fix, "alpha: load the MMU context when switch_mm() switches the current task". It installs the borrowed context before kthread_use_mm() reaches this hook, so clearing asn_lock cannot expose a targeted invalidate against the wrong context. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-3-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: load the MMU context when switch_mm() switches the current taskMagnus Lindholm
ev5_switch_mm() only prepares the incoming PCB. The context is installed by PAL_swpctx, which alpha_switch_to() issues against that PCB on the way out of the scheduler. Direct callers reach switch_mm() without going through alpha_switch_to(): kthread_use_mm(), which borrows an mm for the current kernel thread, sched_force_init_mm() on the CPU-hotplug teardown path, and do_shoot_lazy_tlb(), which switches to init_mm from an IPI. None explicitly loads the context, so the task can carry on running under whatever was loaded before. For kthread_use_mm(), current->mm then names the borrowed mm even though its context has not been loaded. The other two callers change active_mm while leaving current->mm NULL. The stale page-table root need not be swapper_pg_dir; it may belong to a user process that ran on the CPU earlier, and the kthread's user accesses can then read and write that process's memory wherever the stale mappings allow. Translations taken that way can also end up tagged with the borrowed mm's ASN: ev5_switch_mm() writes that ASN into the PCB, which the next PAL_swpctx installs against the stale ptbr. An address the stale tables do not map faults instead, and since do_page_fault() resolves faults against current->mm without reloading the context, the same access can fault again on return. sched_force_init_mm() needs CONFIG_HOTPLUG_CPU and do_shoot_lazy_tlb() needs CONFIG_MMU_LAZY_TLB_SHOOTDOWN. Alpha selects neither, so only kthread_use_mm() is reachable in practice. Test the caller's identity rather than special-casing individual callers. The scheduler passes the incoming task, which is not current until alpha_switch_to() runs; all three direct callers pass current. Test for that and load the context the way activate_mm() does. All three run with interrupts disabled across the switch, so this completes before any shootdown can be taken and needs no asn_lock handshake. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Tested-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261010142533.974797-2-linmag7@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: implement hugetlb supportMatt Turner
Alpha has no leaf entry above the last page table level, so the only huge pages it can offer are granularity hint blocks: 64KB, 512KB and 4MB with 8KB pages. Register all three as hstates, with 4MB as the default. There is no PMD sized huge page, hence no transparent huge pages, no PMD page table sharing and no gigantic pages. As with arm64's contiguous PTEs, each PTE of a block keeps the frame number of its own page, so a block is written with set_ptes(). Each hstate's buddy order is its hint order, so a hugetlb folio is always naturally aligned physically, as the hint requires, including after a demote. All PTEs of a block must agree in bits <15:0> (note 2 of Table 22-3 of the Alpha Architecture Reference Manual), and both __ACCESS_BITS and __DIRTY_BITS reach into that range, so every update rewrites the whole block and huge_ptep_get() merges the young and dirty state back together. Rewriting a valid block in place would leave its PTEs disagreeing part way through, so changes to a valid block go through break before make, following the procedure in section 11.6.1. The hint is advisory, so this is safe on implementations that ignore it, and gup_fast needs no changes since it walks the individual PTEs. Enabling CONFIG_HUGETLB_PAGE derives pageblock_order from HUGETLB_PAGE_ORDER, which lowers it from 10 to 9 and so halves the anti-fragmentation and compaction granularity from 8MB to 4MB. Hugepage migration is left disabled, since it has not been tested. Co-developed-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261007-alpha-hugepages-v2-6-8e108af2d961@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: align hugetlb mappings in arch_get_unmapped_area()Matt Turner
hugetlb_get_unmapped_area() does not align the address itself; it delegates to mm_get_unmapped_area_vmaflags(), and the huge page alignment is applied by generic_get_unmapped_area() and generic_get_unmapped_area_topdown() via info.align_mask. Alpha defines HAVE_ARCH_UNMAPPED_AREA and supplies its own arch_get_unmapped_area(), which never sets align_mask. An mmap(MAP_HUGETLB) with no address hint would therefore return a merely page-aligned address. That has been the architecture's job since commit 7bd3f1e1a9ae ("mm: make hugetlb mappings go through mm_get_unmapped_area_vmflags"), whose series converted the generic code along with x86, s390, sparc and powerpc. LoongArch, which also has its own arch_get_unmapped_area(), was missed and hit a BUG in LTP's hugefork02 until commit 3109d5ff484b ("LoongArch: Set hugetlb mmap base address aligned with pmd size"). Pass the file down to arch_get_unmapped_area_1() and set align_mask for hugetlbfs mappings, as x86, s390, sparc and loongarch already do. This is a no-op until alpha gains hugetlb support. Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261007-alpha-hugepages-v2-5-8e108af2d961@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: define granularity hint PTE bitsMatt Turner
Bits <6:5> of the Alpha PTE are the granularity hint, described in Table 22-3 of the Alpha Architecture Reference Manual. A hint of N marks the PTE as one of a block of 8^N physically contiguous, naturally aligned pages that the translation buffer may map with a single entry. With 8KB pages that gives 64KB, 512KB and 4MB blocks. Define the field and the helpers to encode and decode it. Nothing sets a non-zero hint yet. Add the hint to _PAGE_CHG_MASK so that pte_modify() preserves it. Swap PTEs leave bits <31:0> clear, so pte_huge() is false on swap, migration and marker entries, and page table entries above the last level keep a zero hint where pmd_bad() would reject anything else. Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261007-alpha-hugepages-v2-4-8e108af2d961@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: describe the PTE read and write enable bitsMatt Turner
The comments on _PAGE_KRE and _PAGE_URE said only "xxx". Describe the four enable bits as the Alpha Linux PTE defines them, in Table 22-3 of the Alpha Architecture Reference Manual: kernel and user read enable in bits 8 and 9, kernel and user write enable in bits 12 and 13, with bits <11:10> and <15:14> reserved. There are only two processor modes, user and kernel (section 22.5.1). Linux uses the read enables as its accessed bit and the write enables as its dirty bit, so say which of __ACCESS_BITS and __DIRTY_BITS each one belongs to. The names differ from what the hardware calls those bits on the 21264. Its PALcode loads the PTE unchanged into DTB_PTE (21264/EV67 Hardware Reference Manual, section 6.9), where bits 9 and 13 are the Executive read and write enables (Figure 5-27), Executive being mode 1 of the four the processor implements (Table 5-5). That is a detail below the PALcode interface, and it is also the layout of the OpenVMS PTE in Table 11-2, which is not the one Linux uses. No functional change. Suggested-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261007-alpha-hugepages-v2-3-8e108af2d961@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: handle VM_FAULT_HWPOISON in do_page_fault()Matt Turner
do_page_fault() handles VM_FAULT_OOM, VM_FAULT_SIGSEGV and VM_FAULT_SIGBUS and then falls into BUG() for anything else in VM_FAULT_ERROR. VM_FAULT_HWPOISON and VM_FAULT_HWPOISON_LARGE are in that set, so a fault on a poisoned page takes down the kernel instead of delivering a signal. Alpha does not select ARCH_SUPPORTS_MEMORY_FAILURE, so the machine check paths cannot produce these. UFFDIO_POISON can: it installs a poison PTE marker without any memory failure support, and a subsequent access returns VM_FAULT_HWPOISON. Registering an anonymous range with userfaultfd, poisoning it and reading it back reliably hits the BUG(): Kernel bug at arch/alpha/mm/fault.c:188 poison(50809): Kernel Bug 1 pc is at do_page_fault+0x4e8/0x550 ra is at do_page_fault+0xfc/0x550 The BUG() fires with mmap_read_lock() still held, so the faulting task is left unkillable in D state holding the lock, and shutdown stalls behind it. A UFFD_USER_MODE_ONLY userfaultfd is always allowed, so any local user can do this. Deliver SIGBUS with BUS_MCEERR_AR instead, reporting the size of the poisoned area, as the other architectures do. That is the huge page size for VM_FAULT_HWPOISON_LARGE, which becomes reachable once alpha implements huge pages. Tested on an UP1500 (EV68AL): the reproducer above now takes a SIGBUS and the kernel logs poison[373]: hardware memory error at 0000020000030000 pc 00000200010007ec with no oops, no wedged task and no taint. A backport needs the show_signal_msg() call dropped, since alpha only has it since commit 9ca6af1aac40 ("alpha: select SYSCTL_EXCEPTION_TRACE"). Fixes: fc71884a5f59 ("mm: userfaultfd: add new UFFDIO_POISON ioctl") Cc: stable@vger.kernel.org # 6.6+ Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261007-alpha-hugepages-v2-2-8e108af2d961@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: add missing page_table_check_pte_clear() to ptep_get_and_clear()Matt Turner
Alpha's CONFIG_COMPACTION-gated ptep_get_and_clear() overrides the generic version in include/linux/pgtable.h but omits its page_table_check_pte_clear() call. With CONFIG_PAGE_TABLE_CHECK=y the map count taken by set_ptes() is therefore never dropped when a PTE is cleared through this path. zap_pte_range() clears PTEs this way, so the first page freed after it hits the BUG_ON() in __page_table_check_zero(). The call was instead placed in ptep_clear_flush() by commit dd5712f3379c ("alpha: fix user-space corruption during memory compaction"), where it was harmless until alpha enabled page table check. Add the missing call, and drop the now-duplicate one in ptep_clear_flush(), which already goes through ptep_get_and_clear(). Fixes: e761b6fe4085 ("alpha: add ARCH_SUPPORTS_PAGE_TABLE_CHECK support") Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Link: https://lore.kernel.org/r/20261007-alpha-hugepages-v2-1-8e108af2d961@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: default NR_CPUS to 32 for WildfireMatt Turner
The AlphaServer GS320 has up to 32 CPUs and the Wildfire code handles all eight QBBs, but a Wildfire-only kernel defaults to NR_CPUS=4 and ignores the rest unless the user raises it by hand. Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261001165018.415526-4-mattst88@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: link platform help text to the alphalinux.org wikiMatt Turner
The alphalinux.org wiki has a page for each system and motherboard covering its CPUs, firmware, Linux status and known issues. Link each platform's help text to the pages for the systems it supports. Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261001165018.415526-3-mattst88@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: correct system descriptions in Kconfig help textMatt Turner
Fix the system lists in the "Alpha system type" choice and the platform help texts, cross-checked against the alphalinux.org wiki and the kernel sources: - There is no AlphaServer GS40 or DS10E. Wildfire also shipped with EV68 (21264C) CPUs. - "AS" means AlphaServer elsewhere in the list, but the Alcor "AS 600, AS 500" are AlphaStations, as is the Noritake "AlphaServer 600A". - Takara is 21164-based, not "11164". - Linux 6.10 dropped support for CPUs before EV56, which took the AlphaStation 600 and Alpha XL 300 with it. Say once that EV56 or later is required rather than qualifying every entry. - Add systems missing from their entries: the UP1500 (Nautilus), DS15 and TS202c (Titan), Digital Server 3300 (Noritake), Digital Server 5300 and 7300 (Rawhide), and the Ruffian boards in place of "Samsung APC164UX". - Add Eiger, Nautilus and RX164 to the summary list and help text to PC164, RX164, SX164 and Shark, which had none. Note that the Ruffian and RX164 boards have no SRM console. Also drop the Jensen and EV4/EV5 references removed in 6.10, and the claim that SRM cannot boot from IDE, which is not true of SRM in general. NR_CPUS can be set to 32 on any platform, so say what the hardware supports instead of implying a per-platform kernel limit. Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261001165018.415526-2-mattst88@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: replace dead links in Kconfig help textMatt Turner
The Linux/Alpha FAQ, the unix-ag LX164 overview, the Rawhide install HOWTO and the Ruffian FAQ are all gone. Point the "Alpha system type" help at the system and motherboard lists on the alphalinux.org wiki instead, give LX164 a one-line description in place of its link, and drop the others. Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261001165018.415526-1-mattst88@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: support the remaining kernel compression formatsMatt Turner
Nothing about the boot stub is specific to gzip, so wire up bzip2, lz4, lzma, lzo, xz and zstd as well: select the matching HAVE_KERNEL_* symbol, add a suffix-y entry and a compression rule for the piggy-backed image, and include the decompressor into the stub's misc.c. Only gzip's trailer already carries the uncompressed size, so the other formats use the _with_size variants; output_len, which vmlinux.scr takes from the last 4 bytes of the payload, then works for all of them. The stub passes it to __decompress(), which zstd requires. Signed-off-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261017-alpha-kernel-compression-v2-3-c71e6b08dc63@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: add self-extracting compressed kernel boot stubMatt Turner
Alpha only ever supported gzip for the kernel image, and did so in a way out of step with every other architecture: aboot, the disk boot loader, decompresses vmlinux.gz itself with its own bundled inflate code, so adding a compression format meant writing a new decompressor inside aboot as well as in the kernel. Build a proper self-extracting arch/alpha/boot/compressed/vmlinux instead, modeled on parisc: a small ELF stub with the real, compressed vmlinux linked in, which decompresses the kernel, relocates it into place and jumps to its entry point. aboot needs no changes. The stub has no sanitizer or coverage runtime and must run on any Alpha, so it builds private copies of the arch/alpha/lib/ memory and division routines it needs instead of linking lib.a, whose objects carry the kernel's instrumentation and -mcpu=. The build now emits arch/alpha/boot/vmlinuz rather than vmlinux.gz, which was never a name aboot cared about and would be a lie for an ELF stub: the bootpz path in the same directory still produces real gzip data as vmlinux.nh.gz. Existing aboot.conf files name the image as it was installed in /boot, so only the command that copies it out of the build tree changes. Unlike parisc and mips, the stub is linked at START_ADDR rather than at a separate low address; see compressed/vmlinux.lds.S. It has no console output, since bringing up the HWRPB console callbacks needs more than the CRB dispatch the kernel proper does much later, so error() just halts. The legacy SRM netboot path (bootpz.c) is left alone: it has its own boot protocol (PALcode reinitialization, self-populated ZERO_PGE, build-time-computed image sizes) that does not fit this design without a separate rewrite, and keeps using plain gzip via vmlinux.nh.gz. Co-developed-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Magnus Lindholm <linmag7@gmail.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20261017-alpha-kernel-compression-v2-2-c71e6b08dc63@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: select SPARSE_IRQMatt Turner
NR_IRQS on Alpha is sized for the largest configuration each platform supports, and for Marvel that is 32 PIDs, or 32784 interrupts. Without SPARSE_IRQ that becomes a static irq_desc[] array of 12.6 MB in .data, carried by every Marvel and every generic kernel regardless of how many interrupts the machine actually has. A real ES47 uses 87 of them. That is not just wasted memory, it constrains where the kernel can be loaded. The image links at a fixed 0xfffffc0001010000, just above the console's low memory reservation, and with memory striping enabled the console leaves only about 16 MB of usable low memory before the rest is relocated to an interleaved aperture. A 12.6 MB array of mostly unused interrupt descriptors is the difference between fitting and not. Alpha already goes through irq_to_desc() rather than indexing irq_desc[] directly, so nothing stands in the way. The platforms do wire up their interrupts by number, though, which needs the descriptors to exist by then, so provide arch_probe_nr_irqs() returning the machine vector's count instead of taking the NR_IRQS_LEGACY default. Without it every interrupt above 15 would have no descriptor and the handler setup would be silently dropped. Tested on an ES47 (Marvel, 2 EV7z): boots with all device interrupts working, and .data drops by 12.6 MB, from 15.7 MB to 3.1 MB. Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20260905-arch-kconfig-options-v2-v2-22-83e8245761a2@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: select ARCH_WANT_IRQS_OFF_ACTIVATE_MMMatt Turner
activate_mm() on Alpha calls __load_new_mm_context() which assigns a new ASID and invokes PALcode swpctx. On SMP, an interrupt arriving between the ASID update and the page table switch could see inconsistent state. Ensure activate_mm() is called with interrupts disabled during exec. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20260905-arch-kconfig-options-v2-v2-20-83e8245761a2@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: select ARCH_WANT_LD_ORPHAN_WARNMatt Turner
With .eh_frame and the relocation sections now placed explicitly, an Alpha kernel links with no orphan sections left, so ask the linker to warn if new ones appear. Assisted-by: Claude:claude-opus-5 Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20260905-arch-kconfig-options-v2-v2-19-83e8245761a2@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
2026-10-18alpha: discard .eh_frame and the relocation sectionsMatt Turner
gcc emits .eh_frame for Alpha even though the kernel builds with -fno-asynchronous-unwind-tables, and nothing in the kernel consumes it: the stack trace code scans the stack for text addresses rather than unwinding DWARF. It was allocated in the loaded image, so dropping it shrinks vmlinux by about 1.1MB for a Marvel SMP configuration. The .rela* sections are equally useless, as the kernel image is not relocatable. The linker was already dropping their contents. Both were being placed as orphan sections, which is what drew attention to them. Assisted-by: Claude:claude-opus-5 Signed-off-by: Matt Turner <mattst88@gmail.com> Tested-by: Magnus Lindholm <linmag7@gmail.com> Reviewed-by: Magnus Lindholm <linmag7@gmail.com> Link: https://lore.kernel.org/r/20260905-arch-kconfig-options-v2-v2-18-83e8245761a2@gmail.com Signed-off-by: Magnus Lindholm <linmag7@gmail.com>