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

platforms/nuttx: Remove unnecessary sched_lock() from task spawn logic #812

Open
wants to merge 672 commits into
base: main
Choose a base branch
from

Conversation

pussuw
Copy link

@pussuw pussuw commented Nov 14, 2024

Starting a new task does not require that the scheduler is locked, this is done in nsh only because nsh uses waitpid() to wait for the task to exit and record its exit status.

The exit status does not interest us whatsoever -> remove the locking.

Also, we don't need to explicitly change a tasks priority when it is created by px4_task_spawn_cmd, as task_create() already sets the priority via nxthread_setup_scheduler().

jlaitine and others added 30 commits February 15, 2024 15:55
…ootloader without TOC

If TOC_ADDRESS is not defined, assume that there is no TOC

Signed-off-by: Jukka Laitinen <[email protected]>
…_base address

The default address was wrong. It doesn't cause harm, as it is anyhow set in the NuttX
initialization again.

Signed-off-by: Jukka Laitinen <[email protected]>
Increase uxrce_dds_client stack to get rid of stack low warning messages

Signed-off-by: Jukka Laitinen <[email protected]>
This can be reverted when there is proper board definition under boards/ssrc

Signed-off-by: Jukka Laitinen <[email protected]>
This can be reverted when there is proper board configuration under boards/ssrc

Signed-off-by: Jukka Laitinen <[email protected]>
timeout increased to avoid stopping before logger
Writing to two separate fifos (normal and delayed)
Delay stopping until all reliable messages are sent
Resending after ack timeout
…allback unregistration

In protected modes, the callback needs to be removed from the processes list of callbacks before
unregistering it from the device node. Otherwise there is a risk for callback thread trying to
access a callback which was already removed from the publishing node's list.

Signed-off-by: Jukka Laitinen <[email protected]>
…locking on user input

This fixes an earlier commit
     commit 0b60318
     Author: Jukka Laitinen <[email protected]>
     Date:   Fri Apr 22 16:40:13 2022 +0400

         src/systemcmds/topic_listener: Change topic listener to poll only on uorb

Signed-off-by: Jukka Laitinen <[email protected]>
…tervals

Set the last_update to now-interval, instead of 0.

Signed-off-by: Jukka Laitinen <[email protected]>
When the CPU load monitor is started while already running, then the
idle thread last_times[0] is reset to the last 1 second, rather than
since when the CPU load monitor was last started. The remaining threads
are not impacted, since their last_times[i] is reset to zero here.

This results in the idle thread having a lower than real CPU load, with
the remaining CPU time being wrongly attributed as scheduler load.
In memory protected modes there were the following issues:
1. It is wrong to self-unregister the callback in uORBDeviceNode. The device
   node can't assume that the callback thread is killed if the callbacks
   haven't been handled timely. It might also be temporarily blocked e.g. during boot.
   If the device node unregisters the callback and the callback thread gets executed later,
   the cb_handle would point to an item within the device node that is not any more in use.
2. While registering a callback, it has to be registered to both callback thread and the
   device node before letting callback thread handle them.

Fix these issues as follows:
1. Don't let the device node unregister the callback by itself
2. Keep the callback list locked for the full registration of the callback

In addition, make a minor clean up for the uORB::DeviceNode::_unregister_callback.
Get a pointer to the callback item before removing it from the node's cb list. The original
code happened to work since the callback handle is just an idex to statically allocated items,
but it looked weird.

Signed-off-by: Jukka Laitinen <[email protected]>
TimoSairiala and others added 25 commits September 23, 2024 12:00
Signed-off-by: Jukka Laitinen <[email protected]>
…otype changed in the new NuttX

Signed-off-by: Jukka Laitinen <[email protected]>
The file has been merged into nuttx/can.h

Signed-off-by: Jukka Laitinen <[email protected]>
We don't want to maintain these any more

Signed-off-by: Jukka Laitinen <[email protected]>
…to check that instead of "flat"

Signed-off-by: Jukka Laitinen <[email protected]>
To get nuttx with
-CI fix
-MPFS serial RX flowcontrol feature
-vfork fix

To enable RX flowcontrol feature in saluki defconfigs.
- This occurs due to nxsem_tickwait returning also other error values than -ETIMEDOUT. Fix
the issue by treating any error value as a timeout.
- There is no need to clear the uart errors in _stop_dma, errors are cleared in uart irq

Signed-off-by: Jukka Laitinen <[email protected]>
Check the return values from DMA operations and add a performance counter
to detect if there are any DMA related errors.

Signed-off-by: Jukka Laitinen <[email protected]>
- Ensure that all interrupts are masked when configuring the block
- Ensure that the RX serial shift register is empty after clearing FIFO as
  well as in buffer overflow situations
There is no rule to make this target (again) if it is deleted and then
the sources are modified.
- The rule was for the folder boot/ while it should have been for the file
  boot/init
- The rule for bin/ ROMFS depends on boot/init as well, since nsh is moved
  from the bin/ folder and generating the bin/ ROMFS cannot be done prior
  to this step
Do not copy the input directory again, if the target directory already
exists. This confuses Ninja as it tries to remove the boot/ directory, but
it contains sub-directories the build system does not know about (it should
use "rm -rf" but it doesn't know it should)
Starting a new task does not require that the scheduler is locked, this is
done in nsh only because nsh uses waitpid() to wait for the task to exit
and record its exit status.

The exit status does not interest us whatsoever -> remove the locking.

Also, we don't need to explicitly change a tasks priority when it is
created by px4_task_spawn_cmd, as task_create() already sets the priority
via nxthread_setup_scheduler().
@pussuw pussuw requested a review from jlaitine November 14, 2024 11:39
@jlaitine
Copy link

This would fit upstream as well, could you try to send it there?

@pussuw
Copy link
Author

pussuw commented Nov 14, 2024

This would fit upstream as well, could you try to send it there?

Yes, sure. Hopefully the cdcacm module doesn't give a conflict though.

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.