Commit Graph

71 Commits

Author SHA1 Message Date
chenzhijia 65fbf4cf64 nuttx/include:Modify the CPU_SET series macro definition in sched.h
Modify the CPU_SET series macro definition to avoid an error when shifting 31 bits to the left.

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-15 21:05:36 +08:00
chenzhijia aca7552d9c nuttx/include:add #define CPU_SETSIZE in sched.h
add #define CPU_SETSIZE in sched.h to pass tlpi example: https://man7.org/tlpi/code/online/dist/procpri/t_sched_getaffinity.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-15 21:05:36 +08:00
fangxinyong 76508d42a9 sched: export sched_getcpu API in AMP mode
Some app with same code runs on different cores in AMP mode,
need known physical core id on which the function is called.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-09 15:21:25 +08:00
Alin Jerpelea cd2fcf5252 include: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-04 08:18:42 +08:00
zhanghongyu d53d7d6c34 sched.h: add SCHED_BATCH and SCHED_IDLE definition
Resolve undefined compile-time issues encountered when porting
third-party libraries.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-07-14 13:20:53 -03:00
yanghuatao 87dfcd1020 include/sched.h: CPU_XXX macros can also be used without CONFIG_SMP
Allow CPU_XXX macros to be used without CONFIG_SMP=y

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
Co-authored-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-06-28 20:35:54 +08:00
ligd d45a45da94 sched.h: add empty realize when NO CONFIG_SMP
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-05 17:50:58 +08:00
ligd 27de65edc0 sched.h: fix CPU_EQUAL(s1, s2) write error
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-05 17:50:58 +08:00
cuiziwei 6289205104 sched: Define sched_getcpu return 0 when CONFIG_SMP equals n
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2023-08-06 11:28:49 +02:00
Bowen Wang c9e3a0669f sched_backtrace: define sched_dumpstack when not enable SCHED_BACKTRACE
Before directly use sched_backtrace() with SCHED_BACKTRACE disable will
lead compile error, this commit avoid this problem by define
sched_backtrace to 0 when CONFIG_SCHED_BACKTRACE not enable.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-07-31 05:46:37 -07:00
simbit18 b1404f486e include: Fix nxstyle errors
error: Long line found
2023-05-04 02:07:01 +08:00
Xiang Xiao 631a8da1e2 sched: Map SCHED_OTHER to SCHED_FIFO or SCHED_RR
this behaviour is explicitly specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_08.html
and map SCHED_NORMAL to SCHED_OTHER like Linux:
https://man7.org/linux/man-pages/man7/sched.7.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-30 03:01:03 +02:00
Xiang Xiao 64e7833cbc sched/spawn: Support task_spawnattr_[set|get]stackaddr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 12:46:58 +09:00
Xiang Xiao 40ef5bc6db libc: Move queue.h from include to include/nuttx
to avoid the conflict with libuv's queue.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
Xiang Xiao dd942f0b04 sched/backtrace: Dump the complete stack regardless the depth
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 12:09:54 +08:00
chao.an 1060953567 sched/backtrace: add sched_backtrace support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-08-19 01:30:50 -07:00
Xiang Xiao 001e7c3e76 sched: Don't include nuttx/sched.h inside sched.h
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:11:53 +09:00
ligd 3bc33572e3 mqueue: simplify the mqueue reailize
1. remove descript management in mqueue, save code size
2. use i_ops instead of i_mqueue to remove the dup logic

