All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] misc changes for rtrs
@ 2022-09-02 10:19 Guoqing Jiang
  2022-09-02 10:19 ` [PATCH 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH Guoqing Jiang
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-02 10:19 UTC (permalink / raw)
  To: haris.iqbal, jinpu.wang, jgg, leon; +Cc: linux-rdma

Hi,

Pls review the three patches.

Thanks,
Guoqing

Guoqing Jiang (3):
  RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH
  RDMA/rtrs-clt: Break the loop once one path is connected
  RDMA/rtrs-clt: Kill xchg_paths

 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 18 +++++-------------
 drivers/infiniband/ulp/rtrs/rtrs-pri.h |  7 +++----
 2 files changed, 8 insertions(+), 17 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH
  2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
@ 2022-09-02 10:19 ` Guoqing Jiang
  2022-09-02 10:19 ` [PATCH 2/3] RDMA/rtrs-clt: Break the loop once one path is connected Guoqing Jiang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-02 10:19 UTC (permalink / raw)
  To: haris.iqbal, jinpu.wang, jgg, leon; +Cc: linux-rdma

The maximum queue_depth should be 65535 per check_module_params,
also update other relevant comments.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/infiniband/ulp/rtrs/rtrs-pri.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h
index ac0df734eba8..a2420eecaf5a 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h
+++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h
@@ -26,11 +26,10 @@
 /*
  * Max IB immediate data size is 2^28 (MAX_IMM_PAYL_BITS)
  * and the minimum chunk size is 4096 (2^12).
- * So the maximum sess_queue_depth is 65536 (2^16) in theory.
- * But mempool_create, create_qp and ib_post_send fail with
- * "cannot allocate memory" error if sess_queue_depth is too big.
+ * So the maximum sess_queue_depth is 65535 (2^16 - 1) in theory
+ * since queue_depth in rtrs_msg_conn_rsp is defined as le16.
  * Therefore the pratical max value of sess_queue_depth is
- * somewhere between 1 and 65534 and it depends on the system.
+ * somewhere between 1 and 65535 and it depends on the system.
  */
 #define MAX_SESS_QUEUE_DEPTH 65535
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] RDMA/rtrs-clt: Break the loop once one path is connected
  2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
  2022-09-02 10:19 ` [PATCH 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH Guoqing Jiang
@ 2022-09-02 10:19 ` Guoqing Jiang
  2022-09-02 10:19 ` [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths Guoqing Jiang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-02 10:19 UTC (permalink / raw)
  To: haris.iqbal, jinpu.wang, jgg, leon; +Cc: linux-rdma

No need to iterate all paths after find one connected path.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 5219bb10777a..c29eccdb4fd2 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -54,7 +54,10 @@ static inline bool rtrs_clt_is_connected(const struct rtrs_clt_sess *clt)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry)
-		connected |= READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED;
+		if (READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED) {
+			connected = true;
+			break;
+		}
 	rcu_read_unlock();
 
 	return connected;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths
  2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
  2022-09-02 10:19 ` [PATCH 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH Guoqing Jiang
  2022-09-02 10:19 ` [PATCH 2/3] RDMA/rtrs-clt: Break the loop once one path is connected Guoqing Jiang
@ 2022-09-02 10:19 ` Guoqing Jiang
  2022-09-02 19:15   ` kernel test robot
  2022-09-03  4:02 ` [Updated PATCH " Guoqing Jiang
  2022-09-05 12:28 ` [PATCH 0/3] misc changes for rtrs Leon Romanovsky
  4 siblings, 1 reply; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-02 10:19 UTC (permalink / raw)
  To: haris.iqbal, jinpu.wang, jgg, leon; +Cc: linux-rdma

Let's call try_cmpxchg directly for the same purpose.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index c29eccdb4fd2..0661a4e69fc9 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2220,17 +2220,6 @@ static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path)
 	}
 }
 
