diff options
| author | Yu Wang <yyuwang@codeaurora.org> | 2017-06-08 12:15:42 +0800 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-07-03 14:13:00 -0700 |
| commit | b48648d6b0ac8f410d233eda7bf1ebc28d7eb89e (patch) | |
| tree | 41bf83f5dc38178a3fdd1258540f4df6dc25e112 | |
| parent | aa5c0b2b5fe1972d70c6ca118fe7b264ae571660 (diff) | |
qcacld-3.0: fix a potential spinlock lockup issue
When time stamping RX packets, spinlock
host_target_sync_lock will be hold if it's
now in TSF capturing state; if TSF-captured
IRQ happened at this moment, it will also
try to get host_target_sync_lock; if it's
handled on the same CPU, lockup will happen.
In the use-case, to update the current host
time, it's no need to get the spinlock in
this TSF-captured IRQ context, so move
host-time updating out of the lock.
Change-Id: I87205d5935bd2063c80ce7cf767cbc36dde55236
CRs-Fixed: 2057693
| -rw-r--r-- | core/hdd/src/wlan_hdd_tsf.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/hdd/src/wlan_hdd_tsf.c b/core/hdd/src/wlan_hdd_tsf.c index 6c3ff96a22e8..7b31dd55ed58 100644 --- a/core/hdd/src/wlan_hdd_tsf.c +++ b/core/hdd/src/wlan_hdd_tsf.c @@ -422,11 +422,21 @@ static void hdd_update_timestamp(hdd_adapter_t *adapter, if (!adapter) return; + /* host time is updated in IRQ context, it's always before target time, + * and so no need to try update last_host_time at present; + * since the interval of capturing TSF + * (WLAN_HDD_CAPTURE_TSF_INTERVAL_SEC) is long enough, host and target + * time are updated in pairs, and one by one, we can return here to + * avoid requiring spin lock, and to speed up the IRQ processing. + */ + if (host_time > 0) { + adapter->cur_host_time = host_time; + return; + } + qdf_spin_lock_bh(&adapter->host_target_sync_lock); if (target_time > 0) adapter->cur_target_time = target_time; - if (host_time > 0) - adapter->cur_host_time = host_time; sync_status = hdd_check_timestamp_status(adapter->last_target_time, adapter->last_host_time, |
