xref: /openbmc/linux/Documentation/powerpc/firmware-assisted-dump.rst (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
14d2e26a3SMauro Carvalho Chehab======================
24d2e26a3SMauro Carvalho ChehabFirmware-Assisted Dump
34d2e26a3SMauro Carvalho Chehab======================
44d2e26a3SMauro Carvalho Chehab
54d2e26a3SMauro Carvalho ChehabJuly 2011
64d2e26a3SMauro Carvalho Chehab
74d2e26a3SMauro Carvalho ChehabThe goal of firmware-assisted dump is to enable the dump of
84d2e26a3SMauro Carvalho Chehaba crashed system, and to do so from a fully-reset system, and
94d2e26a3SMauro Carvalho Chehabto minimize the total elapsed time until the system is back
104d2e26a3SMauro Carvalho Chehabin production use.
114d2e26a3SMauro Carvalho Chehab
121679b96eSHari Bathini- Firmware-Assisted Dump (FADump) infrastructure is intended to replace
134d2e26a3SMauro Carvalho Chehab  the existing phyp assisted dump.
144d2e26a3SMauro Carvalho Chehab- Fadump uses the same firmware interfaces and memory reservation model
154d2e26a3SMauro Carvalho Chehab  as phyp assisted dump.
161679b96eSHari Bathini- Unlike phyp dump, FADump exports the memory dump through /proc/vmcore
174d2e26a3SMauro Carvalho Chehab  in the ELF format in the same way as kdump. This helps us reuse the
184d2e26a3SMauro Carvalho Chehab  kdump infrastructure for dump capture and filtering.
194d2e26a3SMauro Carvalho Chehab- Unlike phyp dump, userspace tool does not need to refer any sysfs
204d2e26a3SMauro Carvalho Chehab  interface while reading /proc/vmcore.
211679b96eSHari Bathini- Unlike phyp dump, FADump allows user to release all the memory reserved
224d2e26a3SMauro Carvalho Chehab  for dump, with a single operation of echo 1 > /sys/kernel/fadump_release_mem.
231679b96eSHari Bathini- Once enabled through kernel boot parameter, FADump can be
244d2e26a3SMauro Carvalho Chehab  started/stopped through /sys/kernel/fadump_registered interface (see
254d2e26a3SMauro Carvalho Chehab  sysfs files section below) and can be easily integrated with kdump
264d2e26a3SMauro Carvalho Chehab  service start/stop init scripts.
274d2e26a3SMauro Carvalho Chehab
284d2e26a3SMauro Carvalho ChehabComparing with kdump or other strategies, firmware-assisted
294d2e26a3SMauro Carvalho Chehabdump offers several strong, practical advantages:
304d2e26a3SMauro Carvalho Chehab
314d2e26a3SMauro Carvalho Chehab-  Unlike kdump, the system has been reset, and loaded
324d2e26a3SMauro Carvalho Chehab   with a fresh copy of the kernel.  In particular,
334d2e26a3SMauro Carvalho Chehab   PCI and I/O devices have been reinitialized and are
344d2e26a3SMauro Carvalho Chehab   in a clean, consistent state.
354d2e26a3SMauro Carvalho Chehab-  Once the dump is copied out, the memory that held the dump
364d2e26a3SMauro Carvalho Chehab   is immediately available to the running kernel. And therefore,
371679b96eSHari Bathini   unlike kdump, FADump doesn't need a 2nd reboot to get back
384d2e26a3SMauro Carvalho Chehab   the system to the production configuration.
394d2e26a3SMauro Carvalho Chehab
404d2e26a3SMauro Carvalho ChehabThe above can only be accomplished by coordination with,
414d2e26a3SMauro Carvalho Chehaband assistance from the Power firmware. The procedure is
424d2e26a3SMauro Carvalho Chehabas follows:
434d2e26a3SMauro Carvalho Chehab
444d2e26a3SMauro Carvalho Chehab-  The first kernel registers the sections of memory with the
454d2e26a3SMauro Carvalho Chehab   Power firmware for dump preservation during OS initialization.
464d2e26a3SMauro Carvalho Chehab   These registered sections of memory are reserved by the first
474d2e26a3SMauro Carvalho Chehab   kernel during early boot.
484d2e26a3SMauro Carvalho Chehab
49fbcafdaeSHari Bathini-  When system crashes, the Power firmware will copy the registered
50fbcafdaeSHari Bathini   low memory regions (boot memory) from source to destination area.
51fbcafdaeSHari Bathini   It will also save hardware PTE's.
524d2e26a3SMauro Carvalho Chehab
534d2e26a3SMauro Carvalho Chehab   NOTE:
544d2e26a3SMauro Carvalho Chehab         The term 'boot memory' means size of the low memory chunk
554d2e26a3SMauro Carvalho Chehab         that is required for a kernel to boot successfully when
564d2e26a3SMauro Carvalho Chehab         booted with restricted memory. By default, the boot memory
574d2e26a3SMauro Carvalho Chehab         size will be the larger of 5% of system RAM or 256MB.
584d2e26a3SMauro Carvalho Chehab         Alternatively, user can also specify boot memory size
594d2e26a3SMauro Carvalho Chehab         through boot parameter 'crashkernel=' which will override
604d2e26a3SMauro Carvalho Chehab         the default calculated size. Use this option if default
614d2e26a3SMauro Carvalho Chehab         boot memory size is not sufficient for second kernel to
624d2e26a3SMauro Carvalho Chehab         boot successfully. For syntax of crashkernel= parameter,
63fbcafdaeSHari Bathini         refer to Documentation/admin-guide/kdump/kdump.rst. If any
64fbcafdaeSHari Bathini         offset is provided in crashkernel= parameter, it will be
65fbcafdaeSHari Bathini         ignored as FADump uses a predefined offset to reserve memory
664d2e26a3SMauro Carvalho Chehab         for boot memory dump preservation in case of a crash.
674d2e26a3SMauro Carvalho Chehab
684d2e26a3SMauro Carvalho Chehab-  After the low memory (boot memory) area has been saved, the
694d2e26a3SMauro Carvalho Chehab   firmware will reset PCI and other hardware state.  It will
704d2e26a3SMauro Carvalho Chehab   *not* clear the RAM. It will then launch the bootloader, as
714d2e26a3SMauro Carvalho Chehab   normal.
724d2e26a3SMauro Carvalho Chehab
73fbcafdaeSHari Bathini-  The freshly booted kernel will notice that there is a new node
74fbcafdaeSHari Bathini   (rtas/ibm,kernel-dump on pSeries or ibm,opal/dump/mpipl-boot
75fbcafdaeSHari Bathini   on OPAL platform) in the device tree, indicating that
764d2e26a3SMauro Carvalho Chehab   there is crash data available from a previous boot. During
774d2e26a3SMauro Carvalho Chehab   the early boot OS will reserve rest of the memory above
784d2e26a3SMauro Carvalho Chehab   boot memory size effectively booting with restricted memory
798468d155SHari Bathini   size. This will make sure that this kernel (also, referred
808468d155SHari Bathini   to as second kernel or capture kernel) will not touch any
818468d155SHari Bathini   of the dump memory area.
824d2e26a3SMauro Carvalho Chehab
834d2e26a3SMauro Carvalho Chehab-  User-space tools will read /proc/vmcore to obtain the contents
844d2e26a3SMauro Carvalho Chehab   of memory, which holds the previous crashed kernel dump in ELF
854d2e26a3SMauro Carvalho Chehab   format. The userspace tools may copy this info to disk, or
864d2e26a3SMauro Carvalho Chehab   network, nas, san, iscsi, etc. as desired.
874d2e26a3SMauro Carvalho Chehab
884d2e26a3SMauro Carvalho Chehab-  Once the userspace tool is done saving dump, it will echo
894d2e26a3SMauro Carvalho Chehab   '1' to /sys/kernel/fadump_release_mem to release the reserved
904d2e26a3SMauro Carvalho Chehab   memory back to general use, except the memory required for
914d2e26a3SMauro Carvalho Chehab   next firmware-assisted dump registration.
924d2e26a3SMauro Carvalho Chehab
934d2e26a3SMauro Carvalho Chehab   e.g.::
944d2e26a3SMauro Carvalho Chehab
954d2e26a3SMauro Carvalho Chehab     # echo 1 > /sys/kernel/fadump_release_mem
964d2e26a3SMauro Carvalho Chehab
974d2e26a3SMauro Carvalho ChehabPlease note that the firmware-assisted dump feature
98fbcafdaeSHari Bathiniis only available on POWER6 and above systems on pSeries
99fbcafdaeSHari Bathini(PowerVM) platform and POWER9 and above systems with OP940
100fbcafdaeSHari Bathinior later firmware versions on PowerNV (OPAL) platform.
101fbcafdaeSHari BathiniNote that, OPAL firmware exports ibm,opal/dump node when
102fbcafdaeSHari BathiniFADump is supported on PowerNV platform.
1034d2e26a3SMauro Carvalho Chehab
10458cf055dSHari BathiniOn OPAL based machines, system first boots into an intermittent
10558cf055dSHari Bathinikernel (referred to as petitboot kernel) before booting into the
10658cf055dSHari Bathinicapture kernel. This kernel would have minimal kernel and/or
10758cf055dSHari Bathiniuserspace support to process crash data. Such kernel needs to
10858cf055dSHari Bathinipreserve previously crash'ed kernel's memory for the subsequent
10958cf055dSHari Bathinicapture kernel boot to process this crash data. Kernel config
11058cf055dSHari Bathinioption CONFIG_PRESERVE_FA_DUMP has to be enabled on such kernel
11158cf055dSHari Bathinito ensure that crash data is preserved to process later.
11258cf055dSHari Bathini
113b3bba79dSHari Bathini-- On OPAL based machines (PowerNV), if the kernel is build with
114b3bba79dSHari Bathini   CONFIG_OPAL_CORE=y, OPAL memory at the time of crash is also
1158852c07aSSourabh Jain   exported as /sys/firmware/opal/mpipl/core file. This procfs file is
116b3bba79dSHari Bathini   helpful in debugging OPAL crashes with GDB. The kernel memory
117b3bba79dSHari Bathini   used for exporting this procfs file can be released by echo'ing
1188852c07aSSourabh Jain   '1' to /sys/firmware/opal/mpipl/release_core node.
119b3bba79dSHari Bathini
120b3bba79dSHari Bathini   e.g.
1218852c07aSSourabh Jain     # echo 1 > /sys/firmware/opal/mpipl/release_core
122b3bba79dSHari Bathini
1234d2e26a3SMauro Carvalho ChehabImplementation details:
1244d2e26a3SMauro Carvalho Chehab-----------------------
1254d2e26a3SMauro Carvalho Chehab
1264d2e26a3SMauro Carvalho ChehabDuring boot, a check is made to see if firmware supports
1274d2e26a3SMauro Carvalho Chehabthis feature on that particular machine. If it does, then
1284d2e26a3SMauro Carvalho Chehabwe check to see if an active dump is waiting for us. If yes
1294d2e26a3SMauro Carvalho Chehabthen everything but boot memory size of RAM is reserved during
1304d2e26a3SMauro Carvalho Chehabearly boot (See Fig. 2). This area is released once we finish
1314d2e26a3SMauro Carvalho Chehabcollecting the dump from user land scripts (e.g. kdump scripts)
1324d2e26a3SMauro Carvalho Chehabthat are run. If there is dump data, then the
1334d2e26a3SMauro Carvalho Chehab/sys/kernel/fadump_release_mem file is created, and the reserved
1344d2e26a3SMauro Carvalho Chehabmemory is held.
1354d2e26a3SMauro Carvalho Chehab
136fbcafdaeSHari BathiniIf there is no waiting dump data, then only the memory required to
137fbcafdaeSHari Bathinihold CPU state, HPTE region, boot memory dump, FADump header and
138fbcafdaeSHari Bathinielfcore header, is usually reserved at an offset greater than boot
139fbcafdaeSHari Bathinimemory size (see Fig. 1). This area is *not* released: this region
140fbcafdaeSHari Bathiniwill be kept permanently reserved, so that it can act as a receptacle
141fbcafdaeSHari Bathinifor a copy of the boot memory content in addition to CPU state and
142fbcafdaeSHari BathiniHPTE region, in the case a crash does occur.
143fbcafdaeSHari Bathini
144fbcafdaeSHari BathiniSince this reserved memory area is used only after the system crash,
145fbcafdaeSHari Bathinithere is no point in blocking this significant chunk of memory from
146fbcafdaeSHari Bathiniproduction kernel. Hence, the implementation uses the Linux kernel's
147fbcafdaeSHari BathiniContiguous Memory Allocator (CMA) for memory reservation if CMA is
148fbcafdaeSHari Bathiniconfigured for kernel. With CMA reservation this memory will be
149fbcafdaeSHari Bathiniavailable for applications to use it, while kernel is prevented from
150fbcafdaeSHari Bathiniusing it. With this FADump will still be able to capture all of the
151fbcafdaeSHari Bathinikernel memory and most of the user space memory except the user pages
152fbcafdaeSHari Bathinithat were present in CMA region::
1534d2e26a3SMauro Carvalho Chehab
1544d2e26a3SMauro Carvalho Chehab  o Memory Reservation during first kernel
1554d2e26a3SMauro Carvalho Chehab
1564d2e26a3SMauro Carvalho Chehab  Low memory                                                 Top of memory
157fbcafdaeSHari Bathini  0    boot memory size   |<--- Reserved dump area --->|       |
158fbcafdaeSHari Bathini  |           |           |    Permanent Reservation   |       |
1598468d155SHari Bathini  V           V           |                            |       V
160fbcafdaeSHari Bathini  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
161fbcafdaeSHari Bathini  |           |           |///|////|  DUMP | HDR | ELF |////|  |
162fbcafdaeSHari Bathini  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
163fbcafdaeSHari Bathini        |                   ^    ^     ^      ^           ^
164fbcafdaeSHari Bathini        |                   |    |     |      |           |
165fbcafdaeSHari Bathini        \                  CPU  HPTE   /      |           |
166fbcafdaeSHari Bathini         ------------------------------       |           |
167fbcafdaeSHari Bathini      Boot memory content gets transferred    |           |
168fbcafdaeSHari Bathini      to reserved area by firmware at the     |           |
169fbcafdaeSHari Bathini      time of crash.                          |           |
170fbcafdaeSHari Bathini                                          FADump Header   |
171fbcafdaeSHari Bathini                                           (meta area)    |
172fbcafdaeSHari Bathini                                                          |
173fbcafdaeSHari Bathini                                                          |
1741e528e9eSBhaskar Chowdhury                      Metadata: This area holds a metadata structure whose
175fbcafdaeSHari Bathini                      address is registered with f/w and retrieved in the
176fbcafdaeSHari Bathini                      second kernel after crash, on platforms that support
177fbcafdaeSHari Bathini                      tags (OPAL). Having such structure with info needed
178fbcafdaeSHari Bathini                      to process the crashdump eases dump capture process.
1798468d155SHari Bathini
1804d2e26a3SMauro Carvalho Chehab                   Fig. 1
1814d2e26a3SMauro Carvalho Chehab
1828468d155SHari Bathini
1834d2e26a3SMauro Carvalho Chehab  o Memory Reservation during second kernel after crash
1844d2e26a3SMauro Carvalho Chehab
1854d2e26a3SMauro Carvalho Chehab  Low memory                                              Top of memory
1864d2e26a3SMauro Carvalho Chehab  0      boot memory size                                      |
187fbcafdaeSHari Bathini  |           |<------------ Crash preserved area ------------>|
188fbcafdaeSHari Bathini  V           V           |<--- Reserved dump area --->|       |
189fbcafdaeSHari Bathini  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
190fbcafdaeSHari Bathini  |           |           |///|////|  DUMP | HDR | ELF |////|  |
191fbcafdaeSHari Bathini  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
1924d2e26a3SMauro Carvalho Chehab        |                                           |
1934d2e26a3SMauro Carvalho Chehab        V                                           V
1944d2e26a3SMauro Carvalho Chehab   Used by second                             /proc/vmcore
1954d2e26a3SMauro Carvalho Chehab   kernel to boot
196fbcafdaeSHari Bathini
197fbcafdaeSHari Bathini        +---+
198fbcafdaeSHari Bathini        |///| -> Regions (CPU, HPTE & Metadata) marked like this in the above
199fbcafdaeSHari Bathini        +---+    figures are not always present. For example, OPAL platform
200fbcafdaeSHari Bathini                 does not have CPU & HPTE regions while Metadata region is
201fbcafdaeSHari Bathini                 not supported on pSeries currently.
202fbcafdaeSHari Bathini
2034d2e26a3SMauro Carvalho Chehab                   Fig. 2
2044d2e26a3SMauro Carvalho Chehab
205fbcafdaeSHari Bathini
2068468d155SHari BathiniCurrently the dump will be copied from /proc/vmcore to a new file upon
2078468d155SHari Bathiniuser intervention. The dump data available through /proc/vmcore will be
2088468d155SHari Bathiniin ELF format. Hence the existing kdump infrastructure (kdump scripts)
2098468d155SHari Bathinito save the dump works fine with minor modifications. KDump scripts on
210*f8b42777SHe Yingmajor Distro releases have already been modified to work seamlessly (no
2118468d155SHari Bathiniuser intervention in saving the dump) when FADump is used, instead of
2128468d155SHari BathiniKDump, as dump mechanism.
2134d2e26a3SMauro Carvalho Chehab
2144d2e26a3SMauro Carvalho ChehabThe tools to examine the dump will be same as the ones
2154d2e26a3SMauro Carvalho Chehabused for kdump.
2164d2e26a3SMauro Carvalho Chehab
2171679b96eSHari BathiniHow to enable firmware-assisted dump (FADump):
2184d2e26a3SMauro Carvalho Chehab----------------------------------------------
2194d2e26a3SMauro Carvalho Chehab
2204d2e26a3SMauro Carvalho Chehab1. Set config option CONFIG_FA_DUMP=y and build kernel.
2214d2e26a3SMauro Carvalho Chehab2. Boot into linux kernel with 'fadump=on' kernel cmdline option.
2221679b96eSHari Bathini   By default, FADump reserved memory will be initialized as CMA area.
2234d2e26a3SMauro Carvalho Chehab   Alternatively, user can boot linux kernel with 'fadump=nocma' to
2241679b96eSHari Bathini   prevent FADump to use CMA.
2254d2e26a3SMauro Carvalho Chehab3. Optionally, user can also set 'crashkernel=' kernel cmdline
2264d2e26a3SMauro Carvalho Chehab   to specify size of the memory to reserve for boot memory dump
2274d2e26a3SMauro Carvalho Chehab   preservation.
2284d2e26a3SMauro Carvalho Chehab
2294d2e26a3SMauro Carvalho ChehabNOTE:
2304d2e26a3SMauro Carvalho Chehab     1. 'fadump_reserve_mem=' parameter has been deprecated. Instead
2314d2e26a3SMauro Carvalho Chehab        use 'crashkernel=' to specify size of the memory to reserve
2324d2e26a3SMauro Carvalho Chehab        for boot memory dump preservation.
2334d2e26a3SMauro Carvalho Chehab     2. If firmware-assisted dump fails to reserve memory then it
2344d2e26a3SMauro Carvalho Chehab        will fallback to existing kdump mechanism if 'crashkernel='
2354d2e26a3SMauro Carvalho Chehab        option is set at kernel cmdline.
2364d2e26a3SMauro Carvalho Chehab     3. if user wants to capture all of user space memory and ok with
2374d2e26a3SMauro Carvalho Chehab        reserved memory not available to production system, then
2384d2e26a3SMauro Carvalho Chehab        'fadump=nocma' kernel parameter can be used to fallback to
2394d2e26a3SMauro Carvalho Chehab        old behaviour.
2404d2e26a3SMauro Carvalho Chehab
2414d2e26a3SMauro Carvalho ChehabSysfs/debugfs files:
2424d2e26a3SMauro Carvalho Chehab--------------------
2434d2e26a3SMauro Carvalho Chehab
2444d2e26a3SMauro Carvalho ChehabFirmware-assisted dump feature uses sysfs file system to hold
2454d2e26a3SMauro Carvalho Chehabthe control files and debugfs file to display memory reserved region.
2464d2e26a3SMauro Carvalho Chehab
2474d2e26a3SMauro Carvalho ChehabHere is the list of files under kernel sysfs:
2484d2e26a3SMauro Carvalho Chehab
2494d2e26a3SMauro Carvalho Chehab /sys/kernel/fadump_enabled
2501679b96eSHari Bathini    This is used to display the FADump status.
2514d2e26a3SMauro Carvalho Chehab
2521679b96eSHari Bathini    - 0 = FADump is disabled
2531679b96eSHari Bathini    - 1 = FADump is enabled
2544d2e26a3SMauro Carvalho Chehab
2554d2e26a3SMauro Carvalho Chehab    This interface can be used by kdump init scripts to identify if
2561679b96eSHari Bathini    FADump is enabled in the kernel and act accordingly.
2574d2e26a3SMauro Carvalho Chehab
2584d2e26a3SMauro Carvalho Chehab /sys/kernel/fadump_registered
2591679b96eSHari Bathini    This is used to display the FADump registration status as well
2601679b96eSHari Bathini    as to control (start/stop) the FADump registration.
2614d2e26a3SMauro Carvalho Chehab
2621679b96eSHari Bathini    - 0 = FADump is not registered.
2631679b96eSHari Bathini    - 1 = FADump is registered and ready to handle system crash.
2644d2e26a3SMauro Carvalho Chehab
2651679b96eSHari Bathini    To register FADump echo 1 > /sys/kernel/fadump_registered and
2664d2e26a3SMauro Carvalho Chehab    echo 0 > /sys/kernel/fadump_registered for un-register and stop the
2671679b96eSHari Bathini    FADump. Once the FADump is un-registered, the system crash will not
2684d2e26a3SMauro Carvalho Chehab    be handled and vmcore will not be captured. This interface can be
2694d2e26a3SMauro Carvalho Chehab    easily integrated with kdump service start/stop.
2704d2e26a3SMauro Carvalho Chehab
271d8e73458SSourabh Jain /sys/kernel/fadump/mem_reserved
272d8e73458SSourabh Jain
273d8e73458SSourabh Jain   This is used to display the memory reserved by FADump for saving the
274d8e73458SSourabh Jain   crash dump.
275d8e73458SSourabh Jain
2764d2e26a3SMauro Carvalho Chehab /sys/kernel/fadump_release_mem
2771679b96eSHari Bathini    This file is available only when FADump is active during
2784d2e26a3SMauro Carvalho Chehab    second kernel. This is used to release the reserved memory
2794d2e26a3SMauro Carvalho Chehab    region that are held for saving crash dump. To release the
2804d2e26a3SMauro Carvalho Chehab    reserved memory echo 1 to it::
2814d2e26a3SMauro Carvalho Chehab
2824d2e26a3SMauro Carvalho Chehab	echo 1  > /sys/kernel/fadump_release_mem
2834d2e26a3SMauro Carvalho Chehab
2844d2e26a3SMauro Carvalho Chehab    After echo 1, the content of the /sys/kernel/debug/powerpc/fadump_region
2854d2e26a3SMauro Carvalho Chehab    file will change to reflect the new memory reservations.
2864d2e26a3SMauro Carvalho Chehab
2874d2e26a3SMauro Carvalho Chehab    The existing userspace tools (kdump infrastructure) can be easily
2884d2e26a3SMauro Carvalho Chehab    enhanced to use this interface to release the memory reserved for
2894d2e26a3SMauro Carvalho Chehab    dump and continue without 2nd reboot.
2904d2e26a3SMauro Carvalho Chehab
2918852c07aSSourabh JainNote: /sys/kernel/fadump_release_opalcore sysfs has moved to
2928852c07aSSourabh Jain      /sys/firmware/opal/mpipl/release_core
2938852c07aSSourabh Jain
2948852c07aSSourabh Jain /sys/firmware/opal/mpipl/release_core
295b3bba79dSHari Bathini
296b3bba79dSHari Bathini    This file is available only on OPAL based machines when FADump is
297b3bba79dSHari Bathini    active during capture kernel. This is used to release the memory
2988852c07aSSourabh Jain    used by the kernel to export /sys/firmware/opal/mpipl/core file. To
299b3bba79dSHari Bathini    release this memory, echo '1' to it:
300b3bba79dSHari Bathini
3018852c07aSSourabh Jain    echo 1  > /sys/firmware/opal/mpipl/release_core
302b3bba79dSHari Bathini
3033f5f1f22SSourabh JainNote: The following FADump sysfs files are deprecated.
3043f5f1f22SSourabh Jain
3053f5f1f22SSourabh Jain+----------------------------------+--------------------------------+
3063f5f1f22SSourabh Jain| Deprecated                       | Alternative                    |
3073f5f1f22SSourabh Jain+----------------------------------+--------------------------------+
3083f5f1f22SSourabh Jain| /sys/kernel/fadump_enabled       | /sys/kernel/fadump/enabled     |
3093f5f1f22SSourabh Jain+----------------------------------+--------------------------------+
3103f5f1f22SSourabh Jain| /sys/kernel/fadump_registered    | /sys/kernel/fadump/registered  |
3113f5f1f22SSourabh Jain+----------------------------------+--------------------------------+
3123f5f1f22SSourabh Jain| /sys/kernel/fadump_release_mem   | /sys/kernel/fadump/release_mem |
3133f5f1f22SSourabh Jain+----------------------------------+--------------------------------+
3143f5f1f22SSourabh Jain
3154d2e26a3SMauro Carvalho ChehabHere is the list of files under powerpc debugfs:
3164d2e26a3SMauro Carvalho Chehab(Assuming debugfs is mounted on /sys/kernel/debug directory.)
3174d2e26a3SMauro Carvalho Chehab
3184d2e26a3SMauro Carvalho Chehab /sys/kernel/debug/powerpc/fadump_region
3191679b96eSHari Bathini    This file shows the reserved memory regions if FADump is
3204d2e26a3SMauro Carvalho Chehab    enabled otherwise this file is empty. The output format
3214d2e26a3SMauro Carvalho Chehab    is::
3224d2e26a3SMauro Carvalho Chehab
3234d2e26a3SMauro Carvalho Chehab      <region>: [<start>-<end>] <reserved-size> bytes, Dumped: <dump-size>
3244d2e26a3SMauro Carvalho Chehab
3251679b96eSHari Bathini    and for kernel DUMP region is:
3261679b96eSHari Bathini
3271679b96eSHari Bathini    DUMP: Src: <src-addr>, Dest: <dest-addr>, Size: <size>, Dumped: # bytes
3281679b96eSHari Bathini
3294d2e26a3SMauro Carvalho Chehab    e.g.
3301679b96eSHari Bathini    Contents when FADump is registered during first kernel::
3314d2e26a3SMauro Carvalho Chehab
3324d2e26a3SMauro Carvalho Chehab      # cat /sys/kernel/debug/powerpc/fadump_region
3334d2e26a3SMauro Carvalho Chehab      CPU : [0x0000006ffb0000-0x0000006fff001f] 0x40020 bytes, Dumped: 0x0
3344d2e26a3SMauro Carvalho Chehab      HPTE: [0x0000006fff0020-0x0000006fff101f] 0x1000 bytes, Dumped: 0x0
3354d2e26a3SMauro Carvalho Chehab      DUMP: [0x0000006fff1020-0x0000007fff101f] 0x10000000 bytes, Dumped: 0x0
3364d2e26a3SMauro Carvalho Chehab
3371679b96eSHari Bathini    Contents when FADump is active during second kernel::
3384d2e26a3SMauro Carvalho Chehab
3394d2e26a3SMauro Carvalho Chehab      # cat /sys/kernel/debug/powerpc/fadump_region
3404d2e26a3SMauro Carvalho Chehab      CPU : [0x0000006ffb0000-0x0000006fff001f] 0x40020 bytes, Dumped: 0x40020
3414d2e26a3SMauro Carvalho Chehab      HPTE: [0x0000006fff0020-0x0000006fff101f] 0x1000 bytes, Dumped: 0x1000
3424d2e26a3SMauro Carvalho Chehab      DUMP: [0x0000006fff1020-0x0000007fff101f] 0x10000000 bytes, Dumped: 0x10000000
3434d2e26a3SMauro Carvalho Chehab          : [0x00000010000000-0x0000006ffaffff] 0x5ffb0000 bytes, Dumped: 0x5ffb0000
3444d2e26a3SMauro Carvalho Chehab
3451679b96eSHari Bathini
3464d2e26a3SMauro Carvalho ChehabNOTE:
3470c1bc6b8SMauro Carvalho Chehab      Please refer to Documentation/filesystems/debugfs.rst on
3484d2e26a3SMauro Carvalho Chehab      how to mount the debugfs filesystem.
3494d2e26a3SMauro Carvalho Chehab
3504d2e26a3SMauro Carvalho Chehab
3514d2e26a3SMauro Carvalho ChehabTODO:
3524d2e26a3SMauro Carvalho Chehab-----
3534d2e26a3SMauro Carvalho Chehab - Need to come up with the better approach to find out more
3544d2e26a3SMauro Carvalho Chehab   accurate boot memory size that is required for a kernel to
3554d2e26a3SMauro Carvalho Chehab   boot successfully when booted with restricted memory.
3561679b96eSHari Bathini - The FADump implementation introduces a FADump crash info structure
3574d2e26a3SMauro Carvalho Chehab   in the scratch area before the ELF core header. The idea of introducing
3584d2e26a3SMauro Carvalho Chehab   this structure is to pass some important crash info data to the second
3594d2e26a3SMauro Carvalho Chehab   kernel which will help second kernel to populate ELF core header with
3604d2e26a3SMauro Carvalho Chehab   correct data before it gets exported through /proc/vmcore. The current
3614d2e26a3SMauro Carvalho Chehab   design implementation does not address a possibility of introducing
3624d2e26a3SMauro Carvalho Chehab   additional fields (in future) to this structure without affecting
3634d2e26a3SMauro Carvalho Chehab   compatibility. Need to come up with the better approach to address this.
3644d2e26a3SMauro Carvalho Chehab
3654d2e26a3SMauro Carvalho Chehab   The possible approaches are:
3664d2e26a3SMauro Carvalho Chehab
3674d2e26a3SMauro Carvalho Chehab	1. Introduce version field for version tracking, bump up the version
3684d2e26a3SMauro Carvalho Chehab	whenever a new field is added to the structure in future. The version
3694d2e26a3SMauro Carvalho Chehab	field can be used to find out what fields are valid for the current
3704d2e26a3SMauro Carvalho Chehab	version of the structure.
3714d2e26a3SMauro Carvalho Chehab	2. Reserve the area of predefined size (say PAGE_SIZE) for this
3724d2e26a3SMauro Carvalho Chehab	structure and have unused area as reserved (initialized to zero)
3734d2e26a3SMauro Carvalho Chehab	for future field additions.
3744d2e26a3SMauro Carvalho Chehab
3754d2e26a3SMauro Carvalho Chehab   The advantage of approach 1 over 2 is we don't need to reserve extra space.
3764d2e26a3SMauro Carvalho Chehab
3774d2e26a3SMauro Carvalho ChehabAuthor: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
3784d2e26a3SMauro Carvalho Chehab
3794d2e26a3SMauro Carvalho ChehabThis document is based on the original documentation written for phyp
3804d2e26a3SMauro Carvalho Chehab
3814d2e26a3SMauro Carvalho Chehabassisted dump by Linas Vepstas and Manish Ahuja.
382