reason:
when CONFIG_CLOCK_TIMEKEEPING=y, compiler error may report
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:42,
from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/arch.h:89,
from boardctl.c:33:
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/irq.h:261:12: error: conflicting types for 'enter_critical_section'; have 'irqstate_t(void)' {aka 'long unsigned int(void)'}
261 | irqstate_t enter_critical_section(void) noinstrument_function;
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/wqueue.h:37,
from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/addrenv.h:39,
from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:40:
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/wdog.h:267:11: note: previous implicit declaration of 'enter_critical_section' with type 'int()'
267 | flags = enter_critical_section();
| ^~~~~~~~~~~~~~~~~~~~~~
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ make -j12
sched/sched_processtimer.c: In function 'nxsched_process_timer':
sched/sched_processtimer.c:178:3: error: implicit declaration of function 'clock_update_wall_time' [-Werror=implicit-function-declaration]
178 | clock_update_wall_time();
Signed-off-by: hujun5 <hujun5@xiaomi.com>
reason:
some arch do not support issuing interrupts to the local CPU.
This commit fixes the regression from https://github.com/apache/nuttx/pull/14663
Signed-off-by: hujun5 <hujun5@xiaomi.com>
reason:
The old implementation of the SMP call, even when using the "no wait" parameter,
could still result in waiting, if invoking it within a critical section
may lead to deadlocks. Therefore, in order to implement a truly asynchronous SMP
call strategy, we have added nxsched_smp_call_async.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Be consistent with the datatype used for the 'key'. As the API in
in the .h file uses int, I chose to replace uint32_t with int
everywhere.
This change ensures that work_notifier_setup() will not return a
negative value indicating error to the caller, when in fact the
notifier was correctly setup. This would happen when
work_notifier_setup() had been called 0x8000000 times, and that
many keys allocated.
reason:
In smp, It's possible that in a scenario where CONFIG_SMP_DEFAULT_CPUSET is set to 1,
when taskA is created with a relatively low priority,
it gets added to the g_readytorun queue with an affinity of 0x1.
Meanwhile, CPUs 1~n are in an idle state.
Subsequently, when we attempt to change the affinity property of taskA using nxsched_set_affinity,
the scheduling mechanism might not be triggered due to the lack of a proper condition check.
This can result in taskA remaining unscheduled and therefore unable to run.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
reason:
If we need to handle a tcb that is running on another CPU,
we need to process it through the smpcall method.
This commit fixes the regression from https://github.com/apache/nuttx/pull/13863
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Don't compile dump_task logic if CONFIG_DEBUG_ALERT=n.
With _alert() disabled this logic does nothing, but the compiler
is not smart enough to optimize this code.
on minimal stm32f3 configuration it saves 396B of flash.
reason:
We decouple semcount from business logic by using an independent counting variable,
which allows us to remove critical sections in many cases.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Move CONFIG_SEM_PREALLOCHOLDERS to include/semaphore.h to avoid undefined issues from occurring in other places as well.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Summary:
When the user sets an illegal signo, the error will only be known when timer_signotify is triggered during timeout.
By intercepting timer_create, we can directly locate the problem
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
1. CONFIG_ARCH_COVERAGE has been replaced by CONFIG_SCHED_GCOV
2. Delete the SIM-specific GCOV_ALL configuration and change it to a universal configuration for all architectures
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Add sem_wait fast operations, use atomic to ensure
atomicity of semcount operations, and do not depend
on critical section.
Test with robot:
before modify:
nxmutex_lock cost: 78 ns
nxmutex_unlock cost: 82 ns
after modify:
nxmutex_lock cost: 28 ns
nxmutex_unlock cost: 14 ns
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
The comment about the CPU index remaining stable is incorrect. There is no
guarantee the task does not yield during the exit process, meaning the CPU
can most definitely change. Also, there is no reason why it should not be
allowed to change.
This fixes a full system crash during process exit when the CPU changes
and we query the current task from the old CPU.
This commit simplified setitmer implementation by eliminating a redundant conditional branch.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
smaller than it should be.
0x21000000 0x210105e8 0x210105f8 0x21044000
|----------------|-------------|--------------|
If there is already a range of 0x210105e8 - 0x210105f8, adding another
range of 0x21000000 - 0x21044000 would result in an incorrect range of
0x210105e8 - 0x21044000.
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
since bootloader may call modlib functions directly
to load elf firmware without binfmt, dlfcn or module.
BTW, this patch also remove the duplicated selecttion
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
reason:
We can utilize percpu storage to hold information about the
current running task. If we intend to implement this feature, we would
need to define two macros that help us manage this percpu information
effectively.
up_this_task: This macro is designed to read the contents of the percpu
register to retrieve information about the current
running task.This allows us to quickly access
task-specific data without having to disable interrupts,
access global variables and obtain the current cpu index.
up_update_task: This macro is responsible for updating the contents of
the percpu register.It is typically called during
initialization or when a context switch occurs to ensure
that the percpu register reflects the information of the
newly running task.
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-net none -chardev stdio,id=con,mux=on -serial chardev:con \
-mon chardev=con,mode=readline -kernel ./nuttx
Signed-off-by: hujun5 <hujun5@xiaomi.com>