diff mbox

[v2,14/26] ibtrs: include client and server modules into kernel compilation

Message ID 20180518130413.16997-15-roman.penyaev@profitbricks.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roman Pen May 18, 2018, 1:04 p.m. UTC
Add IBTRS Makefile, Kconfig and also corresponding lines into upper
layer infiniband/ulp files.

Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
Signed-off-by: Danil Kipnis <danil.kipnis@profitbricks.com>
Cc: Jack Wang <jinpu.wang@profitbricks.com>
---
 drivers/infiniband/Kconfig            |  1 +
 drivers/infiniband/ulp/Makefile       |  1 +
 drivers/infiniband/ulp/ibtrs/Kconfig  | 20 ++++++++++++++++++++
 drivers/infiniband/ulp/ibtrs/Makefile | 15 +++++++++++++++
 4 files changed, 37 insertions(+)
 create mode 100644 drivers/infiniband/ulp/ibtrs/Kconfig
 create mode 100644 drivers/infiniband/ulp/ibtrs/Makefile

Comments

kernel test robot May 20, 2018, 10:14 p.m. UTC | #1
Hi Roman,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc5 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Roman-Pen/InfiniBand-Transport-IBTRS-and-Network-Block-Device-IBNBD/20180520-222445
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   In file included from arch/m68k/include/asm/atomic.h:7:0,
                    from include/linux/atomic.h:5,
                    from include/linux/spinlock.h:399,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:10,
                    from drivers/infiniband//ulp/ibtrs/ibtrs-clt.c:34:
   drivers/infiniband//ulp/ibtrs/ibtrs-clt.c: In function 'ibtrs_clt_remove_path_from_arr':
   arch/m68k/include/asm/cmpxchg.h:122:3: warning: value computed is not used [-Wunused-value]
     ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o),     \
     ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       (unsigned long)(n), sizeof(*(ptr))))
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/infiniband//ulp/ibtrs/ibtrs-clt.c:1456:3: note: in expansion of macro 'cmpxchg'
      cmpxchg(ppcpu_path, sess, next);
      ^~~~~~~

vim +/cmpxchg +1456 drivers/infiniband//ulp/ibtrs/ibtrs-clt.c

