Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pstore/ftrace: Keep ftrace module parameter and debugfs switch in sync

Commit a5d05b07961a ("pstore/ftrace: Allow immediate recording")
introduced a kernel parameter to enable early-boot collection for
ftrace frontend. But then, if we enable the debugfs later, the
parameter remains set as N. This is not a biggie, things work fine;
but at the same time, why not have both in sync if possible, right?

Cc: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://patch.msgid.link/20260301192704.1263589-1-gpiccoli@igalia.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Guilherme G. Piccoli and committed by
Kees Cook
421a41c4 2ddb69f6

+9 -11
+9 -11
fs/pstore/ftrace.c
··· 62 62 }; 63 63 64 64 static DEFINE_MUTEX(pstore_ftrace_lock); 65 - static bool pstore_ftrace_enabled; 65 + static bool record_ftrace; 66 + module_param(record_ftrace, bool, 0400); 67 + MODULE_PARM_DESC(record_ftrace, 68 + "enable ftrace recording immediately (default: off)"); 66 69 67 70 static int pstore_set_ftrace_enabled(bool on) 68 71 { 69 72 ssize_t ret; 70 73 71 - if (on == pstore_ftrace_enabled) 74 + if (on == record_ftrace) 72 75 return 0; 73 76 74 77 if (on) { ··· 85 82 pr_err("%s: unable to %sregister ftrace ops: %zd\n", 86 83 __func__, on ? "" : "un", ret); 87 84 } else { 88 - pstore_ftrace_enabled = on; 85 + record_ftrace = on; 89 86 } 90 87 91 88 return ret; ··· 114 111 static ssize_t pstore_ftrace_knob_read(struct file *f, char __user *buf, 115 112 size_t count, loff_t *ppos) 116 113 { 117 - char val[] = { '0' + pstore_ftrace_enabled, '\n' }; 114 + char val[] = { '0' + record_ftrace, '\n' }; 118 115 119 116 return simple_read_from_buffer(buf, count, ppos, val, sizeof(val)); 120 117 } ··· 126 123 }; 127 124 128 125 static struct dentry *pstore_ftrace_dir; 129 - 130 - static bool record_ftrace; 131 - module_param(record_ftrace, bool, 0400); 132 - MODULE_PARM_DESC(record_ftrace, 133 - "enable ftrace recording immediately (default: off)"); 134 126 135 127 void pstore_register_ftrace(void) 136 128 { ··· 143 145 void pstore_unregister_ftrace(void) 144 146 { 145 147 mutex_lock(&pstore_ftrace_lock); 146 - if (pstore_ftrace_enabled) { 148 + if (record_ftrace) { 147 149 unregister_ftrace_function(&pstore_ftrace_ops); 148 - pstore_ftrace_enabled = false; 150 + record_ftrace = false; 149 151 } 150 152 mutex_unlock(&pstore_ftrace_lock); 151 153