-static inline bool xchg_paths(struct rtrs_clt_path __rcu **rcu_ppcpu_path,
-			      struct rtrs_clt_path *clt_path,
-			      struct rtrs_clt_path *next)
-{
-	struct rtrs_clt_path **ppcpu_path;
-
-	/* Call cmpxchg() without sparse warnings */
-	ppcpu_path = (typeof(ppcpu_path))rcu_ppcpu_path;
-	return clt_path == cmpxchg(ppcpu_path, clt_path, next);
-}
-
 static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
 {
 	struct rtrs_clt_sess *clt = clt_path->clt;
@@ -2305,7 +2294,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
 		 * We race with IO code path, which also changes pointer,
 		 * thus we have to be careful not to overwrite it.
 		 */
-		if (xchg_paths(ppcpu_path, clt_path, next))
+		if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, clt_path, next))
 			/*
 			 * @ppcpu_path was successfully replaced with @next,
 			 * that means that someone could also pick up the
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths
  2022-09-02 10:19 ` [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths Guoqing Jiang
@ 2022-09-02 19:15   ` kernel test robot
  2022-09-03  3:54       ` Guoqing Jiang
  0 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2022-09-02 19:15 UTC (permalink / raw)
  To: Guoqing Jiang, haris.iqbal, jinpu.wang, jgg, leon; +Cc: kbuild-all, linux-rdma

Hi Guoqing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on linus/master v6.0-rc3 next-20220901]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Guoqing-Jiang/misc-changes-for-rtrs/20220902-182137
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: parisc64-allmodconfig (https://download.01.org/0day-ci/archive/20220903/202209030331.GmBYWKZb-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/1cb28fde63a272543476132ec83f6eb121111fae
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Guoqing-Jiang/misc-changes-for-rtrs/20220902-182137
        git checkout 1cb28fde63a272543476132ec83f6eb121111fae
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash drivers/infiniband/ulp/rtrs/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/atomic.h:80,
                    from arch/parisc/include/asm/bitops.h:13,
                    from include/linux/bitops.h:67,
                    from include/linux/log2.h:12,
                    from include/asm-generic/div64.h:55,
                    from ./arch/parisc/include/generated/asm/div64.h:1,
                    from include/linux/math.h:6,
                    from include/linux/math64.h:6,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/infiniband/ulp/rtrs/rtrs-clt.c:13:
   drivers/infiniband/ulp/rtrs/rtrs-clt.c: In function 'rtrs_clt_remove_path_from_arr':
>> include/linux/atomic/atomic-arch-fallback.h:90:34: error: initialization of 'struct rtrs_clt_path **' from incompatible pointer type 'struct rtrs_clt_path *' [-Werror=incompatible-pointer-types]
      90 |         typeof(*(_ptr)) *___op = (_oldp), ___o = *___op, ___r; \
         |                                  ^
   include/linux/atomic/atomic-instrumented.h:1978:9: note: in expansion of macro 'arch_try_cmpxchg'
    1978 |         arch_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
         |         ^~~~~~~~~~~~~~~~
   drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: note: in expansion of macro 'try_cmpxchg'
    2297 |                 if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, clt_path, next))
         |                     ^~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +90 include/linux/atomic/atomic-arch-fallback.h

29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  86  
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  87  #ifndef arch_try_cmpxchg
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  88  #define arch_try_cmpxchg(_ptr, _oldp, _new) \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  89  ({ \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29 @90  	typeof(*(_ptr)) *___op = (_oldp), ___o = *___op, ___r; \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  91  	___r = arch_cmpxchg((_ptr), ___o, (_new)); \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  92  	if (unlikely(___r != ___o)) \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  93  		*___op = ___r; \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  94  	likely(___r == ___o); \
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  95  })
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  96  #endif /* arch_try_cmpxchg */
29f006fdefe6f8 include/linux/atomic-arch-fallback.h Peter Zijlstra 2020-08-29  97  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths
  2022-09-02 19:15   ` kernel test robot
@ 2022-09-03  3:54       ` Guoqing Jiang
  0 siblings, 0 replies; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-03  3:54 UTC (permalink / raw)
  To: kernel test robot, haris.iqbal, jinpu.wang, jgg, leon
  Cc: kbuild-all, linux-rdma



