From 091c242c9ef7cbd8d88d3beae936b14f5b907286 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sun, 21 Apr 2024 20:30:08 -0400 Subject: Add /proc/gpu#/resubmit_runlist API Resubmits the runlist in an identical configuration. Causes the runlist scheduler to: 1. Reload and cache timeslice and scale values from TSGs. 2. Restart scheduling from the head of the runlist [may cause a preempt to be scheduled for the currently-running task (?)]. 3. Address (?) an errata on Turing where re-enabled channels are not always detected. Above behavior tested on GV100 and partially tested on TU102. --- runlist_procfs.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'runlist_procfs.c') diff --git a/runlist_procfs.c b/runlist_procfs.c index 0087d90..f569c77 100644 --- a/runlist_procfs.c +++ b/runlist_procfs.c @@ -207,6 +207,33 @@ struct file_operations preempt_tsg_file_ops = { .llseek = default_llseek, }; + +ssize_t resubmit_runlist_file_write(struct file *f, const char __user *buffer, + size_t count, loff_t *off) { + uint32_t target_runlist; + // Passing 0 as the base to kstrtou32 indicates autodetect hex/octal/dec + int err = kstrtou32_from_user(buffer, count, 0, &target_runlist); + struct nvdebug_state *g = &g_nvdebug_state[file2gpuidx(f)]; + if (err) + return err; + + // Verify valid runlist (in terms of absolute maximums) + if (g->chip_id < NV_CHIP_ID_TURING && target_runlist > MAX_RUNLISTS_GF100) + return -ERANGE; + else if (g->chip_id < NV_CHIP_ID_AMPERE && target_runlist > MAX_RUNLISTS_TU102) + return -ERANGE; + + if ((err = resubmit_runlist(g, target_runlist))) + return err; + + return count; +} + +struct file_operations resubmit_runlist_file_ops = { + .write = resubmit_runlist_file_write, + .llseek = default_llseek, +}; + ssize_t disable_channel_file_write(struct file *f, const char __user *buffer, size_t count, loff_t *off) { uint32_t target_channel; -- cgit v1.2.2