Re: [PATCH 2/5] of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock
From: Andy Shevchenko
Date: Tue Aug 01 2023 - 23:28:59 EST
On Tue, Aug 01, 2023 at 03:54:45PM -0600, Rob Herring wrote:
> While originally it was fine to format strings using "%pOF" while
> holding devtree_lock, this now causes a deadlock. Lockdep reports:
>
> of_get_parent from of_fwnode_get_parent+0x18/0x24
> ^^^^^^^^^^^^^
> of_fwnode_get_parent from fwnode_count_parents+0xc/0x28
> fwnode_count_parents from fwnode_full_name_string+0x18/0xac
> fwnode_full_name_string from device_node_string+0x1a0/0x404
> device_node_string from pointer+0x3c0/0x534
> pointer from vsnprintf+0x248/0x36c
> vsnprintf from vprintk_store+0x130/0x3b4
>
> To fix this, move the printing in __of_changeset_entry_apply() outside the
> lock. As there's already similar printing of the same changeset actions,
> refactor all of them to use a common action print function. This has the
> side benefit of getting rid of some ifdefs.
...
> v3:
> - Add missing 'static' reported by 0-day
It reported two issues (at least what I see).
...
> + if (pr_debug("notify "))
This is weird. How did you compile it?
> + of_changeset_action_print(action, pr->dn, pr->prop ? pr->prop->name : NULL);
--
With Best Regards,
Andy Shevchenko