Skip to content

alpha: enable generic entry infrastructure

Magnus Lindholm linux-alpha lkml 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest7 patches 0 repliesNew
  2. v38 patches 5 repliesSuperseded
  3. v28 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v18 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Rebase on v7.2-rc1
- Restored Alpha's explicit FPU save before signal delivery in the generic return-to-user path, fixing FP state corruption seen with asynchronous signals and FP-heavy userspace.
- Dropped the explicit GENERIC_IRQ_ENTRY select from Kconfig, since GENERIC_ENTRY already selects it.
- Dropped the pci-sysfs bin_attribute initialization patch; it is no longer needed after rebasing onto v7.2-rc1, where Alpha PCI resource attributes are static attribute-group entries rather than dynamically allocated bin_attributes.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7alpha: enable regset-based ptrace and core dumpsDocumentation/features/core/tracehook/arch-support.txt arch/alpha/Kconfig arch/alpha/include/asm/elf.h +8 more+312 -590 replies
2/7alpha: add ARCH_STACKWALK-based stacktrace supportarch/alpha/Kconfig arch/alpha/kernel/Makefile arch/alpha/kernel/stacktrace.c +1 more+69 -10 replies
3/7alpha: make irqflags helpers operate on IPL statearch/alpha/include/asm/irqflags.h+3 -30 replies
4/7alpha: provide ftrace return address support for lockdeparch/alpha/include/asm/ftrace.h+29 -10 replies
5/7alpha: use raw spinlocks for low-level platform locksarch/alpha/kernel/irq_i8259.c arch/alpha/kernel/sys_dp264.c arch/alpha/kernel/sys_rawhide.c+47 -270 replies
6/7alpha: enable lockdep hardirq state trackingDocumentation/features/locking/lockdep/arch-support.txt arch/alpha/Kconfig arch/alpha/kernel/entry.S +3 more+91 -200 replies
7/7alpha: enable GENERIC_ENTRYarch/alpha/Kconfig arch/alpha/include/asm/entry-common.h arch/alpha/include/asm/ptrace.h +9 more+364 -3650 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchMatt Turner
1/7R-b T-b
2/7R-b T-b
3/7R-b T-b
4/7R-b T-b
5/7R-b T-b
6/7R-b T-b
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/7] alpha: enable generic entry infrastructure

Hi,

This series moves Alpha closer to the common architecture infrastructure and enables GENERIC_ENTRY. This is v4 of this patch
series, please see below for changes since v1, v2 and v3.

The main motivation is to reduce Alpha-specific syscall tracing, ptrace, seccomp, and return-to-user handling where common code already provides the required infrastructure. Alpha still has ABI-sensitive syscall details, most notably the assembly syscall invocation and the r0/r19 return-value encoding, so those remain Alpha-specific. The surrounding entry/exit decisions are moved towards common code.

The series first adds regset-based ptrace and core dump support. Alpha now provides a user_regset_view for NT_PRSTATUS and NT_PRFPREG, exports the ELF-visible general and floating-point register layouts, and uses the common ptrace regset implementation for PTRACE_GETREGSET and PTRACE_SETREGSET instead of open-coding iovec handling in arch_ptrace(). This also provides the basis for HAVE_ARCH_TRACEHOOK and common ptrace syscall-info support.

