Lines Matching defs:pcu
33 * Per CPU Unit (PCU) - is an interface to manage synchronization of any
38 * PCU state may be loaded only by the current LWP, that is, curlwp.
42 * for a PCU release can be from a) the owner LWP (regardless whether
43 * the PCU state is on the current CPU or remote CPU) b) any other LWP
47 * In any case, the PCU state can *only* be changed from the current
48 * CPU. If said PCU state is on the remote CPU, a cross-call will be
51 * only be cleared by the CPU which has the PCU state loaded.
60 #include <sys/pcu.h>
69 * Internal PCU commands for the pcu_do_op() function.
71 #define PCU_CMD_SAVE 0x01 /* save PCU state to the LWP */
72 #define PCU_CMD_RELEASE 0x02 /* release PCU state on the CPU */
78 const pcu_ops_t *pcu;
84 * PCU IPIs run at IPL_HIGH (aka IPL_PCU in this code).
89 * pcu_available_p: true if lwp is allowed to use PCU state.
100 * pcu_switchpoint: release PCU state if the LWP is being run on another CPU.
125 const pcu_ops_t * const pcu = pcu_ops_md_defs[id];
126 pcu->pcu_state_release(l);
132 * pcu_discard_all: discard PCU state of the given LWP.
159 const pcu_ops_t * const pcu = pcu_ops_md_defs[id];
160 pcu_lwp_op(pcu, l, PCU_CMD_RELEASE);
166 * pcu_save_all: save PCU state of the given LWP so that eg. coredump can
200 const pcu_ops_t * const pcu = pcu_ops_md_defs[id];
201 pcu_lwp_op(pcu, l, flags);
206 * pcu_do_op: save/release PCU state on the current CPU.
211 pcu_do_op(const pcu_ops_t *pcu, lwp_t * const l, const int flags)
214 const u_int id = pcu->pcu_id;
219 pcu->pcu_state_save(l);
222 pcu->pcu_state_release(l);
235 const pcu_ops_t *pcu = pcu_msg->pcu;
236 const u_int id = pcu->pcu_id;
249 pcu_do_op(pcu, l, pcu_msg->flags);
253 * pcu_lwp_op: perform PCU state save, release or both operations on LWP.
256 pcu_lwp_op(const pcu_ops_t *pcu, lwp_t *l, const int flags)
258 const u_int id = pcu->pcu_id;
276 pcu_do_op(pcu, l, flags);
289 pcu_ipi_msg_t pcu_msg = { .pcu = pcu, .owner = l, .flags = flags };
301 * pcu_load: load/initialize the PCU state of current LWP on current CPU.
304 pcu_load(const pcu_ops_t *pcu)
307 const u_int id = pcu->pcu_id;
318 /* Does this CPU already have our PCU state loaded? */
321 * Fault reoccurred while the PCU state is loaded and
322 * therefore PCU should be reāenabled. This happens
331 KASSERT(pcu_valid_p(pcu, l));
332 pcu->pcu_state_load(l, PCU_VALID | PCU_REENABLE);
337 /* If PCU state of this LWP is on the remote CPU - save it there. */
339 pcu_ipi_msg_t pcu_msg = { .pcu = pcu, .owner = l,
355 /* Save the PCU state on the current CPU, if there is any. */
357 pcu_do_op(pcu, oncpu_lwp, PCU_CMD_SAVE | PCU_CMD_RELEASE);
363 * the load function whether PCU state was valid before this call.
366 pcu->pcu_state_load(l, valid ? PCU_VALID : 0);
374 * pcu_discard: discard the PCU state of the given LWP. If "valid"
375 * parameter is true, then keep considering the PCU state as valid.
378 pcu_discard(const pcu_ops_t *pcu, lwp_t *l, bool valid)
380 const u_int id = pcu->pcu_id;
393 pcu_lwp_op(pcu, l, PCU_CMD_RELEASE);
397 * pcu_save_lwp: save PCU state to the given LWP.
400 pcu_save(const pcu_ops_t *pcu, lwp_t *l)
402 const u_int id = pcu->pcu_id;
410 pcu_lwp_op(pcu, l, PCU_CMD_SAVE | PCU_CMD_RELEASE);
414 * pcu_save_all_on_cpu: save all PCU states on the current CPU.
423 const pcu_ops_t * const pcu = pcu_ops_md_defs[id];
427 pcu_do_op(pcu, l, PCU_CMD_SAVE | PCU_CMD_RELEASE);
434 * pcu_valid_p: return true if PCU state is considered valid. Generally,
438 pcu_valid_p(const pcu_ops_t *pcu, const lwp_t *l)
440 const u_int id = pcu->pcu_id;