zfs/include/sys
Brian Behlendorf 4d54fdee1d Reimplement mutexs for Linux lock profiling/analysis
For a generic explanation of why mutexs needed to be reimplemented
to work with the kernel lock profiling see commits:
  e811949a57 and
  d28db80fd0

The specific changes made to the mutex implemetation are as follows.
The Linux mutex structure is now directly embedded in the kmutex_t.
This allows a kmutex_t to be directly case to a mutex struct and
passed directly to the Linux primative.

Just like with the rwlocks it is critical that these functions be
implemented as '#defines to ensure the location information is
preserved.  The preprocessor can then do a direct replacement of
the Solaris primative with the linux primative.

Just as with the rwlocks we need to track the lock owner.  Here
things get a little more interesting because depending on your
kernel version, and how you've built your kernel Linux may already
do this for you.  If your running a 2.6.29 or newer kernel on a
SMP system the lock owner will be tracked.  This was added to Linux
to support adaptive mutexs, more on that shortly.  Alternately, your
kernel might track the lock owner if you've set CONFIG_DEBUG_MUTEXES
in the kernel build.  If neither of the above things is true for
your kernel the kmutex_t type will include and track the lock owner
to ensure correct behavior.  This is all handled by a new autoconf
check called SPL_AC_MUTEX_OWNER.

Concerning adaptive mutexs these are a very recent development and
they did not make it in to either the latest FC11 of SLES11 kernels.
Ideally, I'd love to see this kernel change appear in one of these
distros because it does help performance.  From Linux kernel commit:
  0d66bf6d3514b35eb6897629059443132992dbd7
  "Testing with Ingo's test-mutex application...
  gave a 345% boost for VFS scalability on my testbox"
However, if you don't want to backport this change yourself you
can still simply export the task_curr() symbol.  The kmutex_t
implementation will use this symbol when it's available to
provide it's own adaptive mutexs.

Finally, DEBUG_MUTEX support was removed including the proc handlers.
This was done because now that we are cleanly integrated with the
kernel profiling all this information and much much more is available
in debug kernel builds.  This code was now redundant.

Update mutexs validated on:
    - SLES10   (ppc64)
    - SLES11   (x86_64)
    - CHAOS4.2 (x86_64)
    - RHEL5.3  (x86_64)
    - RHEL6    (x86_64)
    - FC11     (x86_64)