44463323 Roman Pen 2018-05-18  1396  
44463323 Roman Pen 2018-05-18  1397  static void ibtrs_clt_remove_path_from_arr(struct ibtrs_clt_sess *sess)
44463323 Roman Pen 2018-05-18  1398  {
44463323 Roman Pen 2018-05-18  1399  	struct ibtrs_clt *clt = sess->clt;
44463323 Roman Pen 2018-05-18  1400  	struct ibtrs_clt_sess *next;
44463323 Roman Pen 2018-05-18  1401  	int cpu;
44463323 Roman Pen 2018-05-18  1402  
44463323 Roman Pen 2018-05-18  1403  	mutex_lock(&clt->paths_mutex);
44463323 Roman Pen 2018-05-18  1404  	list_del_rcu(&sess->s.entry);
44463323 Roman Pen 2018-05-18  1405  
44463323 Roman Pen 2018-05-18  1406  	/* Make sure everybody observes path removal. */
44463323 Roman Pen 2018-05-18  1407  	synchronize_rcu();
44463323 Roman Pen 2018-05-18  1408  
44463323 Roman Pen 2018-05-18  1409  	/*
44463323 Roman Pen 2018-05-18  1410  	 * Decrement paths number only after grace period, because
44463323 Roman Pen 2018-05-18  1411  	 * caller of do_each_path() must firstly observe list without
44463323 Roman Pen 2018-05-18  1412  	 * path and only then decremented paths number.
44463323 Roman Pen 2018-05-18  1413  	 *
44463323 Roman Pen 2018-05-18  1414  	 * Otherwise there can be the following situation:
44463323 Roman Pen 2018-05-18  1415  	 *    o Two paths exist and IO is coming.
44463323 Roman Pen 2018-05-18  1416  	 *    o One path is removed:
44463323 Roman Pen 2018-05-18  1417  	 *      CPU#0                          CPU#1
44463323 Roman Pen 2018-05-18  1418  	 *      do_each_path():                ibtrs_clt_remove_path_from_arr():
44463323 Roman Pen 2018-05-18  1419  	 *          path = get_next_path()
44463323 Roman Pen 2018-05-18  1420  	 *          ^^^                            list_del_rcu(path)
44463323 Roman Pen 2018-05-18  1421  	 *          [!CONNECTED path]              clt->paths_num--
44463323 Roman Pen 2018-05-18  1422  	 *                                              ^^^^^^^^^
44463323 Roman Pen 2018-05-18  1423  	 *          load clt->paths_num                 from 2 to 1
44463323 Roman Pen 2018-05-18  1424  	 *                    ^^^^^^^^^
44463323 Roman Pen 2018-05-18  1425  	 *                    sees 1
44463323 Roman Pen 2018-05-18  1426  	 *
44463323 Roman Pen 2018-05-18  1427  	 *      path is observed as !CONNECTED, but do_each_path() loop
44463323 Roman Pen 2018-05-18  1428  	 *      ends, because expression i < clt->paths_num is false.
44463323 Roman Pen 2018-05-18  1429  	 */
44463323 Roman Pen 2018-05-18  1430  	clt->paths_num--;
44463323 Roman Pen 2018-05-18  1431  
44463323 Roman Pen 2018-05-18  1432  	next = list_next_or_null_rr_rcu(&clt->paths_list, &sess->s.entry,
44463323 Roman Pen 2018-05-18  1433  					typeof(*next), s.entry);
44463323 Roman Pen 2018-05-18  1434  
44463323 Roman Pen 2018-05-18  1435  	/*
44463323 Roman Pen 2018-05-18  1436  	 * Pcpu paths can still point to the path which is going to be
44463323 Roman Pen 2018-05-18  1437  	 * removed, so change the pointer manually.
44463323 Roman Pen 2018-05-18  1438  	 */
44463323 Roman Pen 2018-05-18  1439  	for_each_possible_cpu(cpu) {
44463323 Roman Pen 2018-05-18  1440  		struct ibtrs_clt_sess **ppcpu_path;
44463323 Roman Pen 2018-05-18  1441  
44463323 Roman Pen 2018-05-18  1442  		ppcpu_path = per_cpu_ptr(clt->pcpu_path, cpu);
44463323 Roman Pen 2018-05-18  1443  		if (*ppcpu_path != sess)
44463323 Roman Pen 2018-05-18  1444  			/*
44463323 Roman Pen 2018-05-18  1445  			 * synchronize_rcu() was called just after deleting
44463323 Roman Pen 2018-05-18  1446  			 * entry from the list, thus IO code path cannot
44463323 Roman Pen 2018-05-18  1447  			 * change pointer back to the pointer which is going
44463323 Roman Pen 2018-05-18  1448  			 * to be removed, we are safe here.
44463323 Roman Pen 2018-05-18  1449  			 */
44463323 Roman Pen 2018-05-18  1450  			continue;
44463323 Roman Pen 2018-05-18  1451  
44463323 Roman Pen 2018-05-18  1452  		/*
44463323 Roman Pen 2018-05-18  1453  		 * We race with IO code path, which also changes pointer,
44463323 Roman Pen 2018-05-18  1454  		 * thus we have to be careful not to override it.
44463323 Roman Pen 2018-05-18  1455  		 */
44463323 Roman Pen 2018-05-18 @1456  		cmpxchg(ppcpu_path, sess, next);
44463323 Roman Pen 2018-05-18  1457  	}
44463323 Roman Pen 2018-05-18  1458  	mutex_unlock(&clt->paths_mutex);
44463323 Roman Pen 2018-05-18  1459  }
44463323 Roman Pen 2018-05-18  1460  

:::::: The code at line 1456 was first introduced by commit
:::::: 4446332354bf8cf878755e55a221c59eb55a0f1f ibtrs: client: main functionality

:::::: TO: Roman Pen <roman.penyaev@profitbricks.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot May 21, 2018, 6:36 a.m. UTC | #2
Hi Roman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17-rc6 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Roman-Pen/InfiniBand-Transport-IBTRS-and-Network-Block-Device-IBNBD/20180520-222445
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   drivers/mtd/nand/raw/nand_base.o: In function `nand_soft_waitrdy':
   nand_base.c:(.text+0x1022): undefined reference to `__udivdi3'
   drivers/infiniband/ulp/ibtrs/ibtrs-clt-stats.o: In function `ibtrs_clt_stats_wc_completion_to_str':
>> ibtrs-clt-stats.c:(.text+0x172): undefined reference to `__udivdi3'
   drivers/infiniband/ulp/ibtrs/ibtrs-clt-stats.o: In function `ibtrs_clt_stats_sg_list_distr_to_str':
   ibtrs-clt-stats.c:(.text+0x49c): undefined reference to `__udivdi3'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Leon Romanovsky May 22, 2018, 5:05 a.m. UTC | #3
