Home
last modified time | relevance | path

Searched refs:thread (Results 1 – 25 of 500) sorted by relevance

12345678910>>...20

/Zephyr-Core-2.7.6/kernel/
Dsched.c52 static void end_thread(struct k_thread *thread);
54 static inline int is_preempt(struct k_thread *thread) in is_preempt() argument
57 return thread->base.preempt <= _PREEMPT_THRESHOLD; in is_preempt()
60 static inline int is_metairq(struct k_thread *thread) in is_metairq() argument
63 return (thread->base.prio - K_HIGHEST_THREAD_PRIO) in is_metairq()
71 static inline bool is_thread_dummy(struct k_thread *thread) in is_thread_dummy() argument
73 return (thread->base.thread_state & _THREAD_DUMMY) != 0U; in is_thread_dummy()
119 static ALWAYS_INLINE bool should_preempt(struct k_thread *thread, in should_preempt() argument
142 && z_is_thread_timeout_active(thread)) { in should_preempt()
149 if (is_preempt(_current) || is_metairq(thread)) { in should_preempt()
[all …]
Dthread.c52 struct k_thread *thread; in k_thread_foreach() local
67 for (thread = _kernel.threads; thread; thread = thread->next_thread) { in k_thread_foreach()
68 user_cb(thread, user_data); in k_thread_foreach()
80 struct k_thread *thread; in k_thread_foreach_unlocked() local
89 for (thread = _kernel.threads; thread; thread = thread->next_thread) { in k_thread_foreach_unlocked()
91 user_cb(thread, user_data); in k_thread_foreach_unlocked()
168 void z_thread_monitor_exit(struct k_thread *thread) in z_thread_monitor_exit() argument
172 if (thread == _kernel.threads) { in z_thread_monitor_exit()
179 (thread != prev_thread->next_thread)) { in z_thread_monitor_exit()
183 prev_thread->next_thread = thread->next_thread; in z_thread_monitor_exit()
[all …]
Dmem_domain.c213 k_tid_t thread) in add_thread_locked() argument
216 __ASSERT_NO_MSG(thread != NULL); in add_thread_locked()
218 LOG_DBG("add thread %p to domain %p\n", thread, domain); in add_thread_locked()
220 &thread->mem_domain_info.mem_domain_q_node); in add_thread_locked()
221 thread->mem_domain_info.mem_domain = domain; in add_thread_locked()
224 arch_mem_domain_thread_add(thread); in add_thread_locked()
228 static void remove_thread_locked(struct k_thread *thread) in remove_thread_locked() argument
230 __ASSERT_NO_MSG(thread != NULL); in remove_thread_locked()
232 thread, thread->mem_domain_info.mem_domain); in remove_thread_locked()
233 sys_dlist_remove(&thread->mem_domain_info.mem_domain_q_node); in remove_thread_locked()
[all …]
/Zephyr-Core-2.7.6/arch/arc/core/
Dthread.c42 static bool is_user(struct k_thread *thread) in is_user() argument
44 return (thread->base.user_options & K_USER) != 0; in is_user()
49 static void setup_stack_vars(struct k_thread *thread) in setup_stack_vars() argument
52 if (is_user(thread)) { in setup_stack_vars()
54 thread->arch.priv_stack_start = in setup_stack_vars()
55 (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_stack_vars()
57 thread->arch.priv_stack_start = (uint32_t)(thread->stack_obj); in setup_stack_vars()
59 thread->arch.priv_stack_start += Z_ARC_STACK_GUARD_SIZE; in setup_stack_vars()
61 thread->arch.priv_stack_start = 0; in setup_stack_vars()
67 if (is_user(thread)) { in setup_stack_vars()
[all …]
/Zephyr-Core-2.7.6/kernel/include/
Dksched.h40 void z_move_thread_to_end_of_prio_q(struct k_thread *thread);
41 int z_is_thread_time_slicing(struct k_thread *thread);
42 void z_unpend_thread_no_timeout(struct k_thread *thread);
47 void z_pend_thread(struct k_thread *thread, _wait_q_t *wait_q,
52 void z_unpend_thread(struct k_thread *thread);
54 void z_thread_priority_set(struct k_thread *thread, int prio);
55 bool z_set_prio(struct k_thread *thread, int prio);
60 void z_sched_abort(struct k_thread *thread);
62 void z_sched_start(struct k_thread *thread);
63 void z_ready_thread(struct k_thread *thread);
[all …]
/Zephyr-Core-2.7.6/subsys/tracing/ctf/
Dctf_top.c13 static void _get_thread_name(struct k_thread *thread, in _get_thread_name() argument
16 const char *tname = k_thread_name_get(thread); in _get_thread_name()
28 struct k_thread *thread; in sys_trace_k_thread_switched_out() local
30 thread = k_current_get(); in sys_trace_k_thread_switched_out()
31 _get_thread_name(thread, &name); in sys_trace_k_thread_switched_out()
33 ctf_top_thread_switched_out((uint32_t)(uintptr_t)thread, name); in sys_trace_k_thread_switched_out()
38 struct k_thread *thread; in sys_trace_k_thread_switched_in() local
41 thread = k_current_get(); in sys_trace_k_thread_switched_in()
42 _get_thread_name(thread, &name); in sys_trace_k_thread_switched_in()
44 ctf_top_thread_switched_in((uint32_t)(uintptr_t)thread, name); in sys_trace_k_thread_switched_in()
[all …]
Dtracing_ctf.h30 #define sys_port_trace_k_thread_heap_assign(thread, heap) argument
31 #define sys_port_trace_k_thread_join_enter(thread, timeout) argument
32 #define sys_port_trace_k_thread_join_blocking(thread, timeout) argument
33 #define sys_port_trace_k_thread_join_exit(thread, timeout, ret) argument
43 #define sys_port_trace_k_thread_wakeup(thread) sys_trace_k_thread_wakeup(thread) argument
44 #define sys_port_trace_k_thread_start(thread) sys_trace_k_thread_start(thread) argument
45 #define sys_port_trace_k_thread_abort(thread) sys_trace_k_thread_abort(thread) argument
46 #define sys_port_trace_k_thread_suspend_enter(thread) \ argument
47 sys_trace_k_thread_suspend(thread)
48 #define sys_port_trace_k_thread_suspend_exit(thread) argument
[all …]
/Zephyr-Core-2.7.6/subsys/tracing/test/
Dtracing_string_format_test.c13 struct k_thread *thread; in sys_trace_k_thread_switched_out() local
15 thread = k_current_get(); in sys_trace_k_thread_switched_out()
16 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_switched_out()
21 struct k_thread *thread; in sys_trace_k_thread_switched_in() local
23 thread = k_current_get(); in sys_trace_k_thread_switched_in()
24 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_switched_in()
27 void sys_trace_k_thread_priority_set(struct k_thread *thread) in sys_trace_k_thread_priority_set() argument
29 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_priority_set()
32 void sys_trace_k_thread_create(struct k_thread *thread, size_t stack_size, in sys_trace_k_thread_create() argument
35 TRACING_STRING("%s: %p\n", __func__, thread); in sys_trace_k_thread_create()
[all …]
/Zephyr-Core-2.7.6/arch/arm/core/aarch32/
Dthread.c56 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
68 thread->stack_info.start += MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
69 thread->stack_info.size -= MPU_GUARD_ALIGN_AND_SIZE; in arch_new_thread()
73 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread()
79 thread->stack_info.start += FP_GUARD_EXTRA_SIZE; in arch_new_thread()
80 thread->stack_info.size -= FP_GUARD_EXTRA_SIZE; in arch_new_thread()
87 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread()
115 thread->callee_saved.psp = (uint32_t)iframe; in arch_new_thread()
116 thread->arch.basepri = 0; in arch_new_thread()
119 thread->arch.mode = 0; in arch_new_thread()
[all …]
/Zephyr-Core-2.7.6/subsys/tracing/sysview/
Dsysview_config.c20 static void set_thread_name(char *name, struct k_thread *thread) in set_thread_name() argument
22 const char *tname = k_thread_name_get(thread); in set_thread_name()
29 thread, &thread->entry); in set_thread_name()
33 void sys_trace_thread_info(struct k_thread *thread) in sys_trace_thread_info() argument
37 set_thread_name(name, thread); in sys_trace_thread_info()
41 Info.TaskID = (uint32_t)(uintptr_t)thread; in sys_trace_thread_info()
43 Info.Prio = thread->base.prio; in sys_trace_thread_info()
44 Info.StackBase = thread->stack_info.size; in sys_trace_thread_info()
45 Info.StackSize = thread->stack_info.start; in sys_trace_thread_info()
60 struct k_thread *thread; in send_task_list_cb() local
[all …]
/Zephyr-Core-2.7.6/arch/x86/core/intel64/
Dthread.c28 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
39 switch_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread()
40 thread->arch.cs = X86_KERNEL_CS; in arch_new_thread()
41 thread->arch.ss = X86_KERNEL_DS; in arch_new_thread()
47 thread->callee_saved.rsp = (long) iframe; in arch_new_thread()
48 thread->callee_saved.rip = (long) switch_entry; in arch_new_thread()
49 thread->callee_saved.rflags = EFLAGS_INITIAL; in arch_new_thread()
54 thread->arch.rdi = (long) entry; in arch_new_thread()
55 thread->arch.rsi = (long) p1; in arch_new_thread()
56 thread->arch.rdx = (long) p2; in arch_new_thread()
[all …]
/Zephyr-Core-2.7.6/arch/x86/core/ia32/
Dfloat.c146 static void FpCtxSave(struct k_thread *thread) in FpCtxSave() argument
149 if ((thread->base.user_options & K_SSE_REGS) != 0) { in FpCtxSave()
150 z_do_fp_and_sse_regs_save(&thread->arch.preempFloatReg); in FpCtxSave()
154 z_do_fp_regs_save(&thread->arch.preempFloatReg); in FpCtxSave()
163 static inline void FpCtxInit(struct k_thread *thread) in FpCtxInit() argument
167 if ((thread->base.user_options & K_SSE_REGS) != 0) { in FpCtxInit()
182 void z_float_enable(struct k_thread *thread, unsigned int options) in z_float_enable() argument
193 thread->base.user_options |= (uint8_t)options; in z_float_enable()
218 FpCtxInit(thread); in z_float_enable()
222 if (thread == _current) { in z_float_enable()
[all …]
Dthread.c52 extern int z_float_disable(struct k_thread *thread);
54 int arch_float_disable(struct k_thread *thread) in arch_float_disable() argument
57 return z_float_disable(thread); in arch_float_disable()
63 extern int z_float_enable(struct k_thread *thread, unsigned int options);
65 int arch_float_enable(struct k_thread *thread, unsigned int options) in arch_float_enable() argument
68 return z_float_enable(thread, options); in arch_float_enable()
75 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
87 swap_entry = z_x86_userspace_prepare_thread(thread); in arch_new_thread()
112 thread->callee_saved.esp = (unsigned long)initial_frame; in arch_new_thread()
114 thread->arch.excNestCount = 0; in arch_new_thread()
[all …]
/Zephyr-Core-2.7.6/lib/posix/
Dpthread.c139 struct posix_thread *thread; in pthread_create() local
154 thread = &posix_thread_pool[pthread_num]; in pthread_create()
155 if (thread->state == PTHREAD_EXITED || thread->state == PTHREAD_TERMINATED) { in pthread_create()
156 thread->state = PTHREAD_JOINABLE; in pthread_create()
168 thread = &posix_thread_pool[pthread_num]; in pthread_create()
173 (void)pthread_mutex_init(&thread->state_lock, NULL); in pthread_create()
174 (void)pthread_mutex_init(&thread->cancel_lock, NULL); in pthread_create()
176 pthread_mutex_lock(&thread->cancel_lock); in pthread_create()
177 thread->cancel_state = (1 << _PTHREAD_CANCEL_POS) & attr->flags; in pthread_create()
178 thread->cancel_pending = 0; in pthread_create()
[all …]
/Zephyr-Core-2.7.6/arch/riscv/core/pmp/
Dcore_pmp.c228 void z_riscv_init_user_accesses(struct k_thread *thread) in z_riscv_init_user_accesses() argument
239 uchar_pmpcfg = (unsigned char *) thread->arch.u_pmpcfg; in z_riscv_init_user_accesses()
246 thread->arch.u_pmpaddr[index] = TO_PMP_ADDR((ulong_t) &is_user_mode); in z_riscv_init_user_accesses()
250 thread->arch.u_pmpaddr[index] = TO_PMP_NAPOT(rom_start, rom_size); in z_riscv_init_user_accesses()
254 thread->arch.u_pmpaddr[index] = TO_PMP_NAPOT(thread->stack_info.start, in z_riscv_init_user_accesses()
255 thread->stack_info.size); in z_riscv_init_user_accesses()
260 thread->arch.u_pmpaddr[index] = TO_PMP_ADDR(rom_start); in z_riscv_init_user_accesses()
262 thread->arch.u_pmpaddr[index] = TO_PMP_ADDR(rom_end); in z_riscv_init_user_accesses()
266 thread->arch.u_pmpaddr[index] = TO_PMP_ADDR(thread->stack_info.start); in z_riscv_init_user_accesses()
268 thread->arch.u_pmpaddr[index] = TO_PMP_ADDR(thread->stack_info.start + in z_riscv_init_user_accesses()
[all …]
/Zephyr-Core-2.7.6/arch/sparc/core/
Dthread.c10 void z_thread_entry_wrapper(k_thread_entry_t thread,
36 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
51 thread->callee_saved.i6 = 0; /* frame pointer */ in arch_new_thread()
52 thread->callee_saved.o6 = (uint32_t) iframe; /* stack pointer */ in arch_new_thread()
53 thread->callee_saved.o7 = (uint32_t) z_thread_entry_wrapper - 8; in arch_new_thread()
54 thread->callee_saved.psr = PSR_S | PSR_PS | PSR_ET; in arch_new_thread()
58 if (thread->base.user_options & USER_FP_MASK) { in arch_new_thread()
59 thread->callee_saved.psr |= PSR_EF; in arch_new_thread()
63 thread->callee_saved.psr |= PSR_EF; in arch_new_thread()
66 thread->switch_handle = thread; in arch_new_thread()
[all …]
/Zephyr-Core-2.7.6/doc/reference/kernel/threads/
Dsystem_threads.rst10 A :dfn:`system thread` is a thread that the kernel spawns automatically
15 **Main thread**
16 This thread performs kernel initialization, then calls the application's
19 By default, the main thread uses the highest configured preemptible thread
21 threads, the main thread uses the lowest configured cooperative thread
24 The main thread is an essential thread while it is performing kernel
26 this means a fatal system error is raised if the thread aborts. If
28 return, the main thread terminates normally and no error is raised.
30 **Idle thread**
31 This thread executes when there is no other work for the system to do.
[all …]
Dindex.rst16 A :dfn:`thread` is a kernel object that is used for application processing
20 available RAM). Each thread is referenced by a :dfn:`thread id` that is assigned
21 when the thread is spawned.
23 A thread has the following key properties:
25 * A **stack area**, which is a region of memory used for the thread's stack.
27 of the thread's processing. Special macros exist to create and work with
30 * A **thread control block** for private kernel bookkeeping of the thread's
33 * An **entry point function**, which is invoked when the thread is started.
37 allocate CPU time to the thread. (See :ref:`scheduling_v2`.)
39 * A set of **thread options**, which allow the thread to receive special
[all …]
/Zephyr-Core-2.7.6/tests/kernel/context/
DREADME.txt12 - start a helper thread to help with k_yield() tests
13 - start a thread to test thread related functionality
16 - Called by a higher priority thread when there is another thread
17 - Called by an equal priority thread when there is another thread
18 - Called by a lower priority thread when there is another thread
22 - Called from an ISR (interrupted a thread)
24 - Called from a thread
28 - Called from an ISR that interrupted a thread
30 - Called from a thread
81 tc_start() - Test kernel CPU and thread routines
[all …]
/Zephyr-Core-2.7.6/tests/subsys/tracing/tracing_api/src/
Dmain.c116 struct k_thread thread; in test_tracing_sys_api() local
126 sys_trace_k_thread_priority_set(&thread); in test_tracing_sys_api()
127 sys_trace_k_thread_sched_set_priority(&thread, prio); in test_tracing_sys_api()
128 sys_trace_k_thread_create(&thread, stack, prio); in test_tracing_sys_api()
129 sys_trace_k_thread_start(&thread); in test_tracing_sys_api()
130 sys_trace_k_thread_abort(&thread); in test_tracing_sys_api()
131 sys_trace_k_thread_suspend(&thread); in test_tracing_sys_api()
132 sys_trace_k_thread_resume(&thread); in test_tracing_sys_api()
133 sys_trace_k_thread_ready(&thread); in test_tracing_sys_api()
134 sys_trace_k_thread_sched_ready(&thread); in test_tracing_sys_api()
[all …]
/Zephyr-Core-2.7.6/samples/userspace/syscall_perf/
DREADME.rst7 user thread has to go through a system call compared to a supervisor thread that
14 This application creates a supervisor and a user thread.
16 current thread. The user thread has to go through a system call.
27 User thread: 18012 cycles 748 instructions
28 Supervisor thread: 7 cycles 4 instructions
29 User thread: 20136 cycles 748 instructions
30 Supervisor thread: 7 cycles 4 instructions
31 User thread: 18014 cycles 748 instructions
32 Supervisor thread: 7 cycles 4 instructions
/Zephyr-Core-2.7.6/arch/riscv/core/
Dthread.c24 void z_thread_entry_wrapper(k_thread_entry_t thread,
29 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
51 stack_init->tp = (ulong_t)thread->tls; in arch_new_thread()
80 z_riscv_pmp_init_thread(thread); in arch_new_thread()
84 if ((thread->base.user_options & K_USER) == 0) { in arch_new_thread()
92 if ((thread->base.user_options & K_FP_REGS) != 0) { in arch_new_thread()
104 thread->arch.priv_stack_start = 0; in arch_new_thread()
105 thread->arch.user_sp = 0; in arch_new_thread()
106 if ((thread->base.user_options & K_USER) != 0) { in arch_new_thread()
111 z_riscv_init_stack_guard(thread); in arch_new_thread()
[all …]
/Zephyr-Core-2.7.6/doc/reference/kernel/scheduling/
Dindex.rst12 The scheduler determines which thread is allowed to execute
13 at any point in time; this thread is known as the **current thread**.
16 opportunity to change the identity of the current thread. These points
19 - transition of a thread from running state to a suspended or waiting
21 - transition of a thread to the :ref:`ready state <thread_states>`, for
23 - return to thread context after processing an interrupt
24 - when a running thread invokes :c:func:`k_yield`
26 A thread **sleeps** when it voluntarily initiates an operation that
29 Whenever the scheduler changes the identity of the current thread,
30 or when execution of the current thread is replaced by an ISR,
[all …]
/Zephyr-Core-2.7.6/tests/benchmarks/sched/
DREADME.rst7 abstractions. It works very simply: a main thread creates a "partner"
8 thread at a higher priority, the partner then sleeps using
11 1. The main thread calls _unpend_first_thread()
12 2. The main thread calls _ready_thread()
13 3. The main thread calls k_yield()
14 (the kernel switches to the partner thread)
15 4. The partner thread then runs and calls _pend_curr_irqlock() again
16 (the kernel switches to the main thread)
17 5. The main thread returns from k_yield()
/Zephyr-Core-2.7.6/arch/arm/core/aarch32/mpu/
Darm_core_mpu.c55 uint32_t z_arm_mpu_stack_guard_and_fpu_adjust(struct k_thread *thread);
174 void z_arm_configure_dynamic_mpu_regions(struct k_thread *thread) in z_arm_configure_dynamic_mpu_regions() argument
203 LOG_DBG("configure thread %p's domain", thread); in z_arm_configure_dynamic_mpu_regions()
204 struct k_mem_domain *mem_domain = thread->mem_domain_info.mem_domain; in z_arm_configure_dynamic_mpu_regions()
239 LOG_DBG("configure user thread %p's context", thread); in z_arm_configure_dynamic_mpu_regions()
240 if (thread->arch.priv_stack_start) { in z_arm_configure_dynamic_mpu_regions()
242 uintptr_t base = (uintptr_t)thread->stack_obj; in z_arm_configure_dynamic_mpu_regions()
243 size_t size = thread->stack_info.size + in z_arm_configure_dynamic_mpu_regions()
244 (thread->stack_info.start - base); in z_arm_configure_dynamic_mpu_regions()
268 guard_size = z_arm_mpu_stack_guard_and_fpu_adjust(thread); in z_arm_configure_dynamic_mpu_regions()
[all …]

12345678910>>...20