2009-09-25 14:47:01 -07:00
..
fm Build system and packaging (RPM support) 2009-03-09 15:56:55 -07:00
fs Build system and packaging (RPM support) 2009-03-09 15:56:55 -07:00
sysevent Build system and packaging (RPM support) 2009-03-09 15:56:55 -07:00
Makefile.in Build system and packaging (RPM support) 2009-03-09 15:56:55 -07:00
acl.h Define ACE_ALL_PERMS for use by ACLs 2009-07-09 15:00:25 -07:00
acl_impl.h Remove minor lingering CDDL tait of copied headers. Required 2008-03-27 23:40:09 +00:00
atomic.h Pull in initial 32-bit support patches. 2008-08-11 22:42:04 +00:00
attr.h Just filling in more of the env. 2008-03-08 00:58:32 +00:00
bitmap.h Add a few more missing header which the upstream stock kernel context expects 2008-12-23 13:03:09 -08:00
bootconf.h Add two new stub headers 2009-01-09 14:04:13 -08:00
buf.h SPL additions to increase support for updated ZFS build 2008-05-15 23:39:19 +00:00
byteorder.h - Add some more missing headers 2008-03-12 23:48:28 +00:00
callb.h - Properly fix the debug support for all the ASSERT's, VERIFIES, etc can be 2008-05-19 02:49:12 +00:00
cmn_err.h Add some typedefs to make it clearer when we passing a function, 2008-03-10 19:25:20 +00:00
compress.h Add include/sys/compress.h header 2009-01-06 09:47:00 -08:00
condvar.h Reimplement mutexs for Linux lock profiling/analysis 2009-09-25 14:47:01 -07:00
conf.h Add a few more missing header which the upstream stock kernel context expects 2008-12-23 13:03:09 -08:00
cpuvar.h Add a few more missing header which the upstream stock kernel context expects 2008-12-23 13:03:09 -08:00
crc32.h Add missing stub headers 2009-01-09 16:04:44 -08:00
cred.h Add basic credential support and splat tests. 2009-07-27 17:18:59 -07:00
ctype.h Checkpoint for the night, 2008-03-05 00:58:54 +00:00
ddi.h Drop unicode support, provided in ZFS tree libport 2008-03-13 19:49:09 +00:00
debug.h Disable stack overflow checking by default. 2009-07-30 13:52:11 -07:00
dirent.h Add a few more missing header which the upstream stock kernel context expects 2008-12-23 13:03:09 -08:00
disp.h Add a few more missing header which the upstream stock kernel context expects 2008-12-23 13:03:09 -08:00
dkio.h Remove minor lingering CDDL tait of copied headers. Required 2008-03-27 23:40:09 +00:00
dklabel.h Remove minor lingering CDDL tait of copied headers. Required 2008-03-27 23:40:09 +00:00
dnlc.h Linux VM integration / device special files 2009-02-04 15:15:41 -08:00
dumphdr.h SPL additions to increase support for updated ZFS build 2008-05-15 23:39:19 +00:00
efi_partition.h Add missing stub headers 2009-01-09 16:04:44 -08:00
errno.h Stub out some missing headers which are expected. I'll fill 2008-03-01 18:30:12 +00:00
file.h Define FKIOCTL which is used on Solaris to mark an in-kernel ioctl. 2009-07-09 14:59:41 -07:00
int_limits.h Stub out some missing headers which are expected. I'll fill 2008-03-01 18:30:12 +00:00
int_types.h Checkpoint for the night, 2008-03-05 00:58:54 +00:00
inttypes.h Remove spl.h, just include the headers you need. 2008-03-04 20:06:29 +00:00
isa_defs.h Add a little paranoia here to ensure endianess is set correctly. 2009-07-14 14:28:04 -07:00
kidmap.h Apply fix from bug239 for rwlock deadlock. 2008-03-11 20:54:40 +00:00
kmem.h Linux VM Integration Cleanup 2009-03-04 10:04:15 -08:00
kobj.h Go through and add a header with the proper UCRL number. 2008-05-26 04:38:26 +00:00
kstat.h Go through and add a header with the proper UCRL number. 2008-05-26 04:38:26 +00:00
list.h Add list_move_tail() function. 2009-03-19 21:40:07 -07:00
mkdev.h Add missing headers 2008-03-14 00:04:01 +00:00
mntent.h Add missing headers 2008-03-14 00:04:01 +00:00
modctl.h Add stubs for three more includes 2009-01-09 09:47:27 -08:00
mode.h Add missing headers 2008-03-14 00:04:01 +00:00
mount.h Missing headers, more minor fixes 2008-03-15 00:05:38 +00:00
mutex.h Reimplement mutexs for Linux lock profiling/analysis 2009-09-25 14:47:01 -07:00
note.h Add a few more missing header which the upstream stock kernel context expects 2008-12-23 13:03:09 -08:00
open.h Add stubs for three more includes 2009-01-09 09:47:27 -08:00
param.h Changed ptob()/btop() mult/div into bit shifts. 2009-02-25 15:50:58 -08:00
pathname.h Add missing headers 2008-03-14 00:04:01 +00:00
policy.h Add missing policy includes, add missing sun ddi bits 2009-01-09 10:49:47 -08:00
proc.h Add zone_get_hostid() function 2009-02-19 11:26:17 -08:00
random.h Coverity 9652, 9653: No Effect 2009-02-17 16:30:58 -08:00
refstr.h Add two new stub headers 2009-01-09 14:04:13 -08:00
resource.h Add two more missing headers 2008-03-13 20:41:29 +00:00
rwlock.h Update rwlocks to track owner to ensure correct semantics 2009-09-25 14:14:35 -07:00
sdt.h Missing headers, more minor fixes 2008-03-15 00:05:38 +00:00
sid.h Add basic ksid_lookupdomain and ksiddomain_rele support, just allocations 2009-01-09 15:30:53 -08:00
signal.h Go through and add a header with the proper UCRL number. 2008-05-26 04:38:26 +00:00
stat.h Add two more missing headers 2008-03-13 20:41:29 +00:00
stropts.h Stub out some missing headers which are expected. I'll fill 2008-03-01 18:30:12 +00:00
sunddi.h Add ddi_copyin/ddi_copyout support for fake kernel originated ioctls. 2009-07-10 10:56:32 -07:00
sunldi.h Pull the blkdev header in to the sunldi for some useful structure definitions and helper functions 2009-01-26 16:47:49 -08:00
sysevent.h - Add some more missing headers 2008-03-12 23:48:28 +00:00
sysmacros.h Powerpc Fixes (part 1): 2009-05-20 12:23:24 -07:00
systeminfo.h Add zone_get_hostid() function 2009-02-19 11:26:17 -08:00
systm.h Move sunddi include 2008-12-23 13:32:07 -08:00
t_lock.h Pull in lock types 2008-12-23 13:18:39 -08:00
taskq.h Add basic support for TASKQ_THREADS_CPU_PCT taskq flag which is 2009-07-09 10:07:52 -07:00
thread.h Go through and add a header with the proper UCRL number. 2008-05-26 04:38:26 +00:00
time.h Add timer.h header 2008-12-23 15:40:20 -08:00
timer.h Go through and add a header with the proper UCRL number. 2008-05-26 04:38:26 +00:00
types.h SLES10 Fixes (part 3): 2009-05-20 11:00:39 -07:00
types32.h Remove minor lingering CDDL tait of copied headers. Required 2008-03-27 23:40:09 +00:00
u8_textprep.h Stub u8_textprep.h for inclusion purposes 2009-01-05 15:37:07 -08:00
uio.h Move sunddi include 2008-12-23 13:32:07 -08:00
unistd.h Add missing headers 2008-03-14 00:04:01 +00:00
utsname.h Update utsname to use proper compatible interface to avoid API issues. 2008-06-03 21:20:18 +00:00
va_list.h Stub out some missing headers which are expected. I'll fill 2008-03-01 18:30:12 +00:00
varargs.h Add somre debugging support 2008-03-08 00:18:21 +00:00
vfs.h Add missing callback_context_t and fid_t types 2009-01-09 10:03:37 -08:00
vfs_opreg.h Add missing headers 2008-03-14 00:04:01 +00:00
vmsystm.h Update global_page_state() support for 2.6.29 kernels. 2009-07-28 15:06:42 -07:00
vnode.h Add VOP_SEEK 2009-01-09 13:59:39 -08:00
zmod.h Changed z_compress_level() and z_uncompress() prototypes to match the ones in Solaris. 2009-02-23 11:45:59 -08:00
zone.h - Add some more missing headers 2008-03-12 23:48:28 +00:00