On Fri, May 18, 2018 at 03:04:01PM +0200, Roman Pen wrote:
> Add IBTRS Makefile, Kconfig and also corresponding lines into upper
> layer infiniband/ulp files.
>
> Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
> Signed-off-by: Danil Kipnis <danil.kipnis@profitbricks.com>
> Cc: Jack Wang <jinpu.wang@profitbricks.com>
> ---
>  drivers/infiniband/Kconfig            |  1 +
>  drivers/infiniband/ulp/Makefile       |  1 +
>  drivers/infiniband/ulp/ibtrs/Kconfig  | 20 ++++++++++++++++++++
>  drivers/infiniband/ulp/ibtrs/Makefile | 15 +++++++++++++++
>  4 files changed, 37 insertions(+)
>  create mode 100644 drivers/infiniband/ulp/ibtrs/Kconfig
>  create mode 100644 drivers/infiniband/ulp/ibtrs/Makefile
>
> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
> index ee270e065ba9..787bd286fb08 100644
> --- a/drivers/infiniband/Kconfig
> +++ b/drivers/infiniband/Kconfig
> @@ -94,6 +94,7 @@ source "drivers/infiniband/ulp/srpt/Kconfig"
>
>  source "drivers/infiniband/ulp/iser/Kconfig"
>  source "drivers/infiniband/ulp/isert/Kconfig"
> +source "drivers/infiniband/ulp/ibtrs/Kconfig"
>
>  source "drivers/infiniband/ulp/opa_vnic/Kconfig"
>  source "drivers/infiniband/sw/rdmavt/Kconfig"
> diff --git a/drivers/infiniband/ulp/Makefile b/drivers/infiniband/ulp/Makefile
> index 437813c7b481..1c4f10dc8d49 100644
> --- a/drivers/infiniband/ulp/Makefile
> +++ b/drivers/infiniband/ulp/Makefile
> @@ -5,3 +5,4 @@ obj-$(CONFIG_INFINIBAND_SRPT)		+= srpt/
>  obj-$(CONFIG_INFINIBAND_ISER)		+= iser/
>  obj-$(CONFIG_INFINIBAND_ISERT)		+= isert/
>  obj-$(CONFIG_INFINIBAND_OPA_VNIC)	+= opa_vnic/
> +obj-$(CONFIG_INFINIBAND_IBTRS)		+= ibtrs/
> diff --git a/drivers/infiniband/ulp/ibtrs/Kconfig b/drivers/infiniband/ulp/ibtrs/Kconfig
> new file mode 100644
> index 000000000000..eaeb8f3f6b4e
> --- /dev/null
> +++ b/drivers/infiniband/ulp/ibtrs/Kconfig
> @@ -0,0 +1,20 @@
> +config INFINIBAND_IBTRS
> +	tristate
> +	depends on INFINIBAND_ADDR_TRANS
> +
> +config INFINIBAND_IBTRS_CLIENT
> +	tristate "IBTRS client module"
> +	depends on INFINIBAND_ADDR_TRANS
> +	select INFINIBAND_IBTRS
> +	help
> +	  IBTRS client allows for simplified data transfer and connection
> +	  establishment over RDMA (InfiniBand, RoCE, iWarp). Uses BIO-like
> +	  READ/WRITE semantics and provides multipath capabilities.
> +
> +config INFINIBAND_IBTRS_SERVER
> +	tristate "IBTRS server module"
> +	depends on INFINIBAND_ADDR_TRANS
> +	select INFINIBAND_IBTRS
> +	help
> +	  IBTRS server module processing connection and IO requests received
> +	  from the IBTRS client module.
> diff --git a/drivers/infiniband/ulp/ibtrs/Makefile b/drivers/infiniband/ulp/ibtrs/Makefile
> new file mode 100644
> index 000000000000..e6ea858745ad
> --- /dev/null
> +++ b/drivers/infiniband/ulp/ibtrs/Makefile
> @@ -0,0 +1,15 @@
> +ibtrs-client-y := ibtrs-clt.o \
> +		  ibtrs-clt-stats.o \
> +		  ibtrs-clt-sysfs.o
> +
> +ibtrs-server-y := ibtrs-srv.o \
> +		  ibtrs-srv-stats.o \
> +		  ibtrs-srv-sysfs.o
> +
> +ibtrs-core-y := ibtrs.o
> +
> +obj-$(CONFIG_INFINIBAND_IBTRS)        += ibtrs-core.o

Will it build ibtrs-core in case both server and client are disabled in .config?

> +obj-$(CONFIG_INFINIBAND_IBTRS_CLIENT) += ibtrs-client.o
> +obj-$(CONFIG_INFINIBAND_IBTRS_SERVER) += ibtrs-server.o
> +
> +-include $(src)/compat/compat.mk

