# Re: \[PATCH 03/13\] powerpc/rtas: avoid device tree lookups in rtas\_os\_term()

- From: Nathan Lynch \<hidden\>
- Date: 2022-11-28 18:27:48 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2022/11/9529308
- Thread: https://ratatoskr.run/linuxppc-dev/2022/11/9529133/t.md

```text
"Nicholas Piggin" [ref] writes:
> On Sat Nov 19, 2022 at 1:07 AM AEST, Nathan Lynch wrote:
>> rtas_os_term() is called during panic. Its behavior depends on a
>> couple of conditions in the /rtas node of the device tree, the
>> traversal of which entails locking and local IRQ state changes. If the
>> kernel panics while devtree_lock is held, rtas_os_term() as currently
>> written could hang.
>
> Nice.
>
>>
>> Instead of discovering the relevant characteristics at panic time,
>> cache them in file-static variables at boot. Note the lookup for
>> "ibm,extended-os-term" is converted to of_property_read_bool() since
>> it is a boolean property, not a RTAS function token.
>
> Small nit, but you could do that at the query site unless you
> were going to start using ibm,os-term without the extended
> capability.

I'm unsure that this is what you're suggesting, but we don't want to use
of_property_read_bool() in this context either, because it has the same
undesirable qualities as rtas_token().

> Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

Thanks!
```
