diff options
author | Vishwanathapura, Niranjana <niranjana.vishwanathapura@intel.com> | 2017-06-14 12:34:42 -0700 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-06-29 12:43:52 -0400 |
commit | a379d69f00f28063a7a1c3de235e2996c2c5a6f5 (patch) | |
tree | a76985165abc913ff6e377c2445a3f853a697c90 /drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c | |
parent | 0568c4640e2b12df063d1761fd4d53af24dc4018 (diff) | |
download | linux-a379d69f00f28063a7a1c3de235e2996c2c5a6f5.tar.bz2 |
IB/opa_vnic: Use spinlock instead of mutex for stats_lock
Stats can be read from atomic context, hence make stats_lock as
a spinlock.
Fix the following trace with debug kernel.
BUG: sleeping function called from invalid context at
kernel/locking/mutex.c:238
in_atomic(): 1, irqs_disabled(): 0, pid: 6487, name: sadc
Call Trace:
dump_stack+0x63/0x90
___might_sleep+0xda/0x130
__might_sleep+0x4a/0x90
mutex_lock+0x20/0x50
opa_vnic_get_stats64+0x56/0x140 [opa_vnic]
dev_get_stats+0x74/0x130
dev_seq_printf_stats+0x37/0x120
dev_seq_show+0x14/0x30
seq_read+0x26d/0x3d0
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c')
-rw-r--r-- | drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c b/drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c index a51bf977f4d6..c2733964379c 100644 --- a/drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c +++ b/drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c @@ -89,9 +89,9 @@ void opa_vnic_get_summary_counters(struct opa_vnic_adapter *adapter, u64 *src; memset(&vstats, 0, sizeof(vstats)); - mutex_lock(&adapter->stats_lock); + spin_lock(&adapter->stats_lock); adapter->rn_ops->ndo_get_stats64(adapter->netdev, &vstats.netstats); - mutex_unlock(&adapter->stats_lock); + spin_unlock(&adapter->stats_lock); cntrs->vp_instance = cpu_to_be16(adapter->vport_num); cntrs->vesw_id = cpu_to_be16(adapter->info.vesw.vesw_id); @@ -128,9 +128,9 @@ void opa_vnic_get_error_counters(struct opa_vnic_adapter *adapter, struct opa_vnic_stats vstats; memset(&vstats, 0, sizeof(vstats)); - mutex_lock(&adapter->stats_lock); + spin_lock(&adapter->stats_lock); adapter->rn_ops->ndo_get_stats64(adapter->netdev, &vstats.netstats); - mutex_unlock(&adapter->stats_lock); + spin_unlock(&adapter->stats_lock); cntrs->vp_instance = cpu_to_be16(adapter->vport_num); cntrs->vesw_id = cpu_to_be16(adapter->info.vesw.vesw_id); |