Commit graph

2 commits

Author SHA1 Message Date
Heiko Carstens
f0f6db9ffe s390/alternatives: Add debug functionality
Similar to x86 and loongarch add a "debug-alternative" command line
parameter, which allows for alternative debugging. The parameter
itself comes with architecture specific semantics:

"debug-alternative"
 -> print debug message for every single alternative

"debug-alternative=0;2"
-> print debug message for all alternatives with type 0 and 2

"debug-alternative=0:0-7"
-> print debug message for all alternatives with type 0 which have a
   facility number within the range of 0-7

"debug-alternative=0:!8;1"
-> print debug message for all alternatives with type 0, for all
   facility numbers, except facility 8, and in addition print all
   alternatives with type 1

A defconfig build currently results in a kernel with more than 20.000
alternatives, where the majority is for the niai alternative (spinlocks),
and the relocated lowcore alternative. The following kernel command like
options limit alternative debug output, and enable dynamic debug messages:

debug-alternative=0:!49;1:!0
earlyprintk
bootdebug
ignore_loglevel
loglevel=8
dyndbg="file alternative.c +p"

This results in output like this:

 alt: [0/ 11] 0000021b9ce8680c: c0f400000089 -> c00400000000
 alt: [0/ 64] 0000021b9ce87e60: c0f400000043 -> c00400000000
 alt: [0/133] 0000021b9ce88c56: c0f400000027 -> c00400000000
 alt: [0/ 74] 0000021b9ce89410: c0f40000002a -> c00400000000
 alt: [0/ 40] 0000021b9dc3720a: 47000000 -> b280d398
 alt: [0/193] 0000021b9dc37306: 47000000 -> b201d2b0
 alt: [0/193] 0000021b9dc37354: c00400000000 -> d20720c0d2b0
 alt: [1/  5] 0000038d720d7bf2: c0f400000016 -> c00400000000

With

[<alternative type>/<alternative data>] <address> oldcode -> newcode

Alternative data depends on the alternative type: for type 0
(ALT_TYPE_FACILITY) data is the facility. For type 1 (ALT_TYPE_FEATURE)
data is the corresponding machine feature.

Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2025-03-04 17:18:08 +01:00
Sven Schnelle
7f9d85998f s390/alternatives: Allow early alternative patching in decompressor
Add the required code to patch alternatives early in the decompressor.
This is required for the upcoming lowcore relocation changes, where
alternatives for facility 193 need to get patched before lowcore
alternatives.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Co-developed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-07-23 16:02:31 +02:00