Skip to content

Commit 0dc0682

Browse files
WeiXiong Liaokees
authored andcommitted
pstore/zone,blk: Add support for pmsg frontend
Add pmsg support to pstore/blk (through pstore/zone). To enable, pmsg_size must be greater than 0 and a multiple of 4096. Signed-off-by: WeiXiong Liao <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Co-developed-by: Colin Ian King <[email protected]> Signed-off-by: Colin Ian King <[email protected]> Link: https://lore.kernel.org/lkml/[email protected] Co-developed-by: Kees Cook <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent 17639f6 commit 0dc0682

File tree

4 files changed

+282
-9
lines changed

4 files changed

+282
-9
lines changed

fs/pstore/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,15 @@ config PSTORE_BLK_MAX_REASON
224224

225225
NOTE that, both Kconfig and module parameters can configure
226226
pstore/blk, but module parameters have priority over Kconfig.
227+
228+
config PSTORE_BLK_PMSG_SIZE
229+
int "Size in Kbytes of pmsg to store"
230+
depends on PSTORE_BLK
231+
depends on PSTORE_PMSG
232+
default 64
233+
help
234+
This just sets size of pmsg (pmsg_size) for pstore/blk. The size is
235+
in KB and must be a multiple of 4.
236+
237+
NOTE that, both Kconfig and module parameters can configure
238+
pstore/blk, but module parameters have priority over Kconfig.

fs/pstore/blk.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ module_param(max_reason, int, 0400);
2727
MODULE_PARM_DESC(max_reason,
2828
"maximum reason for kmsg dump (default 2: Oops and Panic)");
2929

30+
#if IS_ENABLED(CONFIG_PSTORE_PMSG)
31+
static long pmsg_size = CONFIG_PSTORE_BLK_PMSG_SIZE;
32+
#else
33+
static long pmsg_size = -1;
34+
#endif
35+
module_param(pmsg_size, long, 0400);
36+
MODULE_PARM_DESC(pmsg_size, "pmsg size in kbytes");
37+
3038
/*
3139
* blkdev - the block device to use for pstore storage
3240
*
@@ -133,6 +141,7 @@ static int psblk_register_do(struct pstore_device_info *dev)
133141
}
134142

135143
verify_size(kmsg_size, 4096, dev->flags & PSTORE_FLAGS_DMESG);
144+
verify_size(pmsg_size, 4096, dev->flags & PSTORE_FLAGS_PMSG);
136145
#undef verify_size
137146

138147
pstore_zone_info->total_size = dev->total_size;

0 commit comments

Comments
 (0)