aboutsummaryrefslogtreecommitdiffstats
path: root/nvdebug_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'nvdebug_entry.c')
-rw-r--r--nvdebug_entry.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/nvdebug_entry.c b/nvdebug_entry.c
new file mode 100644
index 0000000..148bd3f
--- /dev/null
+++ b/nvdebug_entry.c
@@ -0,0 +1,40 @@
1/* Copyright 2021 Joshua Bakita
2 * SPDX-License-Identifier: MIT
3 */
4
5/* TODO
6 * - Add sysfs trigger for a preemption
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/proc_fs.h> // So we can set up entries in /proc
12
13#include "nvdebug.h"
14
15// LIAR. But without this we can't use GPL-only exported symbols like
16// platform_bus_type or bus_find_device_by_name...
17MODULE_LICENSE("GPL");
18MODULE_AUTHOR("Joshua Bakita");
19MODULE_DESCRIPTION("A scheduling debugging module for NVIDIA GPUs");
20MODULE_SOFTDEP("pre: nvgpu"); // We only support the Jetson boards for now
21
22extern const struct file_operations runlist_file_ops;
23
24int __init nvdebug_init(void) {
25 struct proc_dir_entry *entry = proc_create("runlist", 0444, NULL, &runlist_file_ops);
26 if (!entry) {
27 remove_proc_entry("runlist", NULL);
28 printk(KERN_ERR "[nvdebug] Unable to initialize procfs entries!\n");
29 return -ENOMEM;
30 }
31 return 0;
32}
33
34static void __exit nvdebug_exit(void) {
35 remove_proc_entry("runlist", NULL);
36 printk(KERN_INFO "[nvdebug] Exiting...\n");
37}
38
39module_init(nvdebug_init);
40module_exit(nvdebug_exit);