-
Notifications
You must be signed in to change notification settings - Fork 294
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
remoteproc_allocate_id not treating notifyid as 32-bits #403
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix compilation warnings:
https://github.com/OpenAMP/open-amp/runs/7505888819?check_suite_focus=true#step:4:1128
@arnopo I am unable to find any warnings related to the code change. Can you kindly show me where the error is being reported? - Nevermind, I downloaded the logs and grepped - I see now. Thanks! |
@arnopo Resolving the warnings will require changing data types in the functions in libmetal's utilities.h. I think we need to have a discussion about this, because changing this will have an effect on all OS's libmetal layers. Maybe we should rethink the way handle_vdev_rsc uses remoteproc_allocate_id instead of making such drastic changes to libmetal bitmaps. |
That's right! We could keep the bitmap as an unsigned long (4 bytes for 32-bit architecture, 8 bytes for 64-bit architecture). The important point is to make sure that the allocated ID does not exceed 32 bits. |
@arnopo So do you recommend handle_vdev_rsc handle setting the input parameter end to METAL_BITS_PER_ULONG if it is RSC_NOTIFY_ID_ANY instead of remoteproc_allocate_id doing it? |
my proposal is to keep
With that we should ensure that the |
@arnopo I was thinking of changing the way handle_vdev_rsc uses remoteproc_allocate_id instead; otherwise, we would end up passing end = 0xffffffff + 1 into remoteproc_allocate_id in the case of RSC_NOTIFY_ID_ANY in the resource table on 64-bit platforms. I suggest instead of passing notifyid + 1 in the case of RSC_NOTIFY_ID_ANY, to pass 0 or pass RSC_NOTIFY_ID_ANY and change remoteproc_allocate_id to check for end == RSC_NOTIFY_ID_ANY instead of end == 0. |
In the resource table, the notifyid is in uint32_t format whatever the processor architecture.
Passing RSC_NOTIFY_ID_ANY for both start and end seems a good Idea |
4532351
to
8b6dd3c
Compare
@arnopo It seems github has reached some limit with Azure so my Zephyr build has failed, but can you please review the updated fix and let me know your thoughts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code LGTM.
The commit message contain details to explain the reason of the commit. The main reason is that this fix a potential overflow of the notify_id in case of 64-bit architecture. This information is missing
Yes this is the second time I see the error, re-running the github action solves the issue. |
handle_vdev_rsc sets end to RSC_NOTIFY_ID_ANY in case of wildcard notifyid Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
8b6dd3c
to
dbd32b9
Compare
@arnopo Thank you for the input - please review updated commit message at your convenience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go.
notifyid is 32 bits in the resource table and must be uint32_t in code
Signed-off-by: Tammy Leino tammy_leino@mentor.com