Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devicetree: fix non-deterministic multi-level interrupt encodings #20571

Closed
pabigot opened this issue Nov 11, 2019 · 2 comments
Closed

devicetree: fix non-deterministic multi-level interrupt encodings #20571

pabigot opened this issue Nov 11, 2019 · 2 comments
Assignees
Labels
area: Devicetree bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Milestone

Comments

@pabigot
Copy link
Collaborator

pabigot commented Nov 11, 2019

The scripting that generates multi-level IRQ information does not guarantee determininstic instance order. While it can be patched by hard-coding specific instances as with #20550 and #20562 the problem needs to be solved more generally.

Example output from #20558.

Screenshots or console output

[184/188] Generating linker_pass_final.cmd
[185/188] Generating isr_tables.c
FAILED: cd /home/buildslave/src/github.com/zephyrproject-rtos/zephyr/sanity-out/rv32m1_vega_ri5cy/samples/bluetooth/peripheral_hr/sample.bluetooth.peripheral_hr_rv32m1_vega_ri5cy/zephyr && /opt/sdk/zephyr-sdk-0.10.3/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-objcopy --input-target=elf32-littleriscv --output-target=binary --only-section=.intList /home/buildslave/src/github.com/zephyrproject-rtos/zephyr/sanity-out/rv32m1_vega_ri5cy/samples/bluetooth/peripheral_hr/sample.bluetoot.h.peripheral_hr_rv32m1_vega_ri5cy/zephyr/zephyr_prebuilt.elf isrList.bin && /usr/bin/python3 /home/buildslave/src/github.com/zephyrproject-rtos/zephyr/arch/common/gen_isr_tables.py --output-source isr_tables.c --kernel /home/buildslave/src/github.com/zephyrproject-rtos/zephyr/sanity-out/rv32m1_vega_ri5cy/samples/bluetooth/peripheral_hr/sample.bluetooth.peripheral_hr_rv32m1_vega_ri5cy/zephyr/zephyr_prebuilt.elf --intlist isrList.bin   --sw-isr-table
gen_isr_tables.py: multiple registrations at table_index 25 for irq 25 (0x19)
Traceback (most recent call last):
  File "/home/buildslave/src/github.com/zephyrproject-rtos/zephyr/arch/common/gen_isr_tables.py", line 314, in <module>
    main()
  File "/home/buildslave/src/github.com/zephyrproject-rtos/zephyr/arch/common/gen_isr_tables.py", line 306, in main
    error("multiple registrations at table_index %d for irq %d (0x%x)" % (table_index, irq, irq))
  File "/home/buildslave/src/github.com/zephyrproject-rtos/zephyr/arch/common/gen_isr_tables.py", line 36, in error
    raise Exception()
Exception
ninja: build stopped: subcommand failed.
@pabigot pabigot added bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug labels Nov 11, 2019
@galak galak added this to the v2.1.0 milestone Nov 11, 2019
@carlescufi carlescufi added priority: high High impact/importance bug and removed priority: medium Medium impact/importance bug labels Nov 11, 2019
@carlescufi
Copy link
Member

Setting priority to high because this completely defeats the deterministic nature of DT.

@ulfalizer
Copy link
Collaborator

Didn't notice this one until now, but I wonder if #20597 solves it. In that case it was only an issue on Python 3.5 and earlier. CI runs 3.5.

ulfalizer added a commit to ulfalizer/zephyr that referenced this issue Nov 12, 2019
Python 3.5 and earlier do not preserve dictionary insertion order when
iterating over dictionaries, and do not give the same order between
runs. This broke the dtlib and edtlib test suites and made the output
jump around randomly between runs. It also made device INST_<n> numbers
non-deterministic, which broke some code on Python 3.5 (though
hardcoding device instance numbers in the code might be a bit shaky).

Fix it by using collections.OrderedDict instead of plain dict wherever
order matters. This makes the output identical on all supported Python
versions. It also allows testdtlib.py and testedtlib.py to run in CI,
which uses Python 3.5.

Fixes: zephyrproject-rtos#20571

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
@galak galak added the has-pr label Nov 12, 2019
@galak galak closed this as completed in 7215885 Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants