Commit Graph

19 Commits

Author SHA1 Message Date
rmind 77f33c2aef pcu: replace xcall(9) used for messaging with ipi(9). This provides
a better performance of the PCU (e.g. FPU) state synchronisation.
2014-05-25 14:53:55 +00:00
rmind d67ab12c1d pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
  This experimental feature was tried on ARM did not meet the expectations.
  It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
  optimise a race condition: if LWP is discarding its state on a remote CPU,
  but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
  PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.
2014-05-16 00:48:41 +00:00
skrll c92b6b82d2 Pass PCU_LOADED to pcu_state_load in the "this CPU already has our PCU
state loaded" of pcu_load.

ok, gimpy@ and rmind@
2014-01-23 17:32:03 +00:00
rmind 2312c4ca30 Switch XC_HIGHPRI to run at IPL_SOFTSERIAL i.e. the highest software level.
Adjust pcu(9) to this xcall(9) change.  This may fix the problems after
x86 FPU was converted to use PCU, since it avoids heavy contention at the
lower levels (particularly, IPL_SOFTNET).  This is a good illustration why
software interrupts should generally avoid any blocking on locks.
2013-11-26 20:29:40 +00:00
drochner 69aeb16c07 -extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
 "LWP has used the coprocessor" flag should be set or reset. The flag
 is reported by pcu_used_p(). If set, future accesses should use the
 state stored in the PCB. If reset, it should be reset to default.
 The former case is useful for setmcontext().
 With that, it should not be necessary anymore to manage the "FPU used"
 state by an additional MD variable.

approved by matt
2013-08-22 19:50:54 +00:00
matt 92d08eb574 Remove a debugging printf 2012-12-31 01:20:05 +00:00
matt 09ae87cfb2 Add support for kernel-based code to use a PCU. (for memory to memory
copies or in_cksum or ...)
2012-12-26 18:30:22 +00:00
matt a91e719fd0 KASSERT -> KASSERTMSG 2012-08-30 02:24:48 +00:00
yamt 673662ef94 comment 2012-04-18 13:42:11 +00:00
jym 325494fe33 Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
2011-09-27 01:02:33 +00:00
matt 5ca5a72bf6 Deal with PCU state when performing coredumps. As the kernel moves each LWP
into LSSUSPENDED state, have that LWP save its PCU state for the coredump and
release its PCU status since its probably going to be exiting very soon.
Make pcu_save_all tolerate for being called for non-curlwp if that lwp belongs
to the same process, has a state of LSSUSPENDED, and no PCUs are in use.

Make the MD coredump code use pcu_save_all(l) since it'll need to save all
the PCU state anyways and can take advantage of the above tests.
2011-06-13 21:32:42 +00:00
matt a1b165afd2 Make pcu_save_all and pcu_discard_all KASSERTs accept LW_SYSTEM threads
since kthread_create will call lwp_create with lwp0 which may not be curlwp.
2011-06-07 17:51:58 +00:00
matt f3c47d398e Add some more MI hook points for PCU. Discard the PCU state at lwp_exit and
at exec time.  Before forking, save the PCU state so that cpu_lwp_fork
doesn't have.  Remove MD code which did that before.
2011-06-06 22:04:34 +00:00
matt b2a5597aea Don't call pcu_do_op in pcu_load to save current context, use pcu_cpu_op
instead (since it will deal with ci->ci_pcu_curlwp[id] being NULL).
2011-05-02 06:33:16 +00:00
matt ccb56f14ea A little more constification 2011-05-02 01:43:37 +00:00
rmind 38d699a20d Extend PCU:
- Add pcu_ops_t::pcu_state_release() operation for PCU_RELEASE case.
- Add pcu_switchpoint() to perform release operation on context switch.
- Sprinkle const, misc.  Also, sync MIPS with changes.

Per discussions with matt@.
2011-05-02 00:29:53 +00:00
matt 7cefbb6066 Default PCU_UNIT_COUNT to 0. If 0, don't compile the contents of subr_pcu.c
and don't include the pcu related members into struct lwp.
2011-02-19 20:19:54 +00:00
matt 69e6dfca57 Add a bool to pcu_state_save which indicates whether the PCU is going to be
released after the save is done.
2011-02-17 18:44:54 +00:00
rmind bc16d8a440 Add PCU (Per-CPU Unit) - an interface to manage synchronization of any
per CPU context tied with an LWP.  Main use - lazy FPU handling on SMP.

Requested by matt@, will be used on mips64.  Note: implementation will
be improved to use IPIs before adopting on x86.  OK ad@.
2011-02-17 18:32:29 +00:00