reason:
1 To improve efficiency, we mimic Linux's behavior where preemption disabling is only applicable to the current CPU and does not affect other CPUs.
2 In the future, we will implement "spinlock+sched_lock", and use it extensively. Under such circumstances, if preemption is still globally disabled, it will seriously impact the scheduling efficiency.
3 We have removed g_cpu_lockset and used irqcount in order to eliminate the dependency of schedlock on critical sections in the future, simplify the logic, and further enhance the performance of sched_lock.
4 We set lockcount to 1 in order to lock scheduling on all CPUs during startup, without the need to provide additional functions to disable scheduling on other CPUs.
5 Cpu1~n must wait for cpu0 to enter the idle state before enabling scheduling because it prevents CPUs1~n from competing with cpu0 for the memory manager mutex, which could cause the cpu0 idle task to enter a wait state and trigger an assert.
size nuttx
before:
text data bss dec hex filename
265396 51057 63646 380099 5ccc3 nuttx
after:
text data bss dec hex filename
265184 51057 63642 379883 5cbeb nuttx
size -216
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>
reason:
Currently, if we need to schedule a task to another CPU, we have to completely halt the other CPU,
manipulate the scheduling linked list, and then resume the operation of that CPU. This process is both time-consuming and unnecessary.
During this process, both the current CPU and the target CPU are inevitably subjected to busyloop.
The improved strategy is to simply send a cross-core interrupt to the target CPU.
The current CPU continues to run while the target CPU responds to the interrupt, eliminating the certainty of a busyloop occurring.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
The feature depends on ARCH_USE_SEPARATED_SECTION
the different memory area has different access speed and cache
capability, so the arch can custom allocate them based on
section names to achieve performance optimization
test:
sim:elf
sim:sotest
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
1.add pin type to cfg gpio as wake up source
2.add IOEXPANDER_OPTION_WAKEUPCFG for set wake up option
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
and move common math funtions to math32.h:
div_round_up
div_round_closest
is_power_of_2
roundup_pow_of_two
rounddown_pow_of_two
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
Summary:
1.Modified the i_crefs from int16_t to atomic_int
2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit added ifdef macro to sigwork_s. When CONFIG_SIG_EVTHREAD is
not defined, the struct sigwork_s will be empty struct, which is helpful
to reduce bss size.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
the detailed warning info are:
CC: syslog/vsyslog.c "pthread/pthread_create.c", line 443: warning #1931-D: operand of sizeof is
not a type, variable, or dereferenced pointer expression
ptcb->cmn.timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
CC: dirent/lib_closedir.c "sched/sched_profil.c", line 81: warning #1931-D: operand of sizeof is not a
type, variable, or dereferenced pointer expression
wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
^
"sched/sched_profil.c", line 142: warning #1931-D: operand of sizeof is not a
type, variable, or dereferenced pointer expression
wd_start(&prof->timer, PROFTICK, profil_timer_handler, (wdparm_t)prof);
^
CC: common/arm_modifyreg8.c "sched/sched_setscheduler.c", line 165: warning #1931-D: operand of sizeof is
not a type, variable, or dereferenced pointer expression
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
CC: misc/lib_utsname.c "sched/sched_unlock.c", line 275: warning #1931-D: operand of sizeof is not a
type, variable, or dereferenced pointer expression
rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
"sched/sched_roundrobin.c", line 119: warning #1931-D: operand of sizeof is
not a type, variable, or dereferenced pointer expression
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
CC: armv7-m/arm_fpuconfig.c cxarm: Error: No files. Try -help.
CC: misc/lib_crc8ccitt.c cxarm: Error: No files. Try -help.
cxarm: Error: No files. Try -help.
CC: getprime_main.c cxarm: Error: No files. Try -help.
cxarm: Error: No files. Try -help.
CC: misc/lib_log2ceil.c cxarm: Error: No files. Try -help.
CC: task/task_start.c "task/task_setup.c", line 423: warning #1931-D: operand of sizeof is not a
type, variable, or dereferenced pointer expression
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
Supports the flush operation of the sensor.
The application can initiate a flush action through ioctl SNIOC_FLUSH
to trigger flush, and the call will be returned immediately.
Using SNIOC_GET_EVENTS to clear flush event,
However, the flush implementation is asynchronous, when all the flush
data is push to upper circbuffer, the POLLPRI event(FLUSH_COMPLETED)
will be reported.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
When there is an actual physical sensor, the driver must implement the get info interface. The upper layer can obtain the actual physical sensor information through SNIOC_GET_INFO.
SNIOC_SET_INFO can only set the information of the local virtual sensor, which means it is bound to the local advertisement. Remote subscribers cannot set the information.
Usage:
struct sensor_device_info dev_info;
orb_ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)&dev_info);
or:
ret = orb_set_info(fd, &dev_info);
ret = orb_get_info(fd, &dev_info);
Signed-off-by: likun17 <likun17@xiaomi.com>
"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
^
"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
^
"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
^
"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
zero used for undefined preprocessing identifier
"CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
#if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
There will be a large performance loss after SCHED_CRITMONITOR is enabled.
By isolating thread running time-related functions, CPU load can be run with less overhead.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Compilation error:
Kasan/book. c: In the function '__hwasanloaded 16_noabort':
Kasan/book. c: 76:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, false, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
Kasan/book. c: In the function '__hwasan_store16_noabort':
Kasan/book. c: 80:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, true, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
CC: hello. min c hello. min c: In the function 'hello. min':
Hello. main. c: 39:3: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
printf("Hello, World: %p!!\n", return_address(0));
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
1. Use always_inline_function instead of inline, inline does not take effect
2. Activate Kasan acceleration by 1/7
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>