pstore/rom: new support logger for block devices
v3 cover pstore/rom: new support logger for block devices
Why should we need pstore_rom?
1. Most embedded intelligent equipment have no persistent ram, which increases costs. We perfer to cheaper solutions, like block devices. In fast, there is already a sample for block device logger in driver MTD (drivers/mtd/mtdoops.c).
2. Do not any equipment have battery, which means that it lost all data on general ram if power failure. Pstore has little to do for these equipments.
[PATCH v1]
On patch 1:
Core codes of pstore_rom, which works well on allwinner(sunxi) platform. On patch 2:
A sample for pstore_rom, using general ram rather than block device.
[PATCH v2]
On patch 1:
Fix build as module error for redefinition of 'romz_unregister' and 'romz_register'
[PATCH v3]
On patch 1:
Fix build as module error for undefined 'vfs_read' and 'vfs_write' Both of 'vfs_read' and 'vfs_write' haven't be exproted yet, so we use 'kernel_read' and 'kernel_write' instead.
liaoweixiong (2):
pstore/rom: new support logger for block devices pstore/rom: add sample for pstore_rom
fs/pstore/Kconfig | 16 + fs/pstore/Makefile | 5 + fs/pstore/rombuf.c | 46 +++ fs/pstore/romzone.c | 957 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pstore_rom.h | 61 +++ 5 files changed, 1085 insertions(+) create mode 100644 fs/pstore/rombuf.c create mode 100644 fs/pstore/romzone.c create mode 100644 include/linux/pstore_rom.h
Signature · 1 line
1.9.1
RFC v3 1/2 pstore/rom: new support logger for block devices
pstore_rom is similar to pstore_ram, but dump log to block devices rather than persistent ram.
Why should we need pstore_rom?
1. Most embedded intelligent equipment have no persistent ram, which increases costs. We perfer to cheaper solutions, like block devices. In fast, there is already a sample for block device logger in driver MTD (drivers/mtd/mtdoops.c).
2. Do not any equipment have battery, which means that it lost all data on general ram if power failure. Pstore has little to do for these equipments.
pstore_rom can only dump Oops/Panic log to block devices. It only supports dmesg now. To make pstore_rom work, the block driver should provide the path of a block partition device (/dev/XXXX) and the read/write apis when on panic.
pstore_rom begins at 'romz_register', by witch block device can register a block partition to pstore_rom. Then pstore_rom divide and manage the partition as zones, which is similar to pstore_ram.
Recommend that, block driver register pstore_rom after block device is ready.
pstore_rom works well on allwinner(sunxi) platform.
--- fs/pstore/Kconfig | 7 + fs/pstore/Makefile | 3 + fs/pstore/romzone.c | 957 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pstore_rom.h | 61 +++ 4 files changed, 1028 insertions(+) create mode 100644 fs/pstore/romzone.c create mode 100644 include/linux/pstore_rom.h
fs/pstore/Kconfig +7 -0
@@ -152,3 +152,10 @@ config PSTORE_RAM "ramoops.ko". For more information, see Documentation/admin-guide/ramoops.rst. + +config PSTORE_ROM + tristate "Log panic/oops to a block device" + depends on PSTORE + help + This enables panic and oops message to be logged to a block dev + where it can be read back at some later point.
fs/pstore/Makefile +3 -0
@@ -12,3 +12,6 @@ pstore-$(CONFIG_PSTORE_PMSG) += pmsg.o ramoops-objs += ram.o ram_core.o obj-$(CONFIG_PSTORE_RAM) += ramoops.o + +obj-$(CONFIG_PSTORE_ROM) += romoops.o +romoops-y += romzone.o
fs/pstore/romzone.c new file +957 -0
957 lines not on this page · raw message
include/linux/pstore_rom.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC v3 2/2 pstore/rom: add sample for pstore_rom
In reply to liaoweixiongIt is a sample for pstore_rom, using general ram rather than block device. According to pstore_rom, the data will be saved to ram buffer if not register device path and apis for panic. So, it can only used to dump Oops and some things will not reboot.
--- fs/pstore/Kconfig | 9 +++++++++ fs/pstore/Makefile | 2 ++ fs/pstore/rombuf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 fs/pstore/rombuf.c
fs/pstore/Kconfig +9 -0
@@ -159,3 +159,12 @@ config PSTORE_ROM help This enables panic and oops message to be logged to a block dev where it can be read back at some later point. + +config PSTORE_ROMBUF + tristate "romoop buffer sample" + depends on PSTORE_ROM + help + This is a sample for pstore rom, but do NOT have a block dev. + According to pstore_rom, the data will be saved to ram buffer and + dropped when reboot. So, it can only used to dump Oops and some + things will not reboot.
fs/pstore/Makefile +2 -0
@@ -15,3 +15,5 @@ obj-$(CONFIG_PSTORE_RAM) += ramoops.o obj-$(CONFIG_PSTORE_ROM) += romoops.o romoops-y += romzone.o + +obj-$(CONFIG_PSTORE_ROMBUF) += rombuf.o
fs/pstore/rombuf.c new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.9.1