Lines Matching +full:lock +full:- +full:step
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2023-2025 Ruslan Bukin <br@bsdpad.com>
67 p = td->td_proc; in hwt_switch_in()
75 if (ctx->state != CTX_STATE_RUNNING) { in hwt_switch_in()
87 thr->thread_id, td->td_tid, cpu_id); in hwt_switch_in()
89 hwt_backend_configure(ctx, cpu_id, thr->thread_id); in hwt_switch_in()
103 p = td->td_proc; in hwt_switch_out()
111 if (ctx->state != CTX_STATE_RUNNING) { in hwt_switch_out()
122 thr->thread_id, td->td_tid, cpu_id); in hwt_switch_out()
137 p = td->td_proc; in hwt_hook_thread_exit()
151 thr->state = HWT_THREAD_STATE_EXITED; in hwt_hook_thread_exit()
154 thr->thread_id, td->td_tid, cpu_id); in hwt_hook_thread_exit()
156 if (ctx->state == CTX_STATE_RUNNING) in hwt_hook_thread_exit()
170 p = td->td_proc; in hwt_hook_mmap()
178 pause = ctx->pause_on_mmap ? 1 : 0; in hwt_hook_mmap()
187 * msleep(9) atomically releases the mtx lock, so take refcount in hwt_hook_mmap()
192 refcount_acquire(&thr->refcnt); in hwt_hook_mmap()
197 msleep(thr, &thr->mtx, PCATCH, "hwt-mmap", 0); in hwt_hook_mmap()
201 if (refcount_release(&thr->refcnt)) in hwt_hook_mmap()
217 p = td->td_proc; in hwt_hook_thread_create()
219 /* Step 1. Get CTX and collect information needed. */ in hwt_hook_thread_create()
223 thread_id = atomic_fetchadd_int(&ctx->thread_counter, 1); in hwt_hook_thread_create()
224 bufsize = ctx->bufsize; in hwt_hook_thread_create()
225 kva_req = ctx->hwt_backend->kva_req; in hwt_hook_thread_create()
226 sprintf(path, "hwt_%d_%d", ctx->ident, thread_id); in hwt_hook_thread_create()
229 /* Step 2. Allocate some memory without holding ctx ref. */ in hwt_hook_thread_create()
238 entry->record_type = HWT_RECORD_THREAD_CREATE; in hwt_hook_thread_create()
239 entry->thread_id = thread_id; in hwt_hook_thread_create()
241 /* Step 3. Get CTX once again. */ in hwt_hook_thread_create()
246 /* ctx->thread_counter does not matter. */ in hwt_hook_thread_create()
249 /* Allocate backend-specific thread data. */ in hwt_hook_thread_create()
257 thr->vm->ctx = ctx; in hwt_hook_thread_create()
258 thr->ctx = ctx; in hwt_hook_thread_create()
259 thr->backend = ctx->hwt_backend; in hwt_hook_thread_create()
260 thr->thread_id = thread_id; in hwt_hook_thread_create()
261 thr->td = td; in hwt_hook_thread_create()
280 p = td->td_proc; in hwt_hook_handler()
281 if ((p->p_flag2 & P2_HWT) == 0) in hwt_hook_handler()