unikraft icon indicating copy to clipboard operation
unikraft copied to clipboard

[RFC] include/uk: Remove ukarch_compare_exchange_sync

Open mschlumpp opened this issue 2 years ago • 0 comments

Prerequisite checklist

  • [x] Read the contribution guidelines regarding submitting new changes to the project;
  • [x] Tested your changes against relevant architectures and platforms;
  • [ ] Ran the checkpatch.pl on your commit series before opening this PR;
  • [ ] Updated relevant documentation.

Base target

  • Architecture(s): N/A
  • Platform(s): N/A
  • Application(s): N/A

Additional configuration

Description of changes

This macro had an unexpected semantic in case the comparison fails. In that case it returned the old instead of the current value. The builtin itself provides more sane semantics and therefore this also replaces all usages of the ukarch_compare_exchange_sync macro with the builtin itself.

As an alternative to this patch we could also fix the old macro and keep it as an abstraction layer. On the other hand we could also go further with this patch and also replace the other macros. These would also allow a more fine-grained memory ordering parameter.

mschlumpp avatar Nov 11 '22 10:11 mschlumpp