What is this?


> --
> 2.13.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Roman Pen May 22, 2018, 9:27 a.m. UTC | #4
On Tue, May 22, 2018 at 7:05 AM, Leon Romanovsky <leon@kernel.org> wrote:
> On Fri, May 18, 2018 at 03:04:01PM +0200, Roman Pen wrote:
>> Add IBTRS Makefile, Kconfig and also corresponding lines into upper
>> layer infiniband/ulp files.
>>
>> Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
>> Signed-off-by: Danil Kipnis <danil.kipnis@profitbricks.com>
>> Cc: Jack Wang <jinpu.wang@profitbricks.com>
>> ---
>>  drivers/infiniband/Kconfig            |  1 +
>>  drivers/infiniband/ulp/Makefile       |  1 +
>>  drivers/infiniband/ulp/ibtrs/Kconfig  | 20 ++++++++++++++++++++
>>  drivers/infiniband/ulp/ibtrs/Makefile | 15 +++++++++++++++
>>  4 files changed, 37 insertions(+)
>>  create mode 100644 drivers/infiniband/ulp/ibtrs/Kconfig
>>  create mode 100644 drivers/infiniband/ulp/ibtrs/Makefile
>>
>> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
>> index ee270e065ba9..787bd286fb08 100644
>> --- a/drivers/infiniband/Kconfig
>> +++ b/drivers/infiniband/Kconfig
>> @@ -94,6 +94,7 @@ source "drivers/infiniband/ulp/srpt/Kconfig"
>>
>>  source "drivers/infiniband/ulp/iser/Kconfig"
>>  source "drivers/infiniband/ulp/isert/Kconfig"
>> +source "drivers/infiniband/ulp/ibtrs/Kconfig"
>>
>>  source "drivers/infiniband/ulp/opa_vnic/Kconfig"
>>  source "drivers/infiniband/sw/rdmavt/Kconfig"
>> diff --git a/drivers/infiniband/ulp/Makefile b/drivers/infiniband/ulp/Makefile
>> index 437813c7b481..1c4f10dc8d49 100644
>> --- a/drivers/infiniband/ulp/Makefile
>> +++ b/drivers/infiniband/ulp/Makefile
>> @@ -5,3 +5,4 @@ obj-$(CONFIG_INFINIBAND_SRPT)         += srpt/
>>  obj-$(CONFIG_INFINIBAND_ISER)                += iser/
>>  obj-$(CONFIG_INFINIBAND_ISERT)               += isert/
>>  obj-$(CONFIG_INFINIBAND_OPA_VNIC)    += opa_vnic/
>> +obj-$(CONFIG_INFINIBAND_IBTRS)               += ibtrs/
>> diff --git a/drivers/infiniband/ulp/ibtrs/Kconfig b/drivers/infiniband/ulp/ibtrs/Kconfig
>> new file mode 100644
>> index 000000000000..eaeb8f3f6b4e
>> --- /dev/null
>> +++ b/drivers/infiniband/ulp/ibtrs/Kconfig
>> @@ -0,0 +1,20 @@
>> +config INFINIBAND_IBTRS
>> +     tristate
>> +     depends on INFINIBAND_ADDR_TRANS
>> +
>> +config INFINIBAND_IBTRS_CLIENT
>> +     tristate "IBTRS client module"
>> +     depends on INFINIBAND_ADDR_TRANS
>> +     select INFINIBAND_IBTRS
>> +     help
>> +       IBTRS client allows for simplified data transfer and connection
>> +       establishment over RDMA (InfiniBand, RoCE, iWarp). Uses BIO-like
>> +       READ/WRITE semantics and provides multipath capabilities.
>> +
>> +config INFINIBAND_IBTRS_SERVER
>> +     tristate "IBTRS server module"
>> +     depends on INFINIBAND_ADDR_TRANS
>> +     select INFINIBAND_IBTRS
>> +     help
>> +       IBTRS server module processing connection and IO requests received
>> +       from the IBTRS client module.
>> diff --git a/drivers/infiniband/ulp/ibtrs/Makefile b/drivers/infiniband/ulp/ibtrs/Makefile
>> new file mode 100644
>> index 000000000000..e6ea858745ad
>> --- /dev/null
>> +++ b/drivers/infiniband/ulp/ibtrs/Makefile
>> @@ -0,0 +1,15 @@
>> +ibtrs-client-y := ibtrs-clt.o \
>> +               ibtrs-clt-stats.o \
>> +               ibtrs-clt-sysfs.o
>> +
>> +ibtrs-server-y := ibtrs-srv.o \
>> +               ibtrs-srv-stats.o \
>> +               ibtrs-srv-sysfs.o
>> +
>> +ibtrs-core-y := ibtrs.o
>> +
>> +obj-$(CONFIG_INFINIBAND_IBTRS)        += ibtrs-core.o
>
> Will it build ibtrs-core in case both server and client are disabled in .config?