Change-Id: Ie88960e50ddcae9c87977c9ad65a45297c663291
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
Xiang Xiao 411f5d591a sched: Fix undefined reference to 'sched_cpu_count'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-21 07:37:04 -07:00
licheng 29030557ff sched: Fix nuttx typo 2020-09-20 02:32:25 -07:00
Gregory Nutt 82debdc213 Make task_init() and task_activate() internal OS functions.
-Move task_init() and task_activate() prototypes from include/sched.h to include/nuttx/sched.h.  These are internal OS functions and should not be exposed to the user.
-Remove references to task_init() and task_activate() from the User Manual.
-Rename task_init() to nxtask_init() since since it is an OS internal function
-Rename task_activate() to nxtask_activate since it is an OS internal function
2020-05-25 23:54:45 +01:00
Gregory Nutt 9ce03b1660 Move pthread-specific data into TLS
1. Move pthread-specific data files from sched/pthread/ to libs/libc/pthread.
2. Remove pthread-specific data functions from syscalls.
3. Implement tls_alloc() and tls_free() with system calls.
4. Reimplement pthread_key_create() and pthread_key_free() using tls_alloc() and tls_free().
5. Reimplement pthread_set_specific() and pthread_get_specicif() using tls_set_value() and tls_get_value()
2020-05-08 18:05:04 +01:00
Xiang Xiao a2d924eea4 syscall: Fix typo error in cvs and header file
and reoder the entry in cvs file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Gregory Nutt 934f468e4a Run all .c and .h files in PR235 through tools/nxstyle. 2020-02-09 07:34:24 -06:00
Xiang Xiao ac53600e44 sched: Rename sched_cpu_count to sched_cpucount 2020-02-09 07:33:59 -06:00
Gregory Nutt 2def8035db sched/sched/sched_getcpu.c: Implement non-standard interface.
If SMP is enabled this function will return the number of the CPU that the thread is running on.  This is non-standard but follows GLIBC if __GNU_SOURCE is enabled.  The returned CPU number is, however, worthless since it returns the CPU number of the CPU that was executing the task when the function was called.  The application can never know the true CPU number of the CPU tht it is running on since that value is volatile and change change at any time.
2020-01-31 20:25:15 +00:00
Gregory Nutt 093348030e sched/: Update signal default STOP action. If waitpid was called with the WUNTRACED then wake up waitpid. Also fix some compile problems.. How did this work before? 2018-09-02 13:51:52 -06:00
Gregory Nutt d648f9c8b4 Add task_testcancel() 2016-12-10 16:34:14 -06:00
Gregory Nutt f132960789 Add task_setcanceltype() 2016-12-10 16:06:14 -06:00
Gregory Nutt 5fb207eb36 Add task_setcancelstate() 2016-12-10 15:16:46 -06:00
Gregory Nutt e24f281401 This commit adds a new internal interfaces and fixes a problem with three APIs in the SMP configuration. The new internal interface is sched_cpu_pause(tcb). This function will pause a CPU if the task associated with 'tcb' is running on that CPU. This allows a different CPU to modify that OS data stuctures associated with the CPU. When the other CPU is resumed, those modifications can safely take place.
The three fixes are to handle cases in the SMP configuration where one CPU does need to make modifications to TCB and data structures on a task that could be running running on another CPU.  Those three cases are task_delete(), task_restart(), and execution of signal handles.  In all three cases the solutions is basically the same:  (1) Call sched_cpu_pause(tcb) to pause the CPU on which the task is running, (2) perform the necessary operations, then (3) call up_cpu_resume() to restart the paused CPU.
2016-11-20 07:57:18 -06:00
Gregory Nutt f40fbaa4b9 sched/task: task_restart() test not supported on SMP systems. This is not fully implemented. 2016-11-19 11:41:05 -06:00
Gregory Nutt f4c47636e7 SYSLOG: Debug output from the IDLE task should be forced like interrupt level output 2016-06-20 07:35:38 -06:00
Gregory Nutt e879d0f423 Move scheduler instrumentation hooks out of sched.h (where they seem like application interfaces) and into nuttx/sched.h where it is clare that these are OS internal interfaces. 2016-03-16 11:00:31 -06:00
Gregory Nutt 143d287f11 Fix some missing header file inclusions and a misplaced semi-colon from recent commits 2016-02-21 11:27:55 -06:00
Gregory Nutt f3356fee5b SMP: Add macros to CPU set manipulation to sched.h 2016-02-20 18:45:07 -06:00
Gregory Nutt 72d3920295 Rename cpuset_t to cpu_set_t which is the type used in some non-standard Linux/GNU interfaces. Move definitions of cpu_set_t to include/sys/types.h. Add prototypes for sched_setaffinity(), sched_getaffinity(), pthread_attr_setaffinity_np(), pthread_attr_getaffinity_np(), pthread_setaffinity_np(), and pthread_getaffinity_np(). No implementation is yet in place. 2016-02-19 15:57:07 -06:00
Gregory Nutt 384e51cb05 Add some additional schedule instrumentation 2016-02-16 15:21:45 -06:00
Gregory Nutt 9cbac41e78 Clean-up/standardize a few header files 2015-08-03 11:01:41 -06:00
Gregory Nutt 991adde6ae Add definition of SCHED_MAX_REPL 2015-08-03 10:46:36 -06:00
Gregory Nutt 9095e8eab4 include/, sched/, and libc/: Add support for sporadic scheduling parameters in struct sched_param, posix_spawnattr_t, and pthread_attr_t. Update all user interfaces to pass sporadic scheduling parameters. Feature is dependent on EXPERIMENTAL and no changes have yet been made to core scheduling logic. 2015-07-23 13:16:32 -06:00
Gregory Nutt 146bdc3c93 TCB: Increase the size of the scheduling policy field from 1 to 2 bits to allow additional, planned scheduling policies 2015-07-23 10:15:07 -06:00
Gregory Nutt 925fc9ad81 First round of changes to get the ELF configuration building again 2014-09-16 15:37:05 -06:00
Gregory Nutt e12213592b Don't build task_create() or task_spawn() interfaces if there is an addres environment 2014-09-14 08:22:21 -06:00
Gregory Nutt 23147c40a5 Remove final traces of the 8015 from the NuttX source tree 2014-09-01 13:21:15 -06:00
patacongo 5c093af766 Changed needed to fix issues with task_restart()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5615 42af7a65-404d-4744-a932-0658087f49c3
2013-02-06 15:43:28 +00:00
patacongo b48009644f Rename _TCB to struct tcb_s
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5610 42af7a65-404d-4744-a932-0658087f49c3
2013-02-04 18:46:28 +00:00
patacongo 329328e5df New interface task_spawn(); exec_builtin() now uses task_spawn(); All argv types should be char * const * not const char **
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5598 42af7a65-404d-4744-a932-0658087f49c3
2013-02-02 19:31:30 +00:00
patacongo 21817ecc38 lpc1788 update from Rommel Marcelo; Beginning of logic to retain child exit status
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5549 42af7a65-404d-4744-a932-0658087f49c3
2013-01-22 23:42:51 +00:00
patacongo 8e5733ae3f Header file clean-up
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4948 42af7a65-404d-4744-a932-0658087f49c3
2012-07-17 03:58:11 +00:00