On 9/3/22 3:15 AM, kernel test robot wrote:
> Hi Guoqing,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on rdma/for-next]
> [also build test ERROR on linus/master v6.0-rc3 next-20220901]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Guoqing-Jiang/misc-changes-for-rtrs/20220902-182137
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
> config: parisc64-allmodconfig (https://download.01.org/0day-ci/archive/20220903/202209030331.GmBYWKZb-lkp@intel.com/config)
> compiler: hppa-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/intel-lab-lkp/linux/commit/1cb28fde63a272543476132ec83f6eb121111fae
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Guoqing-Jiang/misc-changes-for-rtrs/20220902-182137
>          git checkout 1cb28fde63a272543476132ec83f6eb121111fae
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash drivers/infiniband/ulp/rtrs/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>     In file included from include/linux/atomic.h:80,
>                      from arch/parisc/include/asm/bitops.h:13,
>                      from include/linux/bitops.h:67,
>                      from include/linux/log2.h:12,
>                      from include/asm-generic/div64.h:55,
>                      from ./arch/parisc/include/generated/asm/div64.h:1,
>                      from include/linux/math.h:6,
>                      from include/linux/math64.h:6,
>                      from include/linux/time.h:6,
>                      from include/linux/stat.h:19,
>                      from include/linux/module.h:13,
>                      from drivers/infiniband/ulp/rtrs/rtrs-clt.c:13:
>     drivers/infiniband/ulp/rtrs/rtrs-clt.c: In function 'rtrs_clt_remove_path_from_arr':
>>> include/linux/atomic/atomic-arch-fallback.h:90:34: error: initialization of 'struct rtrs_clt_path **' from incompatible pointer type 'struct rtrs_clt_path *' [-Werror=incompatible-pointer-types]
>        90 |         typeof(*(_ptr)) *___op = (_oldp), ___o = *___op, ___r; \
>           |                                  ^
>     include/linux/atomic/atomic-instrumented.h:1978:9: note: in expansion of macro 'arch_try_cmpxchg'
>      1978 |         arch_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~
>     drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: note: in expansion of macro 'try_cmpxchg'
>      2297 |                 if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, clt_path, next))
>           |                     ^~~~~~~~~~~
>     cc1: some warnings being treated as errors

My bad, thanks for the report!

