Skip to content

Conversation

@marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Nov 18, 2021

Zephyr commit 174cb7f9f183 switched 'atomic_t' from 'int' to
'long' and broke SOF compilation as shown below.

Recent SOF commit 970d7d6 ("zephyr: update print messages for
64-bit atomics") switched all atomic_read() logs to "%ld" instead of
"%d" which fixed compilation with Zephyr after the switch but broke it
with Zephyr before the switch.

This no-op (long) cast makes SOF compatible with Zephyr both before and
after the switch.

Note the sof-logger does not make any difference between %ld and %d and
does not care.

Sample failure:

src/lib/dma.c: In function 'dma_get': sof/src/include/sof/trace/trace.h:290
 error: format '%d' expects argument of type 'int', but
 argument 5 has type 'atomic_val_t' {aka 'long int'} [-Werror=format=]

 290 |   printk("%llu " format "\n", platform_timer_get(NULL), \
     |                 ^~~~~~~

sof/src/lib/dma.c:119:2: note: in expansion of macro 'tr_info'

 119 |  tr_info(&dma_tr, "..., busy channels = %d", atomic_read(...))

Signed-off-by: Marc Herbert [email protected]

@marc-hb
Copy link
Collaborator Author

marc-hb commented Nov 18, 2021

The Zephyr build fails on only one platform for an unrelated reason:

build-rimage/rimage -k modules/audio/sof/keys/otc_private_key.pem -o /workdir/zephyrproject/build-icl/zephyr/zephyr.ri -c modules/audio/sof/rimage/config/icl.toml -i 3 -e /workdir/zephyrproject/build-icl/zephyr/bootloader.elf.mod /workdir/zephyrproject/build-icl/zephyr/zephyr.elf.mod
error: section overlap between /workdir/zephyrproject/build-icl/zephyr/zephyr.elf.mod:20 and /workdir/zephyrproject/build-icl/zephyr/zephyr.elf.mod:22

     [0xbe048f80 : 0xbe049420] overlaps with [0xbe048f80 :0xbe053780]

EDIT: bisected to revert zephyrproject-rtos/zephyr#40319
EDIT2: temporarily excluding ICL in #5005

@lgirdwood
Copy link
Member

SOFCI TEST

@lgirdwood
Copy link
Member

Rerun CI as this is a Zephyr only change that is showing unrelated failures.

Zephyr commit 174cb7f9f183 switched 'atomic_t' from 'int' to
'long' and broke SOF compilation as shown below.

Recent SOF commit 970d7d6 ("zephyr: update print messages for
64-bit atomics") switched all atomic_read() logs to "%ld" instead of
"%d" which fixed compilation with Zephyr after the switch but broke it
with Zephyr _before_ the switch.

This no-op (long) cast makes SOF compatible with Zephyr both before and
after the switch.

Note the sof-logger does not make any difference between %ld and %d and
does not care.

Sample failure:

src/lib/dma.c: In function 'dma_get': sof/src/include/sof/trace/trace.h:290
 error: format '%d' expects argument of type 'int', but
 argument 5 has type 'atomic_val_t' {aka 'long int'} [-Werror=format=]

 290 |   printk("%llu " format "\n", platform_timer_get(NULL), \
     |                 ^~~~~~~

sof/src/lib/dma.c:119:2: note: in expansion of macro 'tr_info'

 119 |  tr_info(&dma_tr, "..., busy channels = %d", atomic_read(...))

Signed-off-by: Marc Herbert <[email protected]>
@marc-hb
Copy link
Collaborator Author

marc-hb commented Nov 18, 2021

https://sof-ci.01.org/sofpr/PR5004/build11182/devicetest/?model=ADLP_RVP_NOCODEC&testcase=verify-kernel-boot-log is a race condition at boot, trying to run tests before the system is ready.

https://sof-ci.01.org/sofpr/PR5004/build11182/devicetest/?model=CML_RVP_SDW&testcase=check-suspend-resume-with-playback-5 is the usual rtcwake timeout

Everything else is green.

Zephyr build https://github.com/thesofproject/sof/runs/4254008709?check_suite_focus=true passing now that ICL has been excluded.

Checkpatch complains that it doesn't find the Zephyr commit in SOF history, no other warning.

@lgirdwood lgirdwood merged commit dda2b38 into thesofproject:main Nov 19, 2021
@marc-hb marc-hb deleted the atomic-long-cast branch December 21, 2021 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants