[SLOF] [PATCH slof] fdt: Avoid recursion when traversing tree
Alexey Kardashevskiy
aik at ozlabs.ru
Fri Jul 17 19:39:53 AEST 2020
On 17/07/2020 17:42, Greg Kurz wrote:
> On Fri, 17 Jul 2020 10:34:40 +1000
> Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
>
>>
>>
>> On 17/07/2020 01:54, Greg Kurz wrote:
>>> Hi Alexey,
>>>
>>> It seems it did again ! I haven't received this in my inbox, despite you've
>>> put me on Cc... :-\
>>>
>>> On Thu, 16 Jul 2020 14:55:42 +1000
>>> Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
>>>
>>>> A loop over peers does not need recursion which becomes a problem with
>>>> hundreds devices.
>>>>
>>>
>>> You're likely right but, per curiosity, do you have some numbers to
>>> share ?
>>
>>
>> This was discovered with just "-smp 2048,cores=512,threads=4" and the
>> results were either "cas not implemented" or some other weird XIVE
>> messages (I did not see any but Anton did).
>>
>
> Oh, I was thinking to something like "it took 30 minutes to boot", but
Well, this too but it is just some waiting :)
> you seem to be talking about dysfunction of SLOF, which would be caused
> by stack exhaustion if I understand Segher's anwser correctly, right ?
Right. I am a bit surprised SLOF did not barf with "stack overflow" though.
>
>>
>>
>>>
>>>> Cc: Greg Kurz <groug at kaod.org>
>>>> Fixes: efa56b851fab ("fdt: Delete nodes of devices removed between boot and CAS")
>>>> Suggested-by: Jordan Niethe <jniethe5 at gmail.com>
>>>> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
>>>> ---
>>>> board-qemu/slof/fdt.fs | 27 +++++++++++++++------------
>>>> 1 file changed, 15 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs
>>>> index 7da4ff066702..03b1d4034d0a 100644
>>>> --- a/board-qemu/slof/fdt.fs
>>>> +++ b/board-qemu/slof/fdt.fs
>>>> @@ -636,20 +636,23 @@ r> drop
>>>> THEN
>>>> ;
>>>>
>>>> -: (fdt-cas-search-obsolete-nodes) ( start node -- )
>>>> - dup IF
>>>> - dup child 2 pick swap recurse
>>>> - dup peer 2 pick swap recurse
>>>> -
>>>> - dup fdt-cas-node-obsolete? IF
>>>> - fdt-debug IF dup ." Deleting obsolete node: " dup .node ." = " . cr THEN
>>>> - dup delete-node
>>>> - THEN
>>>> +: (fdt-cas-search-obsolete-nodes) ( node -- )
>>>> + dup child
>>>> + BEGIN
>>>> + dup
>>>> + WHILE
>>>> + dup recurse
>>>> + peer
>>>> + REPEAT
>>>> + drop
>>>> + dup fdt-cas-node-obsolete? IF
>>>> + fdt-debug IF dup ." Deleting obsolete node: " dup .node ." = " . cr THEN
>>>> + dup delete-node
>>>> THEN
>>>> - 2drop
>>>> + drop
>>>> ;
>>>>
>>>> -: fdt-cas-delete-obsolete-nodes ( start -- )
>>>> +: fdt-cas-delete-obsolete-nodes ( -- )
>>>> s" /" find-device get-node (fdt-cas-search-obsolete-nodes)
>>>> fdt-cas-delete-obsolete-aliases
>>>> ;
>>>> @@ -657,7 +660,7 @@ r> drop
>>>> : fdt-fix-cas-node ( start -- )
>>>> fdt-generation# 1+ to fdt-generation#
>>>> 0 to fdt-cas-pass dup (fdt-fix-cas-node) drop \ Add phandles
>>>> - dup fdt-cas-delete-obsolete-nodes \ Delete removed devices
>>>> + fdt-cas-delete-obsolete-nodes \ Delete removed devices
>>>
>>> Maybe keep the comment aligned with the other ones ?
>>
>> May be :)
>>
>>>
>>> Reviewed-by: Greg Kurz <groug at kaod.org>
>>
>>
>> Thanks!
>>
>>>
>>>> 1 to fdt-cas-pass dup (fdt-fix-cas-node) drop \ Patch+add other properties
>>>> 2 to fdt-cas-pass dup (fdt-fix-cas-node) drop \ Delete phandles from pass 0
>>>> drop
>>>
>>
>
--
Alexey
More information about the SLOF
mailing list