]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dtrace lockstat provider probes
authorAlan Maguire <alan.maguire@oracle.com>
Wed, 4 Oct 2017 21:18:40 +0000 (23:18 +0200)
committerAlan Maguire <alan.maguire@oracle.com>
Fri, 6 Oct 2017 17:32:49 +0000 (19:32 +0200)
commitb2fa5f7c5991f941454aa9d56d7b9a2970f62cc6
tree573cf2eb796b6d3df628d440a7c4d8ffbe2f302d
parent708e107cd0c17d070fba4ee4e9d813523e7ee928
dtrace lockstat provider probes

This patch adds DTrace probes for locking events covering mutexes,
read-write locks and spinlocks and is similar to the lockstat provider
for Solaris.  However it differs from the Solaris lockstat provider
in one way - on Linux, rwlocks are implemented via spinlocks so there
is no "rw-block" probe; rather a "rw-spin" probe.  Additionally,
rwlocks cannot be upgraded or downgraded, so the "rw-upgrade" and
"rw-downgrade" probes are not present.

Probes:

lockstat:::adaptive-acquire
lockstat:::adaptive-acquire-error
lockstat:::adaptive-block
lockstat:::adaptive-spin
lockstat:::adaptive-release

lockstat:::rw-acquire
lockstat:::rw-release
lockstat:::rw-spin

lockstat:::spin-acquire
lockstat:::spin-release
lockstat:::spin-spin

The "-acquire" probes fire when the lock is acquired.
The "-spin" probes fire on contention events when then lock needed
to spin.  The probe fires just prior to acquisition of locks where
contention occurred and arg1 contains the total time spent spinning.
The "adaptive-block" probe fires on contention events where the thread
blocked waiting on lock acquisition.  The probe fires just prior to
lock acquisition and arg1 contains the total sleep time incurred.
The "-error" probe fires when an error occurs when trying to
acquire an adpative lock.
The "-release" probes fire when the lock is released.

Arguments:

arg0: the lock itself (a struct mutex *, spinlock_t *, or rwlock_t *)

arg1:

for rw-acquire/rw-release probes only, arg1 is RW_READER for
acquire/release as reader, RW_WRITER for acquire/release as a writer.

for *-spin or *-block probes, arg1 is the total time in nanoseconds
spent spinning or blocking.

arg2:

for rw-spin only, arg2 is RW_READER when spinning on a rwlock as a reader,
RW_WRITER when spinning on a rwlock as a writer.

Orabug: 26149674
Orabug: 26149956

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
arch/x86/include/asm/spinlock.h
dtrace/sdt_mod.c
include/linux/dtrace_os.h
include/linux/rwlock_api_smp.h
include/linux/sdt.h
include/linux/sdt_internal.h
include/linux/spinlock_api_smp.h
kernel/dtrace/dtrace_os.c
kernel/locking/mutex.c
kernel/locking/qrwlock.c