History

kcsan, debugfs: Move debugfs file creation out of early init

Commit 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized") forbids creating new debugfs files until debugfs is fully initialized. This means that KCSAN's debugfs file creation, which happened at the end of __init(), no longer works. And was apparently never supposed to work! However, there is no reason to create KCSAN's debugfs file so early. This commit therefore moves its creation to a late_initcall() callback.

Marco Elver committed 5 years ago

Commit e36299e1 parent a38fd873 files · +3 −8Browse files

Showing the changes to kernel (3 of 3 files). Show all

Unified · Split

3 files
  1. kernel/kcsan/core.c +0 −2
  2. kernel/kcsan/debugfs.c +3 −1
  3. kernel/kcsan/kcsan.h +0 −5
kernel/kcsan/core.c+0−2
@@ -639,8 +639,6 @@ void __init kcsan_init(void) · 638 unmodified lines
639 639
640 BUG_ON(!in_task());640 BUG_ON(!in_task());
641 641
642 kcsan_debugfs_init();
643
644 for_each_possible_cpu(cpu)642 for_each_possible_cpu(cpu)
645 per_cpu(kcsan_rand_state, cpu) = (u32)get_cycles();643 per_cpu(kcsan_rand_state, cpu) = (u32)get_cycles();
646 644
kernel/kcsan/debugfs.c+3−1
@@ -261,7 +261,9 @@ static const struct file_operations debugfs_ops = · 260 unmodified lines
261 .release = single_release261 .release = single_release
262};262};
263 263
264void __init kcsan_debugfs_init(void)264static void __init kcsan_debugfs_init(void)
265{265{
266 debugfs_create_file("kcsan", 0644, NULL, NULL, &debugfs_ops);266 debugfs_create_file("kcsan", 0644, NULL, NULL, &debugfs_ops);
267}267}
268
269late_initcall(kcsan_debugfs_init);
kernel/kcsan/kcsan.h+0−5
@@ -30,11 +30,6 @@ extern bool kcsan_enabled; · 29 unmodified lines
30void kcsan_save_irqtrace(struct task_struct *task);30void kcsan_save_irqtrace(struct task_struct *task);
31void kcsan_restore_irqtrace(struct task_struct *task);31void kcsan_restore_irqtrace(struct task_struct *task);
32 32
33/*
34 * Initialize debugfs file.
35 */
36void kcsan_debugfs_init(void);
37
38/*33/*
39 * Statistics counters displayed via debugfs; should only be modified in34 * Statistics counters displayed via debugfs; should only be modified in
40 * slow-paths.35 * slow-paths.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t