* [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly
@ 2023-09-18 15:36 Zhu Yanjun
2023-09-18 16:12 ` Jinpu Wang
2023-09-19 7:09 ` Leon Romanovsky
0 siblings, 2 replies; 4+ messages in thread
From: Zhu Yanjun @ 2023-09-18 15:36 UTC (permalink / raw)
To: haris.iqbal, jinpu.wang, jgg, leon, linux-rdma; +Cc: Zhu Yanjun
From: Zhu Yanjun <yanjun.zhu@linux.dev>
No functional change. The function get_next_path_rr needs to hold
rcu_read_lock. As such, if no rcu read lock, warnings will pop out.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index b6ee801fd0ff..bc4b70318bf4 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -775,7 +775,7 @@ rtrs_clt_get_next_path_or_null(struct list_head *head, struct rtrs_clt_path *clt
* Related to @MP_POLICY_RR
*
* Locks:
- * rcu_read_lock() must be hold.
+ * rcu_read_lock() must be held.
*/
static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
{
@@ -783,6 +783,11 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
struct rtrs_clt_path *path;
struct rtrs_clt_sess *clt;
+ /*
+ * Assert that rcu lock must be held
+ */
+ WARN_ON_ONCE(!rcu_read_lock_held());
+
clt = it->clt;
/*
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly
2023-09-18 15:36 [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly Zhu Yanjun
@ 2023-09-18 16:12 ` Jinpu Wang
2023-09-19 7:09 ` Leon Romanovsky
1 sibling, 0 replies; 4+ messages in thread
From: Jinpu Wang @ 2023-09-18 16:12 UTC (permalink / raw)
To: Zhu Yanjun; +Cc: haris.iqbal, jgg, leon, linux-rdma, Zhu Yanjun
On Mon, Sep 18, 2023 at 5:37 PM Zhu Yanjun <yanjun.zhu@intel.com> wrote:
>
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> No functional change. The function get_next_path_rr needs to hold
> rcu_read_lock. As such, if no rcu read lock, warnings will pop out.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thx!
> ---
> drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index b6ee801fd0ff..bc4b70318bf4 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -775,7 +775,7 @@ rtrs_clt_get_next_path_or_null(struct list_head *head, struct rtrs_clt_path *clt
> * Related to @MP_POLICY_RR
> *
> * Locks:
> - * rcu_read_lock() must be hold.
> + * rcu_read_lock() must be held.
> */
> static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
> {
> @@ -783,6 +783,11 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
> struct rtrs_clt_path *path;
> struct rtrs_clt_sess *clt;
>
> + /*
> + * Assert that rcu lock must be held
> + */
> + WARN_ON_ONCE(!rcu_read_lock_held());
> +
> clt = it->clt;
>
> /*
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly
2023-09-18 15:36 [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly Zhu Yanjun
2023-09-18 16:12 ` Jinpu Wang
@ 2023-09-19 7:09 ` Leon Romanovsky
2023-09-19 7:21 ` Zhu Yanjun
1 sibling, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2023-09-19 7:09 UTC (permalink / raw)
To: Zhu Yanjun; +Cc: haris.iqbal, jinpu.wang, jgg, linux-rdma, Zhu Yanjun
On Mon, Sep 18, 2023 at 11:36:46PM +0800, Zhu Yanjun wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> No functional change. The function get_next_path_rr needs to hold
> rcu_read_lock. As such, if no rcu read lock, warnings will pop out.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index b6ee801fd0ff..bc4b70318bf4 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -775,7 +775,7 @@ rtrs_clt_get_next_path_or_null(struct list_head *head, struct rtrs_clt_path *clt
> * Related to @MP_POLICY_RR
> *
> * Locks:
> - * rcu_read_lock() must be hold.
> + * rcu_read_lock() must be held.
> */
> static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
> {
> @@ -783,6 +783,11 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
> struct rtrs_clt_path *path;
> struct rtrs_clt_sess *clt;
>
> + /*
> + * Assert that rcu lock must be held
> + */
> + WARN_ON_ONCE(!rcu_read_lock_held());
Let's use RCU_LOCKDEP_WARN(..) macro.
Thanks
> +
> clt = it->clt;
>
> /*
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly
2023-09-19 7:09 ` Leon Romanovsky
@ 2023-09-19 7:21 ` Zhu Yanjun
0 siblings, 0 replies; 4+ messages in thread
From: Zhu Yanjun @ 2023-09-19 7:21 UTC (permalink / raw)
To: Leon Romanovsky, Zhu Yanjun; +Cc: haris.iqbal, jinpu.wang, jgg, linux-rdma
在 2023/9/19 15:09, Leon Romanovsky 写道:
> On Mon, Sep 18, 2023 at 11:36:46PM +0800, Zhu Yanjun wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> No functional change. The function get_next_path_rr needs to hold
>> rcu_read_lock. As such, if no rcu read lock, warnings will pop out.
>>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>> drivers/infiniband/ulp/rtrs/rtrs-clt.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
>> index b6ee801fd0ff..bc4b70318bf4 100644
>> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
>> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
>> @@ -775,7 +775,7 @@ rtrs_clt_get_next_path_or_null(struct list_head *head, struct rtrs_clt_path *clt
>> * Related to @MP_POLICY_RR
>> *
>> * Locks:
>> - * rcu_read_lock() must be hold.
>> + * rcu_read_lock() must be held.
>> */
>> static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
>> {
>> @@ -783,6 +783,11 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it)
>> struct rtrs_clt_path *path;
>> struct rtrs_clt_sess *clt;
>>
>> + /*
>> + * Assert that rcu lock must be held
>> + */
>> + WARN_ON_ONCE(!rcu_read_lock_held());
> Let's use RCU_LOCKDEP_WARN(..) macro.
Got it. Will send v2 very soon.
Zhu Yanjun
>
> Thanks
>
>> +
>> clt = it->clt;
>>
>> /*
>> --
>> 2.40.1
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-19 7:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-18 15:36 [PATCH 1/1] RDMA/rtrs: Require holding rcu_read_lock explicitly Zhu Yanjun
2023-09-18 16:12 ` Jinpu Wang
2023-09-19 7:09 ` Leon Romanovsky
2023-09-19 7:21 ` Zhu Yanjun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox