Hello world :-)
Coming from a mailing thread [1] lets discuss about option to disable
POSIX Signals in order to trim down firmware size on ultra tiny MCUs
as presented by @wangchdo in PR#17352 [2].
Please take a look at the PR, help in review, report your remarks :-)
I looked in detail at [2] that is a working prototype of disabling
signals. I am okay with the change, that is not a breaking change,
does not break default POSIX compliance (only for the specific
firmware build where it applies), and gives option to trim down
firmware size by removing unused functionalities just like we can
disable other functionalities when necessary. Kconfig help is provided
with clear description.
It aligns well and is implemented exactly the same as disabling other
features. This one is using DISABLE_SIGNALS that is set default to "n"
so POSIX signals are enabled by default. And then in the code for
architectures implementation is ifndef / ifneq wrapped where needed.
@wangchdo provided testing logs and explanation of implications:
1. Disadvantages:
* When signals are disabled, the related POSIX APIs—including sleep,
usleep, kill, pkill, and pthread—will be disabled as well.
* ostest currently relies on signals and will not work correctly until
updated to work with signals disabled. @wangchdo assured he will make
necessary updates. <-- My question here to the community is do we want
to have ostest updated and tested before [2] is merged?
2. Advantages:
* Disabling the signal mechanism significantly reduces system
footprint and complexity.
* It can also improve real-time performance during thread creation and
context switching.
Here is the sched/Kconfig update:
config DISABLE_SIGNALS
bool "Disable signal support"
default n
---help---
Disabling the signal mechanism significantly reduces system
footprint and complexity.
It can also improve real-time performance during thread
creation and context switching.
However, it removes or degrades several major POSIX features,
including signal handling,
thread cancellation, timers, and process-related
notifications. This configuration
should be enabled only when such functionality is not required.
It aligns well with other features that can be disabled for instance:
config DISABLE_ENVIRON
bool "Disable environment variable support"
default DEFAULT_SMALL
Here is a code wrap example:
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS +=arm_schedulesigaction.c arm_sigdeliver.c
endif
#ifndef CONFIG_DISABLE_SIGNALS
if (tcb->sigdeliver)
{
/* Pendsv able to access running tcb with no critical section */
up_schedule_sigaction(tcb);
}
#endif
Thanks :-)
Tomek
[1] https://www.mail-archive.com/[email protected]/msg13936.html
[2] https://github.com/apache/nuttx/pull/17352
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info