diff options
author | Jianxin Xiong <jianxin.xiong@intel.com> | 2016-07-25 13:39:14 -0700 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-08-02 16:00:58 -0400 |
commit | 8adf71fa145e5e309a07c1cca843da8cd83c1d75 (patch) | |
tree | fb147126f9002bbc394adecc8d73a2edd5a5e360 /drivers/infiniband/hw/hfi1/hfi.h | |
parent | a6580f4310ded039fc9f682cbf027fbba217652b (diff) | |
download | talos-obmc-linux-8adf71fa145e5e309a07c1cca843da8cd83c1d75.tar.gz talos-obmc-linux-8adf71fa145e5e309a07c1cca843da8cd83c1d75.zip |
IB/hfi1: Fix "suspicious rcu_dereference_check() usage" warnings
This fixes the following warnings with PROVE_LOCKING and PROVE_RCU
enabled in the kernel:
case (1):
[ INFO: suspicious RCU usage. ]
drivers/infiniband/hw/hfi1/init.c:532
suspicious rcu_dereference_check() usage!
case (2):
[ INFO: suspicious RCU usage. ]
drivers/infiniband/hw/hfi1/hfi.h:1624
suspicious rcu_dereference_check() usage!
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/hfi.h')
-rw-r--r-- | drivers/infiniband/hw/hfi1/hfi.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index 7df4cb2ed7da..d22876d0fdd3 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h @@ -1616,8 +1616,7 @@ static inline u16 hfi1_get_pkey(struct hfi1_ibport *ibp, unsigned index) } /* - * Readers of cc_state must call get_cc_state() under rcu_read_lock(). - * Writers of cc_state must call get_cc_state() under cc_state_lock. + * Called by readers of cc_state only, must call under rcu_read_lock(). */ static inline struct cc_state *get_cc_state(struct hfi1_pportdata *ppd) { @@ -1625,6 +1624,16 @@ static inline struct cc_state *get_cc_state(struct hfi1_pportdata *ppd) } /* + * Called by writers of cc_state only, must call under cc_state_lock. + */ +static inline +struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd) +{ + return rcu_dereference_protected(ppd->cc_state, + lockdep_is_held(&ppd->cc_state_lock)); +} + +/* * values for dd->flags (_device_ related flags) */ #define HFI1_INITTED 0x1 /* chip and driver up and initted */ |