No, CONFIG_INFINIBAND_IBTRS is selected/deselected by
CONFIG_INFINIBAND_IBTRS_CLIENT or CONFIG_INFINIBAND_IBTRS_SERVER,
when you choose them in kconfig.


>> +obj-$(CONFIG_INFINIBAND_IBTRS_CLIENT) += ibtrs-client.o
>> +obj-$(CONFIG_INFINIBAND_IBTRS_SERVER) += ibtrs-server.o
>> +
>> +-include $(src)/compat/compat.mk
>
> What is this?

Well, in our production we use same source code and in order not to spoil
sources with 'ifdef' macros for different kernel versions I use compat
layer, which obviously will never go upstream.  This line is the only
clean way to keep sources always up-to-date with latest kernel and still
be compatible with what we have on our servers in production.

'-' prefix at the beginning of the line tells make to ignore it if
file does not exist, so should not rise any error for compilation
against latest kernel.

Here is an example of the compat layer for IBNBD block device:
https://github.com/profitbricks/ibnbd/tree/master/ibnbd/compat

--
Roman
Leon Romanovsky May 22, 2018, 1:18 p.m. UTC | #5
On Tue, May 22, 2018 at 11:27:21AM +0200, Roman Penyaev wrote:
> On Tue, May 22, 2018 at 7:05 AM, Leon Romanovsky <leon@kernel.org> wrote:
> > On Fri, May 18, 2018 at 03:04:01PM +0200, Roman Pen wrote:
> >> Add IBTRS Makefile, Kconfig and also corresponding lines into upper
> >> layer infiniband/ulp files.
> >>
> >> Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
> >> Signed-off-by: Danil Kipnis <danil.kipnis@profitbricks.com>
> >> Cc: Jack Wang <jinpu.wang@profitbricks.com>
> >> ---
> >>  drivers/infiniband/Kconfig            |  1 +
> >>  drivers/infiniband/ulp/Makefile       |  1 +
> >>  drivers/infiniband/ulp/ibtrs/Kconfig  | 20 ++++++++++++++++++++
> >>  drivers/infiniband/ulp/ibtrs/Makefile | 15 +++++++++++++++
> >>  4 files changed, 37 insertions(+)
> >>  create mode 100644 drivers/infiniband/ulp/ibtrs/Kconfig
> >>  create mode 100644 drivers/infiniband/ulp/ibtrs/Makefile
> >>
> >> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
> >> index ee270e065ba9..787bd286fb08 100644
> >> --- a/drivers/infiniband/Kconfig
> >> +++ b/drivers/infiniband/Kconfig
> >> @@ -94,6 +94,7 @@ source "drivers/infiniband/ulp/srpt/Kconfig"
> >>
> >>  source "drivers/infiniband/ulp/iser/Kconfig"
> >>  source "drivers/infiniband/ulp/isert/Kconfig"
> >> +source "drivers/infiniband/ulp/ibtrs/Kconfig"
> >>
> >>  source "drivers/infiniband/ulp/opa_vnic/Kconfig"
> >>  source "drivers/infiniband/sw/rdmavt/Kconfig"
> >> diff --git a/drivers/infiniband/ulp/Makefile b/drivers/infiniband/ulp/Makefile
> >> index 437813c7b481..1c4f10dc8d49 100644
> >> --- a/drivers/infiniband/ulp/Makefile
> >> +++ b/drivers/infiniband/ulp/Makefile
> >> @@ -5,3 +5,4 @@ obj-$(CONFIG_INFINIBAND_SRPT)         += srpt/
> >>  obj-$(CONFIG_INFINIBAND_ISER)                += iser/
> >>  obj-$(CONFIG_INFINIBAND_ISERT)               += isert/
> >>  obj-$(CONFIG_INFINIBAND_OPA_VNIC)    += opa_vnic/
> >> +obj-$(CONFIG_INFINIBAND_IBTRS)               += ibtrs/
> >> diff --git a/drivers/infiniband/ulp/ibtrs/Kconfig b/drivers/infiniband/ulp/ibtrs/Kconfig
> >> new file mode 100644
> >> index 000000000000..eaeb8f3f6b4e
> >> --- /dev/null
> >> +++ b/drivers/infiniband/ulp/ibtrs/Kconfig
> >> @@ -0,0 +1,20 @@
> >> +config INFINIBAND_IBTRS
> >> +     tristate
> >> +     depends on INFINIBAND_ADDR_TRANS
> >> +
> >> +config INFINIBAND_IBTRS_CLIENT
> >> +     tristate "IBTRS client module"
> >> +     depends on INFINIBAND_ADDR_TRANS
> >> +     select INFINIBAND_IBTRS
> >> +     help
> >> +       IBTRS client allows for simplified data transfer and connection
> >> +       establishment over RDMA (InfiniBand, RoCE, iWarp). Uses BIO-like
> >> +       READ/WRITE semantics and provides multipath capabilities.
> >> +
> >> +config INFINIBAND_IBTRS_SERVER
> >> +     tristate "IBTRS server module"
> >> +     depends on INFINIBAND_ADDR_TRANS
> >> +     select INFINIBAND_IBTRS
> >> +     help
> >> +       IBTRS server module processing connection and IO requests received
> >> +       from the IBTRS client module.
> >> diff --git a/drivers/infiniband/ulp/ibtrs/Makefile b/drivers/infiniband/ulp/ibtrs/Makefile
> >> new file mode 100644
> >> index 000000000000..e6ea858745ad
> >> --- /dev/null
> >> +++ b/drivers/infiniband/ulp/ibtrs/Makefile
> >> @@ -0,0 +1,15 @@
> >> +ibtrs-client-y := ibtrs-clt.o \
> >> +               ibtrs-clt-stats.o \
> >> +               ibtrs-clt-sysfs.o
> >> +
> >> +ibtrs-server-y := ibtrs-srv.o \
> >> +               ibtrs-srv-stats.o \
> >> +               ibtrs-srv-sysfs.o
> >> +
> >> +ibtrs-core-y := ibtrs.o
> >> +
> >> +obj-$(CONFIG_INFINIBAND_IBTRS)        += ibtrs-core.o
> >
> > Will it build ibtrs-core in case both server and client are disabled in .config?
>
> No, CONFIG_INFINIBAND_IBTRS is selected/deselected by
> CONFIG_INFINIBAND_IBTRS_CLIENT or CONFIG_INFINIBAND_IBTRS_SERVER,
> when you choose them in kconfig.
>

