On Tue, 2025-12-16 at 18:17 -0500, Joel Fernandes wrote:
> > 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.

Oh, you meant to use lookup() in both cases.

> 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).

I like this approach better.  


Reply via email to