diff -drupN a/fs/pstore/Kconfig b/fs/pstore/Kconfig --- a/fs/pstore/Kconfig 2018-08-06 17:23:04.000000000 +0300 +++ b/fs/pstore/Kconfig 2022-06-12 05:28:14.000000000 +0300 @@ -1,5 +1,6 @@ config PSTORE tristate "Persistent store support" + select CRYPTO if PSTORE_COMPRESS default n help This option enables generic access to platform level @@ -12,35 +13,65 @@ config PSTORE If you don't have a platform persistent store driver, say N. +config PSTORE_DEFLATE_COMPRESS + bool "DEFLATE (ZLIB) compression" + depends on PSTORE + select CRYPTO_DEFLATE + help + This option enables DEFLATE (also known as ZLIB) compression + algorithm support. + +config PSTORE_LZO_COMPRESS + bool "LZO compression" + depends on PSTORE + select CRYPTO_LZO + help + This option enables LZO compression algorithm support. + +config PSTORE_842_COMPRESS + bool "842 compression" + depends on PSTORE + select CRYPTO_842 + help + This option enables 842 compression algorithm support. + +config PSTORE_COMPRESS + def_bool y + depends on PSTORE + depends on PSTORE_DEFLATE_COMPRESS || PSTORE_LZO_COMPRESS || \ + PSTORE_842_COMPRESS + choice - prompt "Choose compression algorithm" - depends on PSTORE - default PSTORE_ZLIB_COMPRESS - help - This option chooses compression algorithm. + prompt "Default pstore compression algorithm" + depends on PSTORE_COMPRESS + help + This option chooses the default active compression algorithm. + This change be changed at boot with "pstore.compress=..." on + the kernel command line. -config PSTORE_ZLIB_COMPRESS - bool "ZLIB" - select ZLIB_DEFLATE - select ZLIB_INFLATE - help - This option enables ZLIB compression algorithm support. + Currently, pstore has support for 3 compression algorithms: + deflate, lzo, and 842. -config PSTORE_LZO_COMPRESS - bool "LZO" - select LZO_COMPRESS - select LZO_DECOMPRESS - help - This option enables LZO compression algorithm support. + The default compression algorithm is deflate. + + config PSTORE_DEFLATE_COMPRESS_DEFAULT + bool "deflate" if PSTORE_DEFLATE_COMPRESS + + config PSTORE_LZO_COMPRESS_DEFAULT + bool "lzo" if PSTORE_LZO_COMPRESS + + config PSTORE_842_COMPRESS_DEFAULT + bool "842" if PSTORE_842_COMPRESS -config PSTORE_LZ4_COMPRESS - bool "LZ4" - select LZ4_COMPRESS - select LZ4_DECOMPRESS - help - This option enables LZ4 compression algorithm support. endchoice +config PSTORE_COMPRESS_DEFAULT + string + depends on PSTORE_COMPRESS + default "deflate" if PSTORE_DEFLATE_COMPRESS_DEFAULT + default "lzo" if PSTORE_LZO_COMPRESS_DEFAULT + default "842" if PSTORE_842_COMPRESS_DEFAULT + config PSTORE_CONSOLE bool "Log kernel console messages" depends on PSTORE @@ -75,7 +106,6 @@ config PSTORE_RAM tristate "Log panic/oops to a RAM buffer" depends on PSTORE depends on HAS_IOMEM - depends on HAVE_MEMBLOCK select REED_SOLOMON select REED_SOLOMON_ENC8 select REED_SOLOMON_DEC8 @@ -86,4 +116,171 @@ config PSTORE_RAM Note that for historical reasons, the module will be named "ramoops.ko". - For more information, see Documentation/ramoops.txt. + For more information, see Documentation/admin-guide/ramoops.rst. + +config PSTORE_BLK + tristate "Log panic/oops to a block device" + depends on PSTORE + depends on BLOCK + help + This enables panic and oops message to be logged to a block dev + where it can be read back at some later point. + + For more information, see Documentation/admin-guide/pstore-block.rst. + + If unsure, say N. + +config PSTORE_BLKOOPS + tristate "pstore block with oops logger" + depends on PSTORE_BLK + help + This is a sample for pstore block with panic/oops logger. + + It CAN record panic log only when block device driver registers + panic APIs. + + It CAN record oops log even power failure if + "PSTORE_BLKOOPS_BLKDEV" on Kconfig or "block-device" on dts or + "blkdev" on module parameter is valid. + + Otherwise, it can only record data to ram buffer, which will be + dropped on reboot. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set. + +config PSTORE_BLKOOPS_DMESG_SIZE + int "dmesg size in kbytes for blkoops" + depends on PSTORE_BLKOOPS + default 64 + help + This just sets size of dmesg (dmesg_size) for pstore/blk. The value + must be a multiple of 4096. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set. + +config PSTORE_BLKOOPS_PMSG_SIZE + int "pmsg size in kbytes for blkoops" + depends on PSTORE_BLKOOPS + default 64 + help + This just sets size of pmsg (pmsg_size) for pstore/blk. The value must + be a multiple of 4096. Pmsg works only if "blkdev" is set. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set. + +config PSTORE_BLKOOPS_TOTAL_SIZE + int "total size in kbytes for blkoops" + depends on PSTORE_BLKOOPS + default 0 + help + The total size in kbytes pstore/blk can use. It must be less than or + equal to size of block device if @blkdev valid. If @total_size is zero + with @blkdev, @total_size will be set equal to size of @blkdev. + The value must be a multiple of 4096. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set. + +config PSTORE_BLKOOPS_BLKDEV + string "block device for blkoops" + depends on PSTORE_BLKOOPS + default "" + help + This just sets block device (blkdev) for pstore/blk. Pstore/blk + will record data to this block device to avoid losing data due to + power failure. So, if it is not set, pstore/blk will drop all data + when on reboot. + + It accept the following variants: + 1) device number in hexadecimal represents + itself no leading 0x, for example b302. + 2) /dev/ represents the device number of disk + 3) /dev/ represents the device number + of partition - device number of disk plus the partition number + 4) /dev/p - same as the above, this form is + used when disk name of partitioned disk ends with a digit. + 5) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the + unique id of a partition if the partition table provides it. + The UUID may be either an EFI/GPT UUID, or refer to an MSDOS + partition using the format SSSSSSSS-PP, where SSSSSSSS is a zero- + filled hex representation of the 32-bit "NT disk signature", and PP + is a zero-filled hex representation of the 1-based partition number. + 6) PARTUUID=/PARTNROFF= to select a partition in relation + to a partition with a known unique id. + 7) : major and minor number of the device separated by + a colon. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set. + +config PSTORE_BLKOOPS_DUMP_OOPS + bool "dump oops" + depends on PSTORE_BLKOOPS + default y + help + Whether blkoops dumps oops or not. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set. + +config PSTORE_BLKOOPS_DUMP_OOM + bool "dump oom" + depends on PSTORE_BLKOOPS + default n + help + Whether blkoops dumps oom or not. + + NOTE that, there are two ways to set parameters of blkoops and + prioritize according to configuration flexibility. That is + Kconfig < module parameters. It means that the value can + be overwritten by higher priority settings. + 1. Kconfig + It just sets a default value. + 2. module parameters + It is the first priority. Take care of that blkoops will take lower + priority settings if higher priority one do not set.