Thanks

>
> >> +obj-$(CONFIG_INFINIBAND_IBTRS_CLIENT) += ibtrs-client.o
> >> +obj-$(CONFIG_INFINIBAND_IBTRS_SERVER) += ibtrs-server.o
> >> +
> >> +-include $(src)/compat/compat.mk
> >
> > What is this?
>
> Well, in our production we use same source code and in order not to spoil
> sources with 'ifdef' macros for different kernel versions I use compat
> layer, which obviously will never go upstream.  This line is the only
> clean way to keep sources always up-to-date with latest kernel and still
> be compatible with what we have on our servers in production.
>
> '-' prefix at the beginning of the line tells make to ignore it if
> file does not exist, so should not rise any error for compilation
> against latest kernel.
>
> Here is an example of the compat layer for IBNBD block device:
> https://github.com/profitbricks/ibnbd/tree/master/ibnbd/compat

I see it, you will need to remove this line from the upstream kernel
patches.

Thanks

>
> --
> Roman
Roman Pen May 22, 2018, 4:12 p.m. UTC | #6
On Tue, May 22, 2018 at 3:18 PM, Leon Romanovsky <leon@kernel.org> wrote:
> On Tue, May 22, 2018 at 11:27:21AM +0200, Roman Penyaev wrote:
>> On Tue, May 22, 2018 at 7:05 AM, Leon Romanovsky <leon@kernel.org> wrote:
>> > On Fri, May 18, 2018 at 03:04:01PM +0200, Roman Pen wrote:
>> >> Add IBTRS Makefile, Kconfig and also corresponding lines into upper
>> >> layer infiniband/ulp files.
>> >>
>> >> Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
>> >> Signed-off-by: Danil Kipnis <danil.kipnis@profitbricks.com>
>> >> Cc: Jack Wang <jinpu.wang@profitbricks.com>
>> >> ---
>> >>  drivers/infiniband/Kconfig            |  1 +
>> >>  drivers/infiniband/ulp/Makefile       |  1 +
>> >>  drivers/infiniband/ulp/ibtrs/Kconfig  | 20 ++++++++++++++++++++
>> >>  drivers/infiniband/ulp/ibtrs/Makefile | 15 +++++++++++++++
>> >>  4 files changed, 37 insertions(+)
>> >>  create mode 100644 drivers/infiniband/ulp/ibtrs/Kconfig
>> >>  create mode 100644 drivers/infiniband/ulp/ibtrs/Makefile
>> >>
>> >> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
>> >> index ee270e065ba9..787bd286fb08 100644
>> >> --- a/drivers/infiniband/Kconfig
>> >> +++ b/drivers/infiniband/Kconfig
>> >> @@ -94,6 +94,7 @@ source "drivers/infiniband/ulp/srpt/Kconfig"
>> >>
>> >>  source "drivers/infiniband/ulp/iser/Kconfig"
>> >>  source "drivers/infiniband/ulp/isert/Kconfig"
>> >> +source "drivers/infiniband/ulp/ibtrs/Kconfig"
>> >>
>> >>  source "drivers/infiniband/ulp/opa_vnic/Kconfig"
>> >>  source "drivers/infiniband/sw/rdmavt/Kconfig"
>> >> diff --git a/drivers/infiniband/ulp/Makefile b/drivers/infiniband/ulp/Makefile
>> >> index 437813c7b481..1c4f10dc8d49 100644
>> >> --- a/drivers/infiniband/ulp/Makefile
>> >> +++ b/drivers/infiniband/ulp/Makefile
>> >> @@ -5,3 +5,4 @@ obj-$(CONFIG_INFINIBAND_SRPT)         += srpt/
>> >>  obj-$(CONFIG_INFINIBAND_ISER)                += iser/
>> >>  obj-$(CONFIG_INFINIBAND_ISERT)               += isert/
>> >>  obj-$(CONFIG_INFINIBAND_OPA_VNIC)    += opa_vnic/
>> >> +obj-$(CONFIG_INFINIBAND_IBTRS)               += ibtrs/
>> >> diff --git a/drivers/infiniband/ulp/ibtrs/Kconfig b/drivers/infiniband/ulp/ibtrs/Kconfig
>> >> new file mode 100644
>> >> index 000000000000..eaeb8f3f6b4e
>> >> --- /dev/null
>> >> +++ b/drivers/infiniband/ulp/ibtrs/Kconfig
>> >> @@ -0,0 +1,20 @@
>> >> +config INFINIBAND_IBTRS
>> >> +     tristate
>> >> +     depends on INFINIBAND_ADDR_TRANS
>> >> +
>> >> +config INFINIBAND_IBTRS_CLIENT
>> >> +     tristate "IBTRS client module"
>> >> +     depends on INFINIBAND_ADDR_TRANS
>> >> +     select INFINIBAND_IBTRS
>> >> +     help
>> >> +       IBTRS client allows for simplified data transfer and connection
>> >> +       establishment over RDMA (InfiniBand, RoCE, iWarp). Uses BIO-like
>> >> +       READ/WRITE semantics and provides multipath capabilities.
>> >> +
>> >> +config INFINIBAND_IBTRS_SERVER
>> >> +     tristate "IBTRS server module"
>> >> +     depends on INFINIBAND_ADDR_TRANS
>> >> +     select INFINIBAND_IBTRS
>> >> +     help
>> >> +       IBTRS server module processing connection and IO requests received
>> >> +       from the IBTRS client module.
>> >> diff --git a/drivers/infiniband/ulp/ibtrs/Makefile b/drivers/infiniband/ulp/ibtrs/Makefile
>> >> new file mode 100644
>> >> index 000000000000..e6ea858745ad
>> >> --- /dev/null
>> >> +++ b/drivers/infiniband/ulp/ibtrs/Makefile
>> >> @@ -0,0 +1,15 @@
>> >> +ibtrs-client-y := ibtrs-clt.o \
>> >> +               ibtrs-clt-stats.o \
>> >> +               ibtrs-clt-sysfs.o
>> >> +
>> >> +ibtrs-server-y := ibtrs-srv.o \
>> >> +               ibtrs-srv-stats.o \
>> >> +               ibtrs-srv-sysfs.o
>> >> +
>> >> +ibtrs-core-y := ibtrs.o
>> >> +
>> >> +obj-$(CONFIG_INFINIBAND_IBTRS)        += ibtrs-core.o
>> >
>> > Will it build ibtrs-core in case both server and client are disabled in .config?
>>
>> No, CONFIG_INFINIBAND_IBTRS is selected/deselected by
>> CONFIG_INFINIBAND_IBTRS_CLIENT or CONFIG_INFINIBAND_IBTRS_SERVER,
>> when you choose them in kconfig.
>>
>
> Thanks
>
>>
>> >> +obj-$(CONFIG_INFINIBAND_IBTRS_CLIENT) += ibtrs-client.o
>> >> +obj-$(CONFIG_INFINIBAND_IBTRS_SERVER) += ibtrs-server.o
>> >> +
>> >> +-include $(src)/compat/compat.mk
>> >
>> > What is this?
>>
>> Well, in our production we use same source code and in order not to spoil
>> sources with 'ifdef' macros for different kernel versions I use compat
>> layer, which obviously will never go upstream.  This line is the only
>> clean way to keep sources always up-to-date with latest kernel and still
>> be compatible with what we have on our servers in production.
>>
>> '-' prefix at the beginning of the line tells make to ignore it if
>> file does not exist, so should not rise any error for compilation
>> against latest kernel.
>>
>> Here is an example of the compat layer for IBNBD block device:
>> https://github.com/profitbricks/ibnbd/tree/master/ibnbd/compat
>
> I see it, you will need to remove this line from the upstream kernel
> patches.

