qcacmn: featurize LOCK_STATS functionality

LOCK_STATS does profiling and catching of instances where
locks are held too long.  Separate out these two concerns
with separate macro flags.

Change-Id: Idb530baa23c5fcde84689bf910988da22e36123d
CRs-Fixed: 1100505
This commit is contained in:
Houston Hoffman
2016-12-15 17:59:21 -08:00
committed by Gerrit - the friendly Code Review server
parent b6cbf5e312
commit 1ced412f80

View File

@@ -39,6 +39,8 @@
#include <i_qdf_trace.h> #include <i_qdf_trace.h>
#define QDF_LOCK_STATS 0 #define QDF_LOCK_STATS 0
#define QDF_LOCK_STATS_DESTROY_PRINT 0
#define QDF_LOCK_STATS_BUG_ON 0
#define QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_IRQ 1000 #define QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_IRQ 1000
#define QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_BH 5000 #define QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_BH 5000
@@ -111,7 +113,7 @@ do {\
\ \
if (held_time > LARGE_CONTENTION) \ if (held_time > LARGE_CONTENTION) \
lock->stats.num_large_holds++; \ lock->stats.num_large_holds++; \
if (max_hold_time && \ if (QDF_LOCK_STATS_BUG_ON && max_hold_time && \
held_time > qdf_usecs_to_log_timestamp(max_hold_time)) { \ held_time > qdf_usecs_to_log_timestamp(max_hold_time)) { \
qdf_print("BEFORE_UNLOCK: lock held too long (%lluus)\n", \ qdf_print("BEFORE_UNLOCK: lock held too long (%lluus)\n", \
qdf_log_timestamp_to_usecs(held_time)); \ qdf_log_timestamp_to_usecs(held_time)); \
@@ -123,22 +125,20 @@ do {\
static inline void qdf_lock_stats_destroy(struct lock_stats *stats) static inline void qdf_lock_stats_destroy(struct lock_stats *stats)
{ {
qdf_print("%s: lock: %s %d \t" if (QDF_LOCK_STATS_DESTROY_PRINT) {
"acquired:\t%d\tcontended:\t%d\t" qdf_print("%s: lock: %s %d \t"
"contention_time\t%llu\tmax_contention_wait:\t%llu\t" "acquired:\t%d\tcontended:\t%d\t"
"non_contention_time\t%llu\t" "contention_time\t%llu\tmax_contention_wait:\t%llu\t"
"held_time\t%llu\tmax_held:\t%llu\t\n" "non_contention_time\t%llu\t"
, __func__, "held_time\t%llu\tmax_held:\t%llu\t\n"
stats->initialization_fn, , __func__, stats->initialization_fn, stats->line,
stats->line, stats->acquired, stats->contended,
stats->acquired, qdf_log_timestamp_to_usecs(stats->contention_time),
stats->contended, qdf_log_timestamp_to_usecs(stats->max_contention_wait),
qdf_log_timestamp_to_usecs(stats->contention_time), qdf_log_timestamp_to_usecs(stats->non_contention_time),
qdf_log_timestamp_to_usecs(stats->max_contention_wait), qdf_log_timestamp_to_usecs(stats->held_time),
qdf_log_timestamp_to_usecs(stats->non_contention_time), qdf_log_timestamp_to_usecs(stats->max_held_time));
qdf_log_timestamp_to_usecs(stats->held_time), }
qdf_log_timestamp_to_usecs(stats->max_held_time)
);
} }
static inline void qdf_lock_stats_create(struct lock_stats *stats, static inline void qdf_lock_stats_create(struct lock_stats *stats,