PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

User high resolution timer fix

Open pussuw opened this issue 3 years ago • 3 comments

Describe problem solved by this pull request

This fixes two crashes when using user hrt:

  1. Stack underflow, which occurs randomly due to exception stack overflow
  2. Crash due to illegal instruction when trying to disable global interrupts from user space.

Describe your solution

User land code does not need to disable system interrupts, especially here, as the atomic handling of hrt is handled by the kernel side code.

Test data / coverage

Unpublished RISC-V target for Microchip MPFS.

Additional context

RISC-V does not allow executing global interrupt disable/enable from user space. Doing so results in an illegal instruction trap.

pussuw avatar Aug 23 '22 07:08 pussuw

@dagar I removed hrt_store_absolute_time entirely

pussuw avatar Sep 12 '22 07:09 pussuw

Can you fix the CI failure (style check)? https://github.com/PX4/PX4-Autopilot/actions/runs/3035286435/jobs/4885259187

Otherwise this looks good, thanks.

dagar avatar Sep 21 '22 13:09 dagar

Can you fix the CI failure (style check)? https://github.com/PX4/PX4-Autopilot/actions/runs/3035286435/jobs/4885259187

Otherwise this looks good, thanks.

Oh I'm sorry, did not notice there was a styling issue.

pussuw avatar Sep 22 '22 06:09 pussuw

@dagar was there still something you wish for me to do? From my part this is ready to merge.

pussuw avatar Oct 25 '22 06:10 pussuw

Hello again @dagar , this has been inactive for a while but the fix is valid and we have been running this patch for a while now so it is stable as well. If you wish I can also abandon this and we'll keep the change in our private repo only.

pussuw avatar Jan 17 '23 07:01 pussuw

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-maintainers-call-august-01-2023/33417/1

DronecodeBot avatar Aug 01 '23 14:08 DronecodeBot