Hi Leon,

Sure.  Thanks.

--
Roman
diff mbox

Patch

diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index ee270e065ba9..787bd286fb08 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -94,6 +94,7 @@  source "drivers/infiniband/ulp/srpt/Kconfig"
 
 source "drivers/infiniband/ulp/iser/Kconfig"
 source "drivers/infiniband/ulp/isert/Kconfig"
+source "drivers/infiniband/ulp/ibtrs/Kconfig"
 
 source "drivers/infiniband/ulp/opa_vnic/Kconfig"
 source "drivers/infiniband/sw/rdmavt/Kconfig"
diff --git a/drivers/infiniband/ulp/Makefile b/drivers/infiniband/ulp/Makefile
index 437813c7b481..1c4f10dc8d49 100644
--- a/drivers/infiniband/ulp/Makefile
+++ b/drivers/infiniband/ulp/Makefile
@@ -5,3 +5,4 @@  obj-$(CONFIG_INFINIBAND_SRPT)		+= srpt/
 obj-$(CONFIG_INFINIBAND_ISER)		+= iser/
 obj-$(CONFIG_INFINIBAND_ISERT)		+= isert/
 obj-$(CONFIG_INFINIBAND_OPA_VNIC)	+= opa_vnic/
+obj-$(CONFIG_INFINIBAND_IBTRS)		+= ibtrs/
diff --git a/drivers/infiniband/ulp/ibtrs/Kconfig b/drivers/infiniband/ulp/ibtrs/Kconfig
new file mode 100644
index 000000000000..eaeb8f3f6b4e
--- /dev/null
+++ b/drivers/infiniband/ulp/ibtrs/Kconfig
@@ -0,0 +1,20 @@ 
+config INFINIBAND_IBTRS
+	tristate
+	depends on INFINIBAND_ADDR_TRANS
+
+config INFINIBAND_IBTRS_CLIENT
+	tristate "IBTRS client module"
+	depends on INFINIBAND_ADDR_TRANS
+	select INFINIBAND_IBTRS
+	help
+	  IBTRS client allows for simplified data transfer and connection
+	  establishment over RDMA (InfiniBand, RoCE, iWarp). Uses BIO-like
+	  READ/WRITE semantics and provides multipath capabilities.
+
+config INFINIBAND_IBTRS_SERVER
+	tristate "IBTRS server module"
+	depends on INFINIBAND_ADDR_TRANS
+	select INFINIBAND_IBTRS
+	help
+	  IBTRS server module processing connection and IO requests received
+	  from the IBTRS client module.
diff --git a/drivers/infiniband/ulp/ibtrs/Makefile b/drivers/infiniband/ulp/ibtrs/Makefile
new file mode 100644
index 000000000000..e6ea858745ad
--- /dev/null
+++ b/drivers/infiniband/ulp/ibtrs/Makefile
@@ -0,0 +1,15 @@ 
+ibtrs-client-y := ibtrs-clt.o \
+		  ibtrs-clt-stats.o \
+		  ibtrs-clt-sysfs.o
+
+ibtrs-server-y := ibtrs-srv.o \
+		  ibtrs-srv-stats.o \
+		  ibtrs-srv-sysfs.o
+
+ibtrs-core-y := ibtrs.o
+
+obj-$(CONFIG_INFINIBAND_IBTRS)        += ibtrs-core.o
+obj-$(CONFIG_INFINIBAND_IBTRS_CLIENT) += ibtrs-client.o
+obj-$(CONFIG_INFINIBAND_IBTRS_SERVER) += ibtrs-server.o
+
+-include $(src)/compat/compat.mk