Guoqing

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths
@ 2022-09-03  3:54       ` Guoqing Jiang
  0 siblings, 0 replies; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-03  3:54 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3443 bytes --]



On 9/3/22 3:15 AM, kernel test robot wrote:
> Hi Guoqing,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on rdma/for-next]
> [also build test ERROR on linus/master v6.0-rc3 next-20220901]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Guoqing-Jiang/misc-changes-for-rtrs/20220902-182137
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
> config: parisc64-allmodconfig (https://download.01.org/0day-ci/archive/20220903/202209030331.GmBYWKZb-lkp(a)intel.com/config)
> compiler: hppa-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/intel-lab-lkp/linux/commit/1cb28fde63a272543476132ec83f6eb121111fae
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Guoqing-Jiang/misc-changes-for-rtrs/20220902-182137
>          git checkout 1cb28fde63a272543476132ec83f6eb121111fae
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash drivers/infiniband/ulp/rtrs/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>     In file included from include/linux/atomic.h:80,
>                      from arch/parisc/include/asm/bitops.h:13,
>                      from include/linux/bitops.h:67,
>                      from include/linux/log2.h:12,
>                      from include/asm-generic/div64.h:55,
>                      from ./arch/parisc/include/generated/asm/div64.h:1,
>                      from include/linux/math.h:6,
>                      from include/linux/math64.h:6,
>                      from include/linux/time.h:6,
>                      from include/linux/stat.h:19,
>                      from include/linux/module.h:13,
>                      from drivers/infiniband/ulp/rtrs/rtrs-clt.c:13:
>     drivers/infiniband/ulp/rtrs/rtrs-clt.c: In function 'rtrs_clt_remove_path_from_arr':
>>> include/linux/atomic/atomic-arch-fallback.h:90:34: error: initialization of 'struct rtrs_clt_path **' from incompatible pointer type 'struct rtrs_clt_path *' [-Werror=incompatible-pointer-types]
>        90 |         typeof(*(_ptr)) *___op = (_oldp), ___o = *___op, ___r; \
>           |                                  ^
>     include/linux/atomic/atomic-instrumented.h:1978:9: note: in expansion of macro 'arch_try_cmpxchg'
>      1978 |         arch_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>           |         ^~~~~~~~~~~~~~~~
>     drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: note: in expansion of macro 'try_cmpxchg'
>      2297 |                 if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, clt_path, next))
>           |                     ^~~~~~~~~~~
>     cc1: some warnings being treated as errors

My bad, thanks for the report!

Guoqing

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Updated PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths
  2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
                   ` (2 preceding siblings ...)
  2022-09-02 10:19 ` [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths Guoqing Jiang
@ 2022-09-03  4:02 ` Guoqing Jiang
  2022-09-05 12:28 ` [PATCH 0/3] misc changes for rtrs Leon Romanovsky
  4 siblings, 0 replies; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-03  4:02 UTC (permalink / raw)
  To: haris.iqbal, jinpu.wang, jgg, leon
  Cc: linux-rdma, Guoqing Jiang, kernel test robot

Let's call try_cmpxchg directly for the same purpose.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index c29eccdb4fd2..9586de08818f 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2220,17 +2220,6 @@ static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path)
 	}
 }
 
-static inline bool xchg_paths(struct rtrs_clt_path __rcu **rcu_ppcpu_path,
-			      struct rtrs_clt_path *clt_path,
-			      struct rtrs_clt_path *next)
-{
-	struct rtrs_clt_path **ppcpu_path;
-
-	/* Call cmpxchg() without sparse warnings */
-	ppcpu_path = (typeof(ppcpu_path))rcu_ppcpu_path;
-	return clt_path == cmpxchg(ppcpu_path, clt_path, next);
-}
-
 static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
 {
 	struct rtrs_clt_sess *clt = clt_path->clt;
@@ -2305,7 +2294,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
 		 * We race with IO code path, which also changes pointer,
 		 * thus we have to be careful not to overwrite it.
 		 */
-		if (xchg_paths(ppcpu_path, clt_path, next))
+		if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, &clt_path, next))
 			/*
 			 * @ppcpu_path was successfully replaced with @next,
 			 * that means that someone could also pick up the
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] misc changes for rtrs
  2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
                   ` (3 preceding siblings ...)
  2022-09-03  4:02 ` [Updated PATCH " Guoqing Jiang
@ 2022-09-05 12:28 ` Leon Romanovsky
  2022-09-06  7:04   ` Guoqing Jiang
  4 siblings, 1 reply; 12+ messages in thread
From: Leon Romanovsky @ 2022-09-05 12:28 UTC (permalink / raw)
  To: Guoqing Jiang; +Cc: haris.iqbal, jinpu.wang, jgg, linux-rdma

On Fri, Sep 02, 2022 at 06:19:19PM +0800, Guoqing Jiang wrote:
> Hi,
> 
> Pls review the three patches.
> 
> Thanks,
> Guoqing
> 
> Guoqing Jiang (3):
>   RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH
>   RDMA/rtrs-clt: Break the loop once one path is connected
>   RDMA/rtrs-clt: Kill xchg_paths
> 
>  drivers/infiniband/ulp/rtrs/rtrs-clt.c | 18 +++++-------------
>  drivers/infiniband/ulp/rtrs/rtrs-pri.h |  7 +++----
>  2 files changed, 8 insertions(+), 17 deletions(-)

The third patch still generates warnings.

➜  kernel git:(wip/leon-for-next) mkt ci
^[[A^[[A^[[Ad9b137e23d31 (HEAD -> build) RDMA/rtrs-clt: Kill xchg_paths
WARNING: line length of 81 exceeds 80 columns
#43: FILE: drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:
+		if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, &clt_path, next))

drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: warning: incorrect type in initializer (different address spaces)
drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    expected struct rtrs_clt_path [noderef] __rcu *__new
drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    got struct rtrs_clt_path *[assigned] next


> 
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] misc changes for rtrs
  2022-09-05 12:28 ` [PATCH 0/3] misc changes for rtrs Leon Romanovsky
@ 2022-09-06  7:04   ` Guoqing Jiang
  2022-09-06 11:13     ` Leon Romanovsky
  0 siblings, 1 reply; 12+ messages in thread
From: Guoqing Jiang @ 2022-09-06  7:04 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: haris.iqbal, jinpu.wang, jgg, linux-rdma

Hi Leon,

On 9/5/22 8:28 PM, Leon Romanovsky wrote:
> On Fri, Sep 02, 2022 at 06:19:19PM +0800, Guoqing Jiang wrote:
>> Hi,
>>
>> Pls review the three patches.
>>
>> Thanks,
>> Guoqing
>>
>> Guoqing Jiang (3):
>>    RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH
>>    RDMA/rtrs-clt: Break the loop once one path is connected
>>    RDMA/rtrs-clt: Kill xchg_paths
>>
>>   drivers/infiniband/ulp/rtrs/rtrs-clt.c | 18 +++++-------------
>>   drivers/infiniband/ulp/rtrs/rtrs-pri.h |  7 +++----
>>   2 files changed, 8 insertions(+), 17 deletions(-)
> The third patch still generates warnings.

