On 12/16/2025 5:29 PM, Timur Tabi wrote: > On Tue, 2025-12-16 at 17:01 -0500, Joel Fernandes wrote: >> Could the debugfs Rust abstraction add a directory lookup function >> `Dir::lookup(name)` method and allow creating sub directories under a known >> path? > > Actually, that's an excellent idea.
Thanks. >> This would let `probe()` find the module-created root directory without >> needing global state right? Then store references to this on a per-GPU basis >> that the GSP code can access. > > Yes, that would work. I will try to implement this, but I suspect I will > need help. Cool! >> Alternatively, the first probe can create the root >> directory, and subsequent probes reuse it without requiring module-level >> root. > > How would the second probe know that it's not the first, and where would it > look up the root Dir? Since driver_attach() attaches devices to drivers serially AFAIK, simply look up the debugfs nova root path in probe(), if it does not exist create it. If it does exist, then you know you're not the first one. In C, debugfs_lookup() can lookup a name from the root if parent passed is NULL. Or we can have a Dir::find_or_create() in the debugfs Rust abstraction which abstracts this which does both. Alternatively, create nova_core root directory at module init, and then probe() can assume it exists. That's also robust against any possible concurrent multiple device probes I think (basically the case where 2 look ups happen simultaneously and then 2 creates happen simultaneously - one of them error'ing out and printing a nastygram in dmesg). thanks, - Joel