It then adds ARCH_STACKWALK support. The implementation uses a simple kernel stack scanning walker, starting after pt_regs for current tasks and using the saved PCB kernel stack pointer for blocked tasks. This enables common stacktrace users such as dump_stack(), /proc/*/stack, and SysRq backtraces, without introducing a frame-pointer-based unwinder. It also avoids relying on the legacy weak save_stack_trace_*() fallbacks, which is needed by the later generic IRQ-entry configuration in this series.

The next group of patches prepares Alpha for lockdep IRQ-state tracking. Alpha interrupt masking is controlled by the PAL IPL state, so the irqflags helpers are made to operate on IPL state rather than treating the full processor status word as the saved interrupt state. The series also provides ftrace return-address support for lockdep call-site reporting and converts low-level platform locks to raw spinlocks where regular spinlock instrumentation is not appropriate for the hardware and interrupt paths involved.

The lockdep patch then adds hardirq state tracking in Alpha's low-level entry/exit paths. It annotates PAL IPL transitions and the shared return path so lockdep can keep its interrupt state in sync with the hardware IPL state. This allows CONFIG_PROVE_LOCKING to remain useful on Alpha instead of quickly disabling debug_locks due to IRQ state mismatches.

The final patch enables GENERIC_ENTRY and. Syscall
entry now uses C helpers built around syscall_enter_from_user_mode(). The C entry helper handles the common syscall-entry work, including ptrace/seccomp entry processing, skip decisions, syscall-number shadowing, and syscall table lookup. It returns the selected syscall function pointer to assembly.

Assembly then performs only the Alpha-specific dispatch: it reloads the syscall arguments, preserves the required GP/stack conventions, and performs the indirect call through the function pointer returned by C. Skipped syscalls bypass that dispatch and return through the Alpha syscall-exit helper.

Syscall exit is split in the same way. Alpha first performs its ABI-specific result handling: r0/v0 carries the return value or positive errno, and r19/a3 carries the error flag. It also handles skipped syscall restart state and successful syscalls whose return values may look like negative errnos, such as legacy ptrace PEEK requests. Once the Alpha-specific r0/r19 state is encoded, the path enters syscall_exit_to_user_mode() for the common syscall-exit and exit-to-user-mode work.

The syscall number used by generic entry is kept separately from the return-value register. entSys copies the raw r0 syscall number into r1, and r1 is used as Alpha's generic-entry syscall-number shadow. Restart bookkeeping that used to be carried by low-level assembly state is now kept explicitly in thread_info. This avoids using user-visible general registers as hidden restart state while preserving Alpha's restart and ptrace semantics.

Testing was performed on an Alpha EV68/Tsunami SMP system (UP2000+) as well as an Alphaserver 4100 (rawhide) system.

For the regset, ptrace, tracehook, and generic-entry changes, testing included:

- custom ptrace/regset round-trip tests for both GPR and FPR regsets
- PTRACE_GET_SYSCALL_INFO validation, including the reported user stack pointer
- ELF core dump inspection with readelf
- strace testsuite (make check), with the remaining failures comparable to the pre-series baseline on the same system.

Kernel tools/testing/selftests:
- ptrace: syscall-info tests improved over the baseline.
- seccomp: seccomp_bpf passes all applicable tests.
- exec: check-exec now passes once loop block-device support is enabled.
- ipc: ipc selftests improved over the baseline.
- acct: acct selftests improved over the baseline.

Overall, the selftest comparison did not show an obvious regression introduced by this series. Instead, the patched kernel reduced the number of failing top-level selftests and fixed several failures in areas that exercise the new ptrace, tracehook, seccomp, and generic-entry paths. Some unrelated failures remain and need separate investigation, but they are either also present in the baseline run or explained by missing kernel configuration or test-environment support.

For the stacktrace changes, the following scenarios were verified:

- SysRq 'l' prints backtraces for all CPUs, including syscall and interrupt contexts
- /proc/<pid>/stack returns sensible call chains for both the current task and sleeping tasks, such as nanosleep
- stack traces remain stable under scheduler and I/O load, including ping, ext4 writes, and background workqueues
- no crashes, lockups, or obvious mis-unwinds were observed

For the lockdep changes, /proc/lockdep_stats shows debug_locks remaining enabled, with no redundant hardirq or softirq on/off annotations observed during testing.

Review feedback is very welcome. Additional testing on other Alpha systems, CPU variants, and workloads would also be much appreciated.

Patches:

1. alpha: enable regset-based ptrace and core dumps
2. alpha: add ARCH_STACKWALK-based stacktrace support
3. alpha: make irqflags helpers operate on IPL state
4. alpha: provide ftrace return address support for lockdep
5. alpha: convert low-level platform locks to raw spinlocks
6. alpha: enable lockdep hardirq state tracking
7. alpha: enable GENERIC_ENTRY

Thanks,

Magnus

---
Changes since v1:
- Fixed skipped-syscall exit handling so PTRACE_SET_SYSCALL_INFO and legacy POKEUSR skips return ENOSYS/a3=1 only when no ptrace/seccomp return value was installed.
Changes since v2:
- patch 8: add PTRACE_PEEKUSR support for FP registers and PC
- patch 8: add/fix focused ptrace single-step validation
- patches 1-7: add Reviewed-by and Tested-by tag
Changes since v3:
- Rebase on v7.2-rc1
- Restored Alpha's explicit FPU save before signal delivery in the generic return-to-user path, fixing FP state corruption seen with asynchronous signals and FP-heavy userspace.
- Dropped the explicit GENERIC_IRQ_ENTRY select from Kconfig, since GENERIC_ENTRY already selects it.
- Dropped the pci-sysfs bin_attribute initialization patch; it is no longer needed after rebasing onto v7.2-rc1, where Alpha PCI resource attributes are static attribute-group entries rather than dynamically allocated bin_attributes.

Magnus Lindholm (7):
alpha: enable regset-based ptrace and core dumps
alpha: add ARCH_STACKWALK-based stacktrace support
alpha: make irqflags helpers operate on IPL state
alpha: provide ftrace return address support for lockdep
alpha: use raw spinlocks for low-level platform locks
alpha: enable lockdep hardirq state tracking
alpha: enable GENERIC_ENTRY

 .../features/core/tracehook/arch-support.txt  |   2 +-
 .../features/locking/lockdep/arch-support.txt |   2 +-
 arch/alpha/Kconfig                            |  12 +
 arch/alpha/include/asm/elf.h                  |   1 +
 arch/alpha/include/asm/entry-common.h         |  14 +
 arch/alpha/include/asm/ftrace.h               |  30 +-
 arch/alpha/include/asm/irqflags.h             |   6 +-
 arch/alpha/include/asm/ptrace.h               |  21 +-
 arch/alpha/include/asm/stacktrace.h           |  20 +
 arch/alpha/include/asm/syscall.h              |  18 +-
 arch/alpha/include/asm/thread_info.h          |  31 +-
 arch/alpha/include/uapi/asm/ptrace.h          |   2 +-
 arch/alpha/kernel/Makefile                    |   3 +-
 arch/alpha/kernel/asm-offsets.c               |   6 +
 arch/alpha/kernel/entry.S                     | 328 +++++---------
 arch/alpha/kernel/irq_alpha.c                 |  78 +++-
 arch/alpha/kernel/irq_i8259.c                 |  19 +-
 arch/alpha/kernel/proto.h                     |  13 +-
 arch/alpha/kernel/ptrace.c                    | 400 ++++++++++++++----
 arch/alpha/kernel/signal.c                    | 149 ++++++-
 arch/alpha/kernel/stacktrace.c                |  61 +++
 arch/alpha/kernel/sys_dp264.c                 |  38 +-
 arch/alpha/kernel/sys_rawhide.c               |  17 +-
 arch/alpha/kernel/traps.c                     |   8 +
 arch/alpha/kernel/vmlinux.lds.S               |   2 +
 25 files changed, 860 insertions(+), 421 deletions(-)
 create mode 100644 arch/alpha/include/asm/entry-common.h
 create mode 100644 arch/alpha/include/asm/stacktrace.h
 create mode 100644 arch/alpha/kernel/stacktrace.c
Signature · 1 line
2.53.0