[PATCH 0/3] Print CPU at segfault time

From: ira . weiny
Date: Wed Aug 10 2022 - 22:49:23 EST


From: Ira Weiny <ira.weiny@xxxxxxxxx>

Changes from RFC:
Drop patch 1 as I misunderstood the code and it is not needed for this
use case
Combine patch 2 and 5 into a patch 3 which stores the CPU only for page
faults

Rik reported that the knowledge of which CPU's are seeing faults can help in
determining which CPUs are failing in a large data center.[1]

Storing the CPU at exception entry time allows this print to report the CPU
which actually took the exception. This still may not be the CPU which is
failing but it should be closer.

Dave and Boris recognized that the auxiliary pt_regs work I did for the PKS
series could help to store this value and avoid passing the CPU throughout the
fault handler call stack.

The patches I sent for RFC had a lot more overhead than is needed to report the
CPU in a page fault.[2] After the discussions the generic save/restore of the
auxiliary pt_regs is overkill for the current use case. Skip that overhead and
only store the CPU in the page fault path.

[1] https://lore.kernel.org/all/20220805101644.2e674553@xxxxxxxxxxxxxxxxxxxx/
[2] https://lore.kernel.org/lkml/20220805173009.3128098-1-ira.weiny@xxxxxxxxx/

Ira Weiny (2):
x86/entry: Add auxiliary pt_regs space
x86/mm: Store CPU info on exception entry

Rik van Riel (1):
x86,mm: print likely CPU at segfault time

arch/x86/Kconfig | 4 ++++
arch/x86/entry/calling.h | 19 +++++++++++++++++++
arch/x86/entry/entry_64.S | 22 ++++++++++++++++++++++
arch/x86/entry/entry_64_compat.S | 6 ++++++
arch/x86/include/asm/ptrace.h | 19 +++++++++++++++++++
arch/x86/kernel/asm-offsets_64.c | 15 +++++++++++++++
arch/x86/kernel/head_64.S | 6 ++++++
arch/x86/mm/fault.c | 18 ++++++++++++++++++
8 files changed, 109 insertions(+)


base-commit: d4252071b97d2027d246f6a82cbee4d52f618b47
--
2.35.3