Re: [net-next RFC PATCH 1/2] net: mdio: implement mdio_mutex_nested guard() variant
From: Markus Elfring
Date: Thu Jun 27 2024 - 09:53:16 EST
> Implement mdio_mutex_nested guard() variant.
I find the idea generally helpful.
The concrete implementation needs further clarifications.
> guard() compes from the cleanup.h API that define handy class to
comes? defines?
> define the lifecycle of a critical section.
handle?
> Many driver makes use of the mutex_lock_nested()/mutex_unlock() hence it
Several drivers use? function call pair.
Would you like to clarify any application statistics another bit?
https://elixir.bootlin.com/linux/v6.10-rc5/A/ident/mutex_lock_nested
> might be sensible to provide a variant of the generic guard(mutex),
Hence it is? :
> guard(mdio_mutex_nested) to also support drivers that use
> mutex_lock_nested with MDIO_MUTEX_NESTED.
Another wording suggestion:
guard(mdio_mutex_nested) so that drivers can be better supported
with the call variant “mutex_lock_nested(…, MDIO_MUTEX_NESTED)”.
…
> +++ b/include/linux/mdio.h
> @@ -8,6 +8,8 @@
>
> #include <uapi/linux/mdio.h>
> #include <linux/bitfield.h>
> +#include <linux/cleanup.h>
I suggest to omit this preprocessing directive here.
> +#include <linux/mutex.h>
> #include <linux/mod_devicetable.h>
…
Further information is included as possibly needed.
https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/mutex.h#L22
How reasonable is the added header file dependency so far?
Under which circumstances can remaining change resistance be adjusted
for further benefits from applications of scope-based resource management?
Regards,
Markus