Skip to content

Commit 75298aa

Browse files
suryasaimadhuIngo Molnar
authored andcommitted
x86/mm/dump_pagetables: Add page table directory to the debugfs VFS hierarchy
The upcoming support for dumping the kernel and the user space page tables of the current process would create more random files in the top level debugfs directory. Add a page table directory and move the existing file to it. Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 385ce0e commit 75298aa

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/x86/mm/debug_pagetables.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,26 @@ static const struct file_operations ptdump_fops = {
2222
.release = single_release,
2323
};
2424

25-
static struct dentry *pe;
25+
static struct dentry *dir, *pe;
2626

2727
static int __init pt_dump_debug_init(void)
2828
{
29-
pe = debugfs_create_file("kernel_page_tables", S_IRUSR, NULL, NULL,
30-
&ptdump_fops);
31-
if (!pe)
29+
dir = debugfs_create_dir("page_tables", NULL);
30+
if (!dir)
3231
return -ENOMEM;
3332

33+
pe = debugfs_create_file("kernel", 0400, dir, NULL, &ptdump_fops);
34+
if (!pe)
35+
goto err;
3436
return 0;
37+
err:
38+
debugfs_remove_recursive(dir);
39+
return -ENOMEM;
3540
}
3641

3742
static void __exit pt_dump_debug_exit(void)
3843
{
39-
debugfs_remove_recursive(pe);
44+
debugfs_remove_recursive(dir);
4045
}
4146

4247
module_init(pt_dump_debug_init);

0 commit comments

Comments
 (0)