]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/commit
MFC: r227537
authormarius <marius@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 19 Nov 2011 12:55:34 +0000 (12:55 +0000)
committermarius <marius@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 19 Nov 2011 12:55:34 +0000 (12:55 +0000)
commit9787b8afc5f471e5bc889a0624cd18c397ae5611
tree2b51fe5cf46c965e5b163f4b49c262c8bc90de50
parent666edc60b81fe60fa0a0262148dee78aabae6552
MFC: r227537

As it turns out, r186347 actually is insufficient to avoid the use of the
curthread-accessing part of mtx_{,un}lock(9) when using a r210623-style
curthread implementation on sparc64, crashing the kernel in its early
cycles as PCPU isn't set up, yet (and can't be set up as OFW is one of the
things we need for that, which leads to a chicken-and-egg problem). What
happens is that due to the fact that the idea of r210623 actually is to
allow the compiler to cache invocations of curthread, it factors out
obtaining curthread needed for both mtx_lock(9) and mtx_unlock(9) to
before the branch based on kobj_mutex_inited when compiling the kernel
without the debugging options. So change kobj_class_compile_static(9)
to just never acquire kobj_mtx, effectively restricting it to its
documented use, and add a kobj_init_static(9) for initializing objects
using a class compiled with the former and that also avoids using mutex(9)
(and malloc(9)). Also assert in both of these functions that they are
used in their intended way only.
While at it, inline kobj_register_method() and kobj_unregister_method()
as there wasn't much point for factoring them out in the first place
and so that a reader of the code has to figure out the locking for
fewer functions missing a KOBJ_ASSERT.
Tested on powerpc{,64} by andreast.

Reviewed by: nwhitehorn (earlier version), jhb
Approved by: re (kib)

git-svn-id: svn://svn.freebsd.org/base/releng/9.0@227712 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
share/man/man9/Makefile
share/man/man9/kobj.9
sys/dev/ofw/openfirm.c
sys/kern/subr_kobj.c
sys/powerpc/powerpc/platform.c
sys/powerpc/powerpc/pmap_dispatch.c
sys/sys/kobj.h