Files
s390-tools/zipl/include/job.h
Alexander Egorenkov 2b015183aa zipl: Implement NGDump
This commit finalizes the implementation of the new stand-alone dump -
Next Gen Dump (NGDump).

NGDump stand-alone dump is a universal stand-alone dump which works for both
SCSI and NVMe disks. But currently can be used only with NVMe disks
and SCSI stand-alone dump remains the default for SCSI disks.

Currently, this stand-alone dump can be used only on IBM z15 or newer
machine generations because it requires larger amount of HSA memory offered
by firmware only on IBM z15 machines. Whereas SCSI stand-alone dump is able
to work with HSA memory of 32M, the new stand-alone dump requires 512M HSA
memory at the moment.

NGDump stand-alone dump installation is initiated by passing a path to
a NVMe disk partition to zipl via the command-line -d, similar to SCSI
stand-alone dump. zipl will then:
- build a dumper initramfs with either dracut (Fedora/RHEL/SLES) or
  initramfs-tools (Ubuntu/Debian)
- format the given NVMe partition with ext4 file system
- create a bootmap file on the newly created file system using the built
  initramfs and the currently active kernel image
- install a boot loader on the disk the given dump partition belongs to

The operations described above are destructive for the given NVMe dump
partition and the boot record(s) of its disk.

After the installation step, users can configure the dumpconf to IPL
the dumper automatically on panic or trigger a dump manually via HMC
interface.

When activated, the dumper will create a dump ELF file named "dump.elf"
on the given NVMe dump partition by using the makedumpfile tool. The kdump
compressed file format is not supported yet due to zgetdump not being able
to read such a file format. Therefore, the dumper is restricted to write
the dump only in ELF format but only kernel pages which are in use.
This will usually make the dump smaller than the original size of
/proc/vmcore and the whole dump process faster as well.

Example configuration for dumpconf:

ON_PANIC=dump   # or dump_reipl
DUMP_TYPE=nvme
FID=0x00000001
NSID=0x00000001
BOOTPROG=0
BR_LBA=0

$ systemctl enable --now dumpconf

To install the dracut support on Fedora/RHEL/SUSE:

$ make -C zipl/dracut HAVE_DRACUT=1 install

To install the initramfs-tools support on Ubuntu/Debian:

$ make -C zipl/initramfs-tools HAVE_INITRAMFS=1 install

Example of NGDump console output on SLES during dump
----------------------------------------------------

         Starting NGDump...
[    8.932343] ngdump.sh[327]: NGDump started
[    8.934739] ngdump.sh[336]: Checking for memory holes                         : [  0.0 %] /
[    8.967536] ngdump.sh[336]: Checking for memory holes                         : [100.0 %] |
[    9.076976] ngdump.sh[336]: Excluding unnecessary pages                       : [100.0 %] \
[   11.721157] ngdump.sh[336]: Copying data                                      : [  0.0 %] -
[   12.317319] ngdump.sh[336]: Copying data                                      : [ 22.5 %] /           eta: 2s
[   13.273000] ngdump.sh[336]: Copying data                                      : [100.0 %] |           eta: 0s
[   13.273244] ngdump.sh[336]: The kernel version is not supported.
[   13.273263] ngdump.sh[336]: The makedumpfile operation may be incomplete.
[   13.273281] ngdump.sh[336]: The dumpfile is saved to /ngdump/dump.elf.
[   13.273299] ngdump.sh[336]: makedumpfile Completed.

Example of NGDump console output on Ubuntu during dump
-------------------------------------------------------

[    3.240078] zdump: The dump process started for a 64-bit operating system
Loading, please wait...
Starting version 245.4-4ubuntu3.17
Begin: Starting firmware auto-configuration ... done.
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ...
Begin: NGDump ...
Checking for memory holes                         : [  0.0 %] /
Checking for memory holes                         : [100.0 %] |
Excluding unnecessary pages                       : [100.0 %] \
Copying data                                      : [  0.0 %] -
Copying data                                      : [ 40.7 %] /           eta: 1s
Copying data                                      : [100.0 %] |           eta: 0s
The kernel version is not supported.
The makedumpfile operation may be incomplete.
The dumpfile is saved to /ngdump/dump.elf.
makedumpfile Completed.

Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Tested-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Tested-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-06-20 13:14:05 +02:00

142 lines
2.6 KiB
C

/*
* s390-tools/zipl/include/job.h
* Functions and data structures representing the actual 'job' that the
* user wants us to execute.
*
* Copyright IBM Corp. 2001, 2017
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*
*/
#ifndef JOB_H
#define JOB_H
#include <stdbool.h>
#include "disk.h"
#include "zipl.h"
enum job_id {
job_print_usage = 1,
job_print_version = 2,
job_ipl = 3,
job_segment = 4,
job_dump_partition = 5,
job_menu = 6,
job_ipl_tape = 7,
job_mvdump = 8,
};
struct job_target_data {
char* bootmap_dir;
char* targetbase;
disk_type_t targettype;
int targetcylinders;
int targetheads;
int targetsectors;
int targetblocksize;
blocknum_t targetoffset;
};
struct job_common_ipl_data {
char* image;
char* parmline;
char* ramdisk;
address_t image_addr;
address_t parm_addr;
address_t ramdisk_addr;
bool optional;
bool ignore;
};
struct job_ipl_data {
struct job_common_ipl_data common;
address_t envblk_addr;
int is_kdump;
};
struct job_envblk_data {
int size;
char *buf;
};
struct job_segment_data {
char* segment;
address_t segment_addr;
};
struct job_dump_data {
struct job_common_ipl_data common;
char* device;
uint64_t mem;
};
struct job_mvdump_data {
char* device_list;
int device_count;
char* device[MAX_DUMP_VOLUMES];
uint64_t mem;
uint8_t force;
};
struct job_ipl_tape_data {
struct job_common_ipl_data common;
char* device;
};
union job_menu_entry_data {
struct job_ipl_data ipl;
struct job_dump_data dump;
};
struct job_menu_entry {
int pos;
char* name;
enum job_id id;
union job_menu_entry_data data;
int is_secure;
};
struct job_menu_data {
int num;
int default_pos;
int prompt;
int timeout;
struct job_menu_entry* entry;
};
struct job_data {
enum job_id id;
struct job_target_data target;
struct job_envblk_data envblk;
char* name;
union {
struct job_ipl_data ipl;
struct job_menu_data menu;
struct job_segment_data segment;
struct job_dump_data dump;
struct job_ipl_tape_data ipl_tape;
struct job_mvdump_data mvdump;
} data;
int noninteractive;
int verbose;
int add_files;
int dry_run;
int command_line;
int is_secure;
};
int job_get(int argc, char* argv[], struct job_data** data);
void job_free(struct job_data* job);
int type_from_target(char *target, disk_type_t *type);
int check_job_dump_images(struct job_dump_data* dump, char* name);
int check_job_images_ngdump(struct job_dump_data* dump, char* name);
bool is_ngdump_enabled(const char* device, struct job_target_data* target);
#endif /* not JOB_H */