Sorry, I didn't run sparse check, 😅.

> ➜  kernel git:(wip/leon-for-next) mkt ci
> ^[[A^[[A^[[Ad9b137e23d31 (HEAD -> build) RDMA/rtrs-clt: Kill xchg_paths
> WARNING: line length of 81 exceeds 80 columns
> #43: FILE: drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:
> +		if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, &clt_path, next))
>
> drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: warning: incorrect type in initializer (different address spaces)
> drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    expected struct rtrs_clt_path [noderef] __rcu *__new
> drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    got struct rtrs_clt_path *[assigned] next

Before send new version, could you help to check whether the incremental 
change works or not? Otherwise let's drop the third one.

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c 
b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 0661a4e69fc9..bc3e1722e00d 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2294,7 +2294,8 @@ static void rtrs_clt_remove_path_from_arr(struct 
rtrs_clt_path *clt_path)
                  * We race with IO code path, which also changes pointer,
                  * thus we have to be careful not to overwrite it.
                  */
-               if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, 
clt_path, next))
+               if (try_cmpxchg((struct rtrs_clt_path **)ppcpu_path,
+                               clt_path, next))
                         /*
                          * @ppcpu_path was successfully replaced with 
@next,
                          * that means that someone could also pick up the

Thanks,
Guoqing

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] misc changes for rtrs
  2022-09-06  7:04   ` Guoqing Jiang
@ 2022-09-06 11:13     ` Leon Romanovsky
  2022-09-08  8:53       ` Haris Iqbal
  0 siblings, 1 reply; 12+ messages in thread
From: Leon Romanovsky @ 2022-09-06 11:13 UTC (permalink / raw)
  To: Guoqing Jiang; +Cc: haris.iqbal, jinpu.wang, jgg, linux-rdma

On Tue, Sep 06, 2022 at 03:04:50PM +0800, Guoqing Jiang wrote:
> Hi Leon,
> 
> On 9/5/22 8:28 PM, Leon Romanovsky wrote:
> > On Fri, Sep 02, 2022 at 06:19:19PM +0800, Guoqing Jiang wrote:
> > > Hi,
> > > 
> > > Pls review the three patches.
> > > 
> > > Thanks,
> > > Guoqing
> > > 
> > > Guoqing Jiang (3):
> > >    RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH
> > >    RDMA/rtrs-clt: Break the loop once one path is connected
> > >    RDMA/rtrs-clt: Kill xchg_paths
> > > 
> > >   drivers/infiniband/ulp/rtrs/rtrs-clt.c | 18 +++++-------------
> > >   drivers/infiniband/ulp/rtrs/rtrs-pri.h |  7 +++----
> > >   2 files changed, 8 insertions(+), 17 deletions(-)
> > The third patch still generates warnings.
> 
> Sorry, I didn't run sparse check, 😅.
> 
> > ➜  kernel git:(wip/leon-for-next) mkt ci
> > ^[[A^[[A^[[Ad9b137e23d31 (HEAD -> build) RDMA/rtrs-clt: Kill xchg_paths
> > WARNING: line length of 81 exceeds 80 columns
> > #43: FILE: drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:
> > +		if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, &clt_path, next))
> > 
> > drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: warning: incorrect type in initializer (different address spaces)
> > drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    expected struct rtrs_clt_path [noderef] __rcu *__new
> > drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    got struct rtrs_clt_path *[assigned] next
> 
> Before send new version, could you help to check whether the incremental
> change works or not? Otherwise let's drop the third one.

Thanks, it worked.

> 
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index 0661a4e69fc9..bc3e1722e00d 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -2294,7 +2294,8 @@ static void rtrs_clt_remove_path_from_arr(struct
> rtrs_clt_path *clt_path)
>                  * We race with IO code path, which also changes pointer,
>                  * thus we have to be careful not to overwrite it.
>                  */
> -               if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, clt_path,
> next))
> +               if (try_cmpxchg((struct rtrs_clt_path **)ppcpu_path,
> +                               clt_path, next))
>                         /*
>                          * @ppcpu_path was successfully replaced with @next,
>                          * that means that someone could also pick up the
> 
> Thanks,
> Guoqing

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/3] misc changes for rtrs
  2022-09-06 11:13     ` Leon Romanovsky
@ 2022-09-08  8:53       ` Haris Iqbal
  0 siblings, 0 replies; 12+ messages in thread
From: Haris Iqbal @ 2022-09-08  8:53 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Guoqing Jiang, jinpu.wang, jgg, linux-rdma

On Tue, Sep 6, 2022 at 1:13 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Tue, Sep 06, 2022 at 03:04:50PM +0800, Guoqing Jiang wrote:
> > Hi Leon,
> >
> > On 9/5/22 8:28 PM, Leon Romanovsky wrote:
> > > On Fri, Sep 02, 2022 at 06:19:19PM +0800, Guoqing Jiang wrote:
> > > > Hi,
> > > >
> > > > Pls review the three patches.
> > > >
> > > > Thanks,
> > > > Guoqing
> > > >
> > > > Guoqing Jiang (3):
> > > >    RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH
> > > >    RDMA/rtrs-clt: Break the loop once one path is connected
> > > >    RDMA/rtrs-clt: Kill xchg_paths
> > > >
> > > >   drivers/infiniband/ulp/rtrs/rtrs-clt.c | 18 +++++-------------
> > > >   drivers/infiniband/ulp/rtrs/rtrs-pri.h |  7 +++----
> > > >   2 files changed, 8 insertions(+), 17 deletions(-)
> > > The third patch still generates warnings.
> >
> > Sorry, I didn't run sparse check, 😅.
> >
> > > ➜  kernel git:(wip/leon-for-next) mkt ci
> > > ^[[A^[[A^[[Ad9b137e23d31 (HEAD -> build) RDMA/rtrs-clt: Kill xchg_paths
> > > WARNING: line length of 81 exceeds 80 columns
> > > #43: FILE: drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:
> > > +           if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, &clt_path, next))
> > >
> > > drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21: warning: incorrect type in initializer (different address spaces)
> > > drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    expected struct rtrs_clt_path [noderef] __rcu *__new
> > > drivers/infiniband/ulp/rtrs/rtrs-clt.c:2297:21:    got struct rtrs_clt_path *[assigned] next
> >
> > Before send new version, could you help to check whether the incremental
> > change works or not? Otherwise let's drop the third one.
>
> Thanks, it worked.

Looks good.

Acked-by: Md Haris Iqbal <haris.iqbal@ionos.com>

For all 3 patches (3rd one with the latest changes).
Thanks.

>
> >
> > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> > b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> > index 0661a4e69fc9..bc3e1722e00d 100644
> > --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> > +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> > @@ -2294,7 +2294,8 @@ static void rtrs_clt_remove_path_from_arr(struct
> > rtrs_clt_path *clt_path)
> >                  * We race with IO code path, which also changes pointer,
> >                  * thus we have to be careful not to overwrite it.
> >                  */
> > -               if (try_cmpxchg((typeof(ppcpu_path))ppcpu_path, clt_path,
> > next))
> > +               if (try_cmpxchg((struct rtrs_clt_path **)ppcpu_path,
> > +                               clt_path, next))
> >                         /*
> >                          * @ppcpu_path was successfully replaced with @next,
> >                          * that means that someone could also pick up the
> >
> > Thanks,
> > Guoqing

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-09-08  8:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
2022-09-02 10:19 ` [PATCH 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH Guoqing Jiang
2022-09-02 10:19 ` [PATCH 2/3] RDMA/rtrs-clt: Break the loop once one path is connected Guoqing Jiang
2022-09-02 10:19 ` [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths Guoqing Jiang
2022-09-02 19:15   ` kernel test robot
2022-09-03  3:54     ` Guoqing Jiang
2022-09-03  3:54       ` Guoqing Jiang
2022-09-03  4:02 ` [Updated PATCH " Guoqing Jiang
2022-09-05 12:28 ` [PATCH 0/3] misc changes for rtrs Leon Romanovsky
2022-09-06  7:04   ` Guoqing Jiang
2022-09-06 11:13     ` Leon Romanovsky
2022-09-08  8:53       ` Haris Iqbal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.