diff options
Diffstat (limited to 'nvdebug_entry.c')
-rw-r--r-- | nvdebug_entry.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/nvdebug_entry.c b/nvdebug_entry.c index 6346659..14ad6e9 100644 --- a/nvdebug_entry.c +++ b/nvdebug_entry.c | |||
@@ -20,11 +20,31 @@ MODULE_DESCRIPTION("A scheduling debugging module for NVIDIA GPUs"); | |||
20 | MODULE_SOFTDEP("pre: nvgpu"); // We only support the Jetson boards for now | 20 | MODULE_SOFTDEP("pre: nvgpu"); // We only support the Jetson boards for now |
21 | 21 | ||
22 | extern const struct file_operations runlist_file_ops; | 22 | extern const struct file_operations runlist_file_ops; |
23 | extern const struct file_operations preempt_tsg_file_ops; | ||
24 | extern const struct file_operations disable_channel_file_ops; | ||
25 | extern const struct file_operations enable_channel_file_ops; | ||
26 | extern const struct file_operations switch_to_tsg_file_ops; | ||
23 | 27 | ||
24 | int __init nvdebug_init(void) { | 28 | int __init nvdebug_init(void) { |
25 | struct proc_dir_entry *entry = proc_create("runlist", 0444, NULL, &runlist_file_ops); | 29 | struct proc_dir_entry *rl_entry, *preempt_entry, *disable_channel_entry, |
26 | if (!entry) { | 30 | *enable_channel_entry, *switch_to_tsg_entry; |
31 | // Create file `/proc/preempt_tsg`, world readable | ||
32 | rl_entry = proc_create("runlist", 0444, NULL, &runlist_file_ops); | ||
33 | // Create file `/proc/preempt_tsg`, world writable | ||
34 | preempt_entry = proc_create("preempt_tsg", 0222, NULL, &preempt_tsg_file_ops); | ||
35 | // Create file `/proc/disable_channel`, world writable | ||
36 | disable_channel_entry = proc_create("disable_channel", 0222, NULL, &disable_channel_file_ops); | ||
37 | // Create file `/proc/enable_channel`, world writable | ||
38 | enable_channel_entry = proc_create("enable_channel", 0222, NULL, &enable_channel_file_ops); | ||
39 | // Create file `/proc/switch_to_tsg`, world writable | ||
40 | switch_to_tsg_entry = proc_create("switch_to_tsg", 0222, NULL, &switch_to_tsg_file_ops); | ||
41 | // ProcFS entry creation only fails if out of memory | ||
42 | if (!rl_entry || !preempt_entry || !disable_channel_entry || !enable_channel_entry || !switch_to_tsg_entry) { | ||
27 | remove_proc_entry("runlist", NULL); | 43 | remove_proc_entry("runlist", NULL); |
44 | remove_proc_entry("preempt_tsg", NULL); | ||
45 | remove_proc_entry("disable_channel", NULL); | ||
46 | remove_proc_entry("enable_channel", NULL); | ||
47 | remove_proc_entry("switch_to_tsg", NULL); | ||
28 | printk(KERN_ERR "[nvdebug] Unable to initialize procfs entries!\n"); | 48 | printk(KERN_ERR "[nvdebug] Unable to initialize procfs entries!\n"); |
29 | return -ENOMEM; | 49 | return -ENOMEM; |
30 | } | 50 | } |
@@ -34,6 +54,10 @@ int __init nvdebug_init(void) { | |||
34 | 54 | ||
35 | static void __exit nvdebug_exit(void) { | 55 | static void __exit nvdebug_exit(void) { |
36 | remove_proc_entry("runlist", NULL); | 56 | remove_proc_entry("runlist", NULL); |
57 | remove_proc_entry("preempt_tsg", NULL); | ||
58 | remove_proc_entry("disable_channel", NULL); | ||
59 | remove_proc_entry("enable_channel", NULL); | ||
60 | remove_proc_entry("switch_to_tsg", NULL); | ||
37 | printk(KERN_INFO "[nvdebug] Exiting...\n"); | 61 | printk(KERN_INFO "[nvdebug] Exiting...\n"); |
38 | } | 62 | } |
39 | 63 | ||