diff mbox series

[net-next,v2,12/12] net: homa: create Makefile and Kconfig

Message ID 20241111234006.5942-13-ouster@cs.stanford.edu (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Begin upstreaming Homa transport protocol | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 4 maintainers not CCed: kuba@kernel.org edumazet@google.com horms@kernel.org pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 4 this patch: 4
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 60 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

John Ousterhout Nov. 11, 2024, 11:40 p.m. UTC
Before this commit the Homa code is "inert": it won't be compiled
in kernel builds. This commit adds Homa's Makefile and Kconfig, and
also links Homa into net/Makefile and net/Kconfig, so that Homa
will be built during kernel builds if enabled (it is disabled by
default).

Signed-off-by: John Ousterhout <ouster@cs.stanford.edu>
---
 MAINTAINERS       |  7 +++++++
 net/Kconfig       |  1 +
 net/Makefile      |  1 +
 net/homa/Kconfig  | 19 +++++++++++++++++++
 net/homa/Makefile | 14 ++++++++++++++
 5 files changed, 42 insertions(+)
 create mode 100644 net/homa/Kconfig
 create mode 100644 net/homa/Makefile

Comments

Randy Dunlap Nov. 11, 2024, 11:52 p.m. UTC | #1
Hi John,

On 11/11/24 3:40 PM, John Ousterhout wrote:
> diff --git a/net/homa/Kconfig b/net/homa/Kconfig
> new file mode 100644
> index 000000000000..8ba81b00d35f
> --- /dev/null
> +++ b/net/homa/Kconfig
> @@ -0,0 +1,19 @@
> +# SPDX-License-Identifier: BSD-2-Clause
> +#
> +# Homa transport protocol
> +#
> +
> +menuconfig HOMA
> +	tristate "The Homa transport protocol"
> +	depends on INET
> +	depends on IPV6
> +
> +	help
> +	Homa is a network transport protocol for communication within
> +	a datacenter. It provides significantly lower latency than TCP,
> +	particularly for workloads containing a mixture of large and small
> +	messages operating at high network utilization. For more information
> +	see the homa(7) man page or checkout the Homa Wiki at
> +	https://homa-transport.atlassian.net/wiki/spaces/HOMA/overview.
> +
> +	If unsure, say N.

Kconfig help text should be indented with one tab + 2 spaces, please. (Everything
below the "help" line.) This is in Documentation/process/coding-style.rst.
John Ousterhout Nov. 12, 2024, 12:11 a.m. UTC | #2
Oops, sorry, didn't know that. I'll fix.

-John-


On Mon, Nov 11, 2024 at 3:52 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> Hi John,
>
> On 11/11/24 3:40 PM, John Ousterhout wrote:
> > diff --git a/net/homa/Kconfig b/net/homa/Kconfig
> > new file mode 100644
> > index 000000000000..8ba81b00d35f
> > --- /dev/null
> > +++ b/net/homa/Kconfig
> > @@ -0,0 +1,19 @@
> > +# SPDX-License-Identifier: BSD-2-Clause
> > +#
> > +# Homa transport protocol
> > +#
> > +
> > +menuconfig HOMA
> > +     tristate "The Homa transport protocol"
> > +     depends on INET
> > +     depends on IPV6
> > +
> > +     help
> > +     Homa is a network transport protocol for communication within
> > +     a datacenter. It provides significantly lower latency than TCP,
> > +     particularly for workloads containing a mixture of large and small
> > +     messages operating at high network utilization. For more information
> > +     see the homa(7) man page or checkout the Homa Wiki at
> > +     https://homa-transport.atlassian.net/wiki/spaces/HOMA/overview.
> > +
> > +     If unsure, say N.
>
> Kconfig help text should be indented with one tab + 2 spaces, please. (Everything
> below the "help" line.) This is in Documentation/process/coding-style.rst.
>
> --
> ~Randy
>
kernel test robot Nov. 12, 2024, 9:36 a.m. UTC | #3
Hi John,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/John-Ousterhout/net-homa-define-user-visible-API-for-Homa/20241112-074535
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241111234006.5942-13-ouster%40cs.stanford.edu
patch subject: [PATCH net-next v2 12/12] net: homa: create Makefile and Kconfig
config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20241112/202411121707.Uash8uoM-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411121707.Uash8uoM-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411121707.Uash8uoM-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from ./arch/openrisc/include/generated/asm/div64.h:1,
                    from include/linux/math.h:6,
                    from include/linux/kernel.h:27,
                    from include/linux/cpumask.h:11,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:63,
                    from include/linux/sched.h:2145,
                    from include/linux/audit.h:12,
                    from net/homa/homa_impl.h:12,
                    from net/homa/homa_outgoing.c:7:
   net/homa/homa_outgoing.c: In function 'homa_new_data_packet':
   include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   net/homa/homa_outgoing.c:108:9: note: in expansion of macro 'do_div'
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~
   In file included from include/asm-generic/bug.h:5,
                    from arch/openrisc/include/asm/bug.h:5,
                    from include/linux/bug.h:5,
                    from net/homa/homa_impl.h:10:
   include/asm-generic/div64.h:234:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   net/homa/homa_outgoing.c:108:9: note: in expansion of macro 'do_div'
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~
>> include/asm-generic/div64.h:238:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     238 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    int *
   net/homa/homa_outgoing.c:108:9: note: in expansion of macro 'do_div'
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~
   include/asm-generic/div64.h:213:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~
   net/homa/homa_outgoing.c: In function 'homa_message_out_fill':
   include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   net/homa/homa_outgoing.c:233:9: note: in expansion of macro 'do_div'
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~
   include/asm-generic/div64.h:234:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   net/homa/homa_outgoing.c:233:9: note: in expansion of macro 'do_div'
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~
>> include/asm-generic/div64.h:238:36: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types]
     238 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
         |                                    |
         |                                    int *
   net/homa/homa_outgoing.c:233:9: note: in expansion of macro 'do_div'
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~
   include/asm-generic/div64.h:213:38: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'int *'
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                            ~~~~~~~~~~^~~~~~~~


vim +/__div64_32 +238 include/asm-generic/div64.h

^1da177e4c3f41 Linus Torvalds     2005-04-16  215  
^1da177e4c3f41 Linus Torvalds     2005-04-16  216  /* The unnecessary pointer compare is there
^1da177e4c3f41 Linus Torvalds     2005-04-16  217   * to check for type safety (n must be 64bit)
^1da177e4c3f41 Linus Torvalds     2005-04-16  218   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  219  # define do_div(n,base) ({				\
^1da177e4c3f41 Linus Torvalds     2005-04-16  220  	uint32_t __base = (base);			\
^1da177e4c3f41 Linus Torvalds     2005-04-16  221  	uint32_t __rem;					\
^1da177e4c3f41 Linus Torvalds     2005-04-16  222  	(void)(((typeof((n)) *)0) == ((uint64_t *)0));	\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  223  	if (__builtin_constant_p(__base) &&		\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  224  	    is_power_of_2(__base)) {			\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  225  		__rem = (n) & (__base - 1);		\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  226  		(n) >>= ilog2(__base);			\
c747ce4706190e Geert Uytterhoeven 2021-08-11  227  	} else if (__builtin_constant_p(__base) &&	\
461a5e51060c93 Nicolas Pitre      2015-10-30  228  		   __base != 0) {			\
461a5e51060c93 Nicolas Pitre      2015-10-30  229  		uint32_t __res_lo, __n_lo = (n);	\
461a5e51060c93 Nicolas Pitre      2015-10-30  230  		(n) = __div64_const32(n, __base);	\
461a5e51060c93 Nicolas Pitre      2015-10-30  231  		/* the remainder can be computed with 32-bit regs */ \
461a5e51060c93 Nicolas Pitre      2015-10-30  232  		__res_lo = (n);				\
461a5e51060c93 Nicolas Pitre      2015-10-30  233  		__rem = __n_lo - __res_lo * __base;	\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  234  	} else if (likely(((n) >> 32) == 0)) {		\
^1da177e4c3f41 Linus Torvalds     2005-04-16  235  		__rem = (uint32_t)(n) % __base;		\
^1da177e4c3f41 Linus Torvalds     2005-04-16  236  		(n) = (uint32_t)(n) / __base;		\
c747ce4706190e Geert Uytterhoeven 2021-08-11  237  	} else {					\
^1da177e4c3f41 Linus Torvalds     2005-04-16 @238  		__rem = __div64_32(&(n), __base);	\
c747ce4706190e Geert Uytterhoeven 2021-08-11  239  	}						\
^1da177e4c3f41 Linus Torvalds     2005-04-16  240  	__rem;						\
^1da177e4c3f41 Linus Torvalds     2005-04-16  241   })
^1da177e4c3f41 Linus Torvalds     2005-04-16  242
kernel test robot Nov. 12, 2024, 9:36 a.m. UTC | #4
Hi John,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/John-Ousterhout/net-homa-define-user-visible-API-for-Homa/20241112-074535
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241111234006.5942-13-ouster%40cs.stanford.edu
patch subject: [PATCH net-next v2 12/12] net: homa: create Makefile and Kconfig
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20241112/202411121722.Oxq727h0-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411121722.Oxq727h0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411121722.Oxq727h0-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/mips/include/asm/div64.h:89,
                    from include/linux/math.h:6,
                    from include/linux/kernel.h:27,
                    from include/linux/cpumask.h:11,
                    from arch/mips/include/asm/processor.h:15,
                    from arch/mips/include/asm/thread_info.h:16,
                    from include/linux/thread_info.h:60,
                    from include/asm-generic/current.h:6,
                    from ./arch/mips/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/audit.h:12,
                    from net/homa/homa_impl.h:12,
                    from net/homa/homa_outgoing.c:7:
   net/homa/homa_outgoing.c: In function 'homa_new_data_packet':
>> include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   net/homa/homa_outgoing.c:108:9: note: in expansion of macro 'do_div'
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~
   In file included from arch/mips/include/asm/bug.h:5,
                    from include/linux/bug.h:5,
                    from net/homa/homa_impl.h:10:
>> include/asm-generic/div64.h:234:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   net/homa/homa_outgoing.c:108:9: note: in expansion of macro 'do_div'
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~
   net/homa/homa_outgoing.c: In function 'homa_message_out_fill':
>> include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                                   ^~
   net/homa/homa_outgoing.c:233:9: note: in expansion of macro 'do_div'
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~
>> include/asm-generic/div64.h:234:32: warning: right shift count >= width of type [-Wshift-count-overflow]
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^~
   include/linux/compiler.h:76:45: note: in definition of macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   net/homa/homa_outgoing.c:233:9: note: in expansion of macro 'do_div'
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~


vim +222 include/asm-generic/div64.h

^1da177e4c3f41 Linus Torvalds     2005-04-16  215  
^1da177e4c3f41 Linus Torvalds     2005-04-16  216  /* The unnecessary pointer compare is there
^1da177e4c3f41 Linus Torvalds     2005-04-16  217   * to check for type safety (n must be 64bit)
^1da177e4c3f41 Linus Torvalds     2005-04-16  218   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  219  # define do_div(n,base) ({				\
^1da177e4c3f41 Linus Torvalds     2005-04-16  220  	uint32_t __base = (base);			\
^1da177e4c3f41 Linus Torvalds     2005-04-16  221  	uint32_t __rem;					\
^1da177e4c3f41 Linus Torvalds     2005-04-16 @222  	(void)(((typeof((n)) *)0) == ((uint64_t *)0));	\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  223  	if (__builtin_constant_p(__base) &&		\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  224  	    is_power_of_2(__base)) {			\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  225  		__rem = (n) & (__base - 1);		\
911918aa7ef6f8 Nicolas Pitre      2015-11-02  226  		(n) >>= ilog2(__base);			\
c747ce4706190e Geert Uytterhoeven 2021-08-11  227  	} else if (__builtin_constant_p(__base) &&	\
461a5e51060c93 Nicolas Pitre      2015-10-30  228  		   __base != 0) {			\
461a5e51060c93 Nicolas Pitre      2015-10-30  229  		uint32_t __res_lo, __n_lo = (n);	\
461a5e51060c93 Nicolas Pitre      2015-10-30  230  		(n) = __div64_const32(n, __base);	\
461a5e51060c93 Nicolas Pitre      2015-10-30  231  		/* the remainder can be computed with 32-bit regs */ \
461a5e51060c93 Nicolas Pitre      2015-10-30  232  		__res_lo = (n);				\
461a5e51060c93 Nicolas Pitre      2015-10-30  233  		__rem = __n_lo - __res_lo * __base;	\
911918aa7ef6f8 Nicolas Pitre      2015-11-02 @234  	} else if (likely(((n) >> 32) == 0)) {		\
^1da177e4c3f41 Linus Torvalds     2005-04-16  235  		__rem = (uint32_t)(n) % __base;		\
^1da177e4c3f41 Linus Torvalds     2005-04-16  236  		(n) = (uint32_t)(n) / __base;		\
c747ce4706190e Geert Uytterhoeven 2021-08-11  237  	} else {					\
^1da177e4c3f41 Linus Torvalds     2005-04-16  238  		__rem = __div64_32(&(n), __base);	\
c747ce4706190e Geert Uytterhoeven 2021-08-11  239  	}						\
^1da177e4c3f41 Linus Torvalds     2005-04-16  240  	__rem;						\
^1da177e4c3f41 Linus Torvalds     2005-04-16  241   })
^1da177e4c3f41 Linus Torvalds     2005-04-16  242
kernel test robot Nov. 12, 2024, 11:32 a.m. UTC | #5
Hi John,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/John-Ousterhout/net-homa-define-user-visible-API-for-Homa/20241112-074535
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241111234006.5942-13-ouster%40cs.stanford.edu
patch subject: [PATCH net-next v2 12/12] net: homa: create Makefile and Kconfig
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241112/202411121942.9DAb3SoN-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411121942.9DAb3SoN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411121942.9DAb3SoN-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from net/homa/homa_outgoing.c:7:
   In file included from net/homa/homa_impl.h:12:
   In file included from include/linux/audit.h:13:
   In file included from include/linux/ptrace.h:10:
   In file included from include/linux/pid_namespace.h:7:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from net/homa/homa_outgoing.c:7:
   In file included from net/homa/homa_impl.h:13:
   In file included from include/linux/icmp.h:16:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from net/homa/homa_outgoing.c:7:
   In file included from net/homa/homa_impl.h:13:
   In file included from include/linux/icmp.h:16:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from net/homa/homa_outgoing.c:7:
   In file included from net/homa/homa_impl.h:13:
   In file included from include/linux/icmp.h:16:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> net/homa/homa_outgoing.c:108:2: warning: comparison of distinct pointer types ('typeof ((segs)) *' (aka 'int *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div'
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
>> net/homa/homa_outgoing.c:108:2: error: incompatible pointer types passing 'int *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
     238 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
   include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                                      ^
>> net/homa/homa_outgoing.c:108:2: warning: shift count >= width of type [-Wshift-count-overflow]
     108 |         do_div(segs, max_seg_data);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/div64.h:234:25: note: expanded from macro 'do_div'
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^  ~~
   include/linux/compiler.h:76:40: note: expanded from macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
>> net/homa/homa_outgoing.c:233:2: warning: comparison of distinct pointer types ('typeof ((segs_per_gso)) *' (aka 'int *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div'
     222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
         |                ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
   net/homa/homa_outgoing.c:233:2: error: incompatible pointer types passing 'int *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
     238 |                 __rem = __div64_32(&(n), __base);       \
         |                                    ^~~~
   include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
     213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
         |                                      ^
   net/homa/homa_outgoing.c:233:2: warning: shift count >= width of type [-Wshift-count-overflow]
     233 |         do_div(segs_per_gso, max_seg_data);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/div64.h:234:25: note: expanded from macro 'do_div'
     234 |         } else if (likely(((n) >> 32) == 0)) {          \
         |                                ^  ~~
   include/linux/compiler.h:76:40: note: expanded from macro 'likely'
      76 | # define likely(x)      __builtin_expect(!!(x), 1)
         |                                             ^
   net/homa/homa_outgoing.c:809:6: warning: variable 'checks' set but not used [-Wunused-but-set-variable]
     809 |         int checks = 0;
         |             ^
   12 warnings and 2 errors generated.


vim +108 net/homa/homa_outgoing.c

cb3634a259a2944 John Ousterhout 2024-11-11   78  
cb3634a259a2944 John Ousterhout 2024-11-11   79  /**
cb3634a259a2944 John Ousterhout 2024-11-11   80   * homa_new_data_packet() - Allocate a new sk_buff and fill it with a Homa
cb3634a259a2944 John Ousterhout 2024-11-11   81   * data packet. The resulting packet will be a GSO packet that will eventually
cb3634a259a2944 John Ousterhout 2024-11-11   82   * be segmented by the NIC.
cb3634a259a2944 John Ousterhout 2024-11-11   83   * @rpc:          RPC that packet will belong to (msgout must have been
cb3634a259a2944 John Ousterhout 2024-11-11   84   *                initialized).
cb3634a259a2944 John Ousterhout 2024-11-11   85   * @iter:         Describes location(s) of (remaining) message data in user
cb3634a259a2944 John Ousterhout 2024-11-11   86   *                space.
cb3634a259a2944 John Ousterhout 2024-11-11   87   * @offset:       Offset in the message of the first byte of data in this
cb3634a259a2944 John Ousterhout 2024-11-11   88   *                packet.
cb3634a259a2944 John Ousterhout 2024-11-11   89   * @length:       How many bytes of data to include in the skb. Caller must
cb3634a259a2944 John Ousterhout 2024-11-11   90   *                ensure that this amount of data isn't too much for a
cb3634a259a2944 John Ousterhout 2024-11-11   91   *                well-formed GSO packet, and that iter has at least this
cb3634a259a2944 John Ousterhout 2024-11-11   92   *                much data.
cb3634a259a2944 John Ousterhout 2024-11-11   93   * @max_seg_data: Maximum number of bytes of message data that can go in
cb3634a259a2944 John Ousterhout 2024-11-11   94   *                a single segment of the GSO packet.
cb3634a259a2944 John Ousterhout 2024-11-11   95   * Return: A pointer to the new packet, or a negative errno.
cb3634a259a2944 John Ousterhout 2024-11-11   96   */
cb3634a259a2944 John Ousterhout 2024-11-11   97  struct sk_buff *homa_new_data_packet(struct homa_rpc *rpc,
cb3634a259a2944 John Ousterhout 2024-11-11   98  				     struct iov_iter *iter, int offset,
cb3634a259a2944 John Ousterhout 2024-11-11   99  				     int length, int max_seg_data)
cb3634a259a2944 John Ousterhout 2024-11-11  100  {
cb3634a259a2944 John Ousterhout 2024-11-11  101  	struct homa_skb_info *homa_info;
cb3634a259a2944 John Ousterhout 2024-11-11  102  	int segs, err, gso_size;
cb3634a259a2944 John Ousterhout 2024-11-11  103  	struct data_header *h;
cb3634a259a2944 John Ousterhout 2024-11-11  104  	struct sk_buff *skb;
cb3634a259a2944 John Ousterhout 2024-11-11  105  
cb3634a259a2944 John Ousterhout 2024-11-11  106  	/* Initialize the overall skb. */
cb3634a259a2944 John Ousterhout 2024-11-11  107  	segs = length + max_seg_data - 1;
cb3634a259a2944 John Ousterhout 2024-11-11 @108  	do_div(segs, max_seg_data);
cb3634a259a2944 John Ousterhout 2024-11-11  109  	skb = homa_skb_new_tx(sizeof32(*h) + length
cb3634a259a2944 John Ousterhout 2024-11-11  110  			+ segs * sizeof32(struct seg_header));
cb3634a259a2944 John Ousterhout 2024-11-11  111  	if (!skb)
cb3634a259a2944 John Ousterhout 2024-11-11  112  		return ERR_PTR(-ENOMEM);
cb3634a259a2944 John Ousterhout 2024-11-11  113  
cb3634a259a2944 John Ousterhout 2024-11-11  114  	/* Fill in the Homa header (which will be replicated in every
cb3634a259a2944 John Ousterhout 2024-11-11  115  	 * network packet by GSO).
cb3634a259a2944 John Ousterhout 2024-11-11  116  	 */
cb3634a259a2944 John Ousterhout 2024-11-11  117  	h = (struct data_header *)skb_put(skb, sizeof(struct data_header));
cb3634a259a2944 John Ousterhout 2024-11-11  118  	h->common.sport = htons(rpc->hsk->port);
cb3634a259a2944 John Ousterhout 2024-11-11  119  	h->common.dport = htons(rpc->dport);
cb3634a259a2944 John Ousterhout 2024-11-11  120  	h->common.sequence = htonl(offset);
cb3634a259a2944 John Ousterhout 2024-11-11  121  	h->common.type = DATA;
cb3634a259a2944 John Ousterhout 2024-11-11  122  	homa_set_doff(h, sizeof(struct data_header));
cb3634a259a2944 John Ousterhout 2024-11-11  123  	h->common.checksum = 0;
cb3634a259a2944 John Ousterhout 2024-11-11  124  	h->common.sender_id = cpu_to_be64(rpc->id);
cb3634a259a2944 John Ousterhout 2024-11-11  125  	h->message_length = htonl(rpc->msgout.length);
cb3634a259a2944 John Ousterhout 2024-11-11  126  	h->incoming = h->message_length;
cb3634a259a2944 John Ousterhout 2024-11-11  127  	h->ack.client_id = 0;
cb3634a259a2944 John Ousterhout 2024-11-11  128  	homa_peer_get_acks(rpc->peer, 1, &h->ack);
cb3634a259a2944 John Ousterhout 2024-11-11  129  	h->retransmit = 0;
cb3634a259a2944 John Ousterhout 2024-11-11  130  	h->seg.offset = htonl(offset);
cb3634a259a2944 John Ousterhout 2024-11-11  131  
cb3634a259a2944 John Ousterhout 2024-11-11  132  	homa_info = homa_get_skb_info(skb);
cb3634a259a2944 John Ousterhout 2024-11-11  133  	homa_info->next_skb = NULL;
cb3634a259a2944 John Ousterhout 2024-11-11  134  	homa_info->wire_bytes = length + segs * (sizeof(struct data_header)
cb3634a259a2944 John Ousterhout 2024-11-11  135  			+  rpc->hsk->ip_header_length + HOMA_ETH_OVERHEAD);
cb3634a259a2944 John Ousterhout 2024-11-11  136  	homa_info->data_bytes = length;
cb3634a259a2944 John Ousterhout 2024-11-11  137  	homa_info->seg_length = max_seg_data;
cb3634a259a2944 John Ousterhout 2024-11-11  138  	homa_info->offset = offset;
cb3634a259a2944 John Ousterhout 2024-11-11  139  
cb3634a259a2944 John Ousterhout 2024-11-11  140  	if (segs > 1) {
cb3634a259a2944 John Ousterhout 2024-11-11  141  		homa_set_doff(h, sizeof(struct data_header)  -
cb3634a259a2944 John Ousterhout 2024-11-11  142  				sizeof32(struct seg_header));
cb3634a259a2944 John Ousterhout 2024-11-11  143  		gso_size = max_seg_data + sizeof(struct seg_header);
cb3634a259a2944 John Ousterhout 2024-11-11  144  		err = homa_fill_data_interleaved(rpc, skb, iter);
cb3634a259a2944 John Ousterhout 2024-11-11  145  	} else {
cb3634a259a2944 John Ousterhout 2024-11-11  146  		gso_size = max_seg_data;
cb3634a259a2944 John Ousterhout 2024-11-11  147  		err = homa_skb_append_from_iter(rpc->hsk->homa, skb, iter,
cb3634a259a2944 John Ousterhout 2024-11-11  148  						length);
cb3634a259a2944 John Ousterhout 2024-11-11  149  	}
cb3634a259a2944 John Ousterhout 2024-11-11  150  	if (err)
cb3634a259a2944 John Ousterhout 2024-11-11  151  		goto error;
cb3634a259a2944 John Ousterhout 2024-11-11  152  
cb3634a259a2944 John Ousterhout 2024-11-11  153  	if (segs > 1) {
cb3634a259a2944 John Ousterhout 2024-11-11  154  		skb_shinfo(skb)->gso_segs = segs;
cb3634a259a2944 John Ousterhout 2024-11-11  155  		skb_shinfo(skb)->gso_size = gso_size;
cb3634a259a2944 John Ousterhout 2024-11-11  156  
cb3634a259a2944 John Ousterhout 2024-11-11  157  		/* It's unclear what gso_type should be used to force software
cb3634a259a2944 John Ousterhout 2024-11-11  158  		 * GSO; the value below seems to work...
cb3634a259a2944 John Ousterhout 2024-11-11  159  		 */
cb3634a259a2944 John Ousterhout 2024-11-11  160  		skb_shinfo(skb)->gso_type =
cb3634a259a2944 John Ousterhout 2024-11-11  161  		    rpc->hsk->homa->gso_force_software ? 0xd : SKB_GSO_TCPV6;
cb3634a259a2944 John Ousterhout 2024-11-11  162  	}
cb3634a259a2944 John Ousterhout 2024-11-11  163  	return skb;
cb3634a259a2944 John Ousterhout 2024-11-11  164  
cb3634a259a2944 John Ousterhout 2024-11-11  165  error:
cb3634a259a2944 John Ousterhout 2024-11-11  166  	homa_skb_free_tx(rpc->hsk->homa, skb);
cb3634a259a2944 John Ousterhout 2024-11-11  167  	return ERR_PTR(err);
cb3634a259a2944 John Ousterhout 2024-11-11  168  }
cb3634a259a2944 John Ousterhout 2024-11-11  169  
cb3634a259a2944 John Ousterhout 2024-11-11  170  /**
cb3634a259a2944 John Ousterhout 2024-11-11  171   * homa_message_out_fill() - Initializes information for sending a message
cb3634a259a2944 John Ousterhout 2024-11-11  172   * for an RPC (either request or response); copies the message data from
cb3634a259a2944 John Ousterhout 2024-11-11  173   * user space and (possibly) begins transmitting the message.
cb3634a259a2944 John Ousterhout 2024-11-11  174   * @rpc:     RPC for which to send message; this function must not
cb3634a259a2944 John Ousterhout 2024-11-11  175   *           previously have been called for the RPC. Must be locked. The RPC
cb3634a259a2944 John Ousterhout 2024-11-11  176   *           will be unlocked while copying data, but will be locked again
cb3634a259a2944 John Ousterhout 2024-11-11  177   *           before returning.
cb3634a259a2944 John Ousterhout 2024-11-11  178   * @iter:    Describes location(s) of message data in user space.
cb3634a259a2944 John Ousterhout 2024-11-11  179   * @xmit:    Nonzero means this method should start transmitting packets;
cb3634a259a2944 John Ousterhout 2024-11-11  180   *           transmission will be overlapped with copying from user space.
cb3634a259a2944 John Ousterhout 2024-11-11  181   *           Zero means the caller will initiate transmission after this
cb3634a259a2944 John Ousterhout 2024-11-11  182   *           function returns.
cb3634a259a2944 John Ousterhout 2024-11-11  183   *
cb3634a259a2944 John Ousterhout 2024-11-11  184   * Return:   0 for success, or a negative errno for failure. It is possible
cb3634a259a2944 John Ousterhout 2024-11-11  185   *           for the RPC to be freed while this function is active. If that
cb3634a259a2944 John Ousterhout 2024-11-11  186   *           happens, copying will cease, -EINVAL will be returned, and
cb3634a259a2944 John Ousterhout 2024-11-11  187   *           rpc->state will be RPC_DEAD.
cb3634a259a2944 John Ousterhout 2024-11-11  188   */
cb3634a259a2944 John Ousterhout 2024-11-11  189  int homa_message_out_fill(struct homa_rpc *rpc, struct iov_iter *iter, int xmit)
cb3634a259a2944 John Ousterhout 2024-11-11  190  	__releases(&rpc->bucket->lock)
cb3634a259a2944 John Ousterhout 2024-11-11  191  	__acquires(&rpc->bucket->lock)
cb3634a259a2944 John Ousterhout 2024-11-11  192  {
cb3634a259a2944 John Ousterhout 2024-11-11  193  	/* Geometry information for packets:
cb3634a259a2944 John Ousterhout 2024-11-11  194  	 * mtu:              largest size for an on-the-wire packet (including
cb3634a259a2944 John Ousterhout 2024-11-11  195  	 *                   all headers through IP header, but not Ethernet
cb3634a259a2944 John Ousterhout 2024-11-11  196  	 *                   header).
cb3634a259a2944 John Ousterhout 2024-11-11  197  	 * max_seg_data:     largest amount of Homa message data that fits
cb3634a259a2944 John Ousterhout 2024-11-11  198  	 *                   in an on-the-wire packet (after segmentation).
cb3634a259a2944 John Ousterhout 2024-11-11  199  	 * max_gso_data:     largest amount of Homa message data that fits
cb3634a259a2944 John Ousterhout 2024-11-11  200  	 *                   in a GSO packet (before segmentation).
cb3634a259a2944 John Ousterhout 2024-11-11  201  	 */
cb3634a259a2944 John Ousterhout 2024-11-11  202  	int mtu, max_seg_data, max_gso_data;
cb3634a259a2944 John Ousterhout 2024-11-11  203  
cb3634a259a2944 John Ousterhout 2024-11-11  204  	int overlap_xmit, segs_per_gso;
cb3634a259a2944 John Ousterhout 2024-11-11  205  	struct sk_buff **last_link;
cb3634a259a2944 John Ousterhout 2024-11-11  206  	struct dst_entry *dst;
cb3634a259a2944 John Ousterhout 2024-11-11  207  
cb3634a259a2944 John Ousterhout 2024-11-11  208  	/* Bytes of the message that haven't yet been copied into skbs. */
cb3634a259a2944 John Ousterhout 2024-11-11  209  	int bytes_left;
cb3634a259a2944 John Ousterhout 2024-11-11  210  
cb3634a259a2944 John Ousterhout 2024-11-11  211  	int gso_size;
cb3634a259a2944 John Ousterhout 2024-11-11  212  	int err;
cb3634a259a2944 John Ousterhout 2024-11-11  213  
cb3634a259a2944 John Ousterhout 2024-11-11  214  	homa_message_out_init(rpc, iter->count);
cb3634a259a2944 John Ousterhout 2024-11-11  215  	if (unlikely(rpc->msgout.length > HOMA_MAX_MESSAGE_LENGTH ||
cb3634a259a2944 John Ousterhout 2024-11-11  216  		     rpc->msgout.length == 0)) {
cb3634a259a2944 John Ousterhout 2024-11-11  217  		err = -EINVAL;
cb3634a259a2944 John Ousterhout 2024-11-11  218  		goto error;
cb3634a259a2944 John Ousterhout 2024-11-11  219  	}
cb3634a259a2944 John Ousterhout 2024-11-11  220  
cb3634a259a2944 John Ousterhout 2024-11-11  221  	/* Compute the geometry of packets. */
cb3634a259a2944 John Ousterhout 2024-11-11  222  	dst = homa_get_dst(rpc->peer, rpc->hsk);
cb3634a259a2944 John Ousterhout 2024-11-11  223  	mtu = dst_mtu(dst);
cb3634a259a2944 John Ousterhout 2024-11-11  224  	max_seg_data = mtu - rpc->hsk->ip_header_length
cb3634a259a2944 John Ousterhout 2024-11-11  225  			- sizeof(struct data_header);
cb3634a259a2944 John Ousterhout 2024-11-11  226  	gso_size = dst->dev->gso_max_size;
cb3634a259a2944 John Ousterhout 2024-11-11  227  	if (gso_size > rpc->hsk->homa->max_gso_size)
cb3634a259a2944 John Ousterhout 2024-11-11  228  		gso_size = rpc->hsk->homa->max_gso_size;
cb3634a259a2944 John Ousterhout 2024-11-11  229  
cb3634a259a2944 John Ousterhout 2024-11-11  230  	/* Round gso_size down to an even # of mtus. */
cb3634a259a2944 John Ousterhout 2024-11-11  231  	segs_per_gso = gso_size - rpc->hsk->ip_header_length
cb3634a259a2944 John Ousterhout 2024-11-11  232  			- sizeof(struct data_header);
cb3634a259a2944 John Ousterhout 2024-11-11 @233  	do_div(segs_per_gso, max_seg_data);
cb3634a259a2944 John Ousterhout 2024-11-11  234  	if (segs_per_gso == 0)
cb3634a259a2944 John Ousterhout 2024-11-11  235  		segs_per_gso = 1;
cb3634a259a2944 John Ousterhout 2024-11-11  236  	max_gso_data = segs_per_gso * max_seg_data;
cb3634a259a2944 John Ousterhout 2024-11-11  237  
cb3634a259a2944 John Ousterhout 2024-11-11  238  	overlap_xmit = rpc->msgout.length > 2 * max_gso_data;
cb3634a259a2944 John Ousterhout 2024-11-11  239  	atomic_or(RPC_COPYING_FROM_USER, &rpc->flags);
cb3634a259a2944 John Ousterhout 2024-11-11  240  	homa_skb_stash_pages(rpc->hsk->homa, rpc->msgout.length);
cb3634a259a2944 John Ousterhout 2024-11-11  241  
cb3634a259a2944 John Ousterhout 2024-11-11  242  	/* Each iteration of the loop below creates one GSO packet. */
cb3634a259a2944 John Ousterhout 2024-11-11  243  	last_link = &rpc->msgout.packets;
cb3634a259a2944 John Ousterhout 2024-11-11  244  	for (bytes_left = rpc->msgout.length; bytes_left > 0; ) {
cb3634a259a2944 John Ousterhout 2024-11-11  245  		int skb_data_bytes, offset;
cb3634a259a2944 John Ousterhout 2024-11-11  246  		struct sk_buff *skb;
cb3634a259a2944 John Ousterhout 2024-11-11  247  
cb3634a259a2944 John Ousterhout 2024-11-11  248  		homa_rpc_unlock(rpc);
cb3634a259a2944 John Ousterhout 2024-11-11  249  		skb_data_bytes = max_gso_data;
cb3634a259a2944 John Ousterhout 2024-11-11  250  		offset = rpc->msgout.length - bytes_left;
cb3634a259a2944 John Ousterhout 2024-11-11  251  		if (skb_data_bytes > bytes_left)
cb3634a259a2944 John Ousterhout 2024-11-11  252  			skb_data_bytes = bytes_left;
cb3634a259a2944 John Ousterhout 2024-11-11  253  		skb = homa_new_data_packet(rpc, iter, offset, skb_data_bytes,
cb3634a259a2944 John Ousterhout 2024-11-11  254  					   max_seg_data);
cb3634a259a2944 John Ousterhout 2024-11-11  255  		if (unlikely(!skb)) {
cb3634a259a2944 John Ousterhout 2024-11-11  256  			err = PTR_ERR(skb);
cb3634a259a2944 John Ousterhout 2024-11-11  257  			homa_rpc_lock(rpc, "homa_message_out_fill");
cb3634a259a2944 John Ousterhout 2024-11-11  258  			goto error;
cb3634a259a2944 John Ousterhout 2024-11-11  259  		}
cb3634a259a2944 John Ousterhout 2024-11-11  260  		bytes_left -= skb_data_bytes;
cb3634a259a2944 John Ousterhout 2024-11-11  261  
cb3634a259a2944 John Ousterhout 2024-11-11  262  		homa_rpc_lock(rpc, "homa_message_out_fill2");
cb3634a259a2944 John Ousterhout 2024-11-11  263  		if (rpc->state == RPC_DEAD) {
cb3634a259a2944 John Ousterhout 2024-11-11  264  			/* RPC was freed while we were copying. */
cb3634a259a2944 John Ousterhout 2024-11-11  265  			err = -EINVAL;
cb3634a259a2944 John Ousterhout 2024-11-11  266  			homa_skb_free_tx(rpc->hsk->homa, skb);
cb3634a259a2944 John Ousterhout 2024-11-11  267  			goto error;
cb3634a259a2944 John Ousterhout 2024-11-11  268  		}
cb3634a259a2944 John Ousterhout 2024-11-11  269  		*last_link = skb;
cb3634a259a2944 John Ousterhout 2024-11-11  270  		last_link = &(homa_get_skb_info(skb)->next_skb);
cb3634a259a2944 John Ousterhout 2024-11-11  271  		*last_link = NULL;
cb3634a259a2944 John Ousterhout 2024-11-11  272  		rpc->msgout.num_skbs++;
cb3634a259a2944 John Ousterhout 2024-11-11  273  		rpc->msgout.copied_from_user = rpc->msgout.length - bytes_left;
cb3634a259a2944 John Ousterhout 2024-11-11  274  		if (overlap_xmit && list_empty(&rpc->throttled_links) && xmit)
cb3634a259a2944 John Ousterhout 2024-11-11  275  			homa_add_to_throttled(rpc);
cb3634a259a2944 John Ousterhout 2024-11-11  276  	}
cb3634a259a2944 John Ousterhout 2024-11-11  277  	atomic_andnot(RPC_COPYING_FROM_USER, &rpc->flags);
cb3634a259a2944 John Ousterhout 2024-11-11  278  	if (!overlap_xmit && xmit)
cb3634a259a2944 John Ousterhout 2024-11-11  279  		homa_xmit_data(rpc, false);
cb3634a259a2944 John Ousterhout 2024-11-11  280  	return 0;
cb3634a259a2944 John Ousterhout 2024-11-11  281  
cb3634a259a2944 John Ousterhout 2024-11-11  282  error:
cb3634a259a2944 John Ousterhout 2024-11-11  283  	atomic_andnot(RPC_COPYING_FROM_USER, &rpc->flags);
cb3634a259a2944 John Ousterhout 2024-11-11  284  	return err;
cb3634a259a2944 John Ousterhout 2024-11-11  285  }
cb3634a259a2944 John Ousterhout 2024-11-11  286
kernel test robot Nov. 13, 2024, 1:52 p.m. UTC | #6
Hi John,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/John-Ousterhout/net-homa-define-user-visible-API-for-Homa/20241112-074535
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241111234006.5942-13-ouster%40cs.stanford.edu
patch subject: [PATCH net-next v2 12/12] net: homa: create Makefile and Kconfig
config: riscv-randconfig-r112-20241113 (https://download.01.org/0day-ci/archive/20241113/202411132114.VB5yFmtR-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce: (https://download.01.org/0day-ci/archive/20241113/202411132114.VB5yFmtR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411132114.VB5yFmtR-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> net/homa/homa_sock.c:201:31: sparse: sparse: cast removes address space '__rcu' of expression
   net/homa/homa_sock.c:248:17: sparse: sparse: context imbalance in 'homa_sock_shutdown' - different lock contexts for basic block
   net/homa/homa_sock.c:303:21: sparse: sparse: context imbalance in 'homa_sock_bind' - different lock contexts for basic block

vim +/__rcu +201 net/homa/homa_sock.c

8ddf00265eb650 John Ousterhout 2024-11-11  183  
8ddf00265eb650 John Ousterhout 2024-11-11  184  /*
8ddf00265eb650 John Ousterhout 2024-11-11  185   * homa_sock_unlink() - Unlinks a socket from its socktab and does
8ddf00265eb650 John Ousterhout 2024-11-11  186   * related cleanups. Once this method returns, the socket will not be
8ddf00265eb650 John Ousterhout 2024-11-11  187   * discoverable through the socktab.
8ddf00265eb650 John Ousterhout 2024-11-11  188   */
8ddf00265eb650 John Ousterhout 2024-11-11  189  void homa_sock_unlink(struct homa_sock *hsk)
8ddf00265eb650 John Ousterhout 2024-11-11  190  {
8ddf00265eb650 John Ousterhout 2024-11-11  191  	struct homa_socktab *socktab = hsk->homa->port_map;
8ddf00265eb650 John Ousterhout 2024-11-11  192  	struct homa_socktab_scan *scan;
8ddf00265eb650 John Ousterhout 2024-11-11  193  
8ddf00265eb650 John Ousterhout 2024-11-11  194  	/* If any scans refer to this socket, advance them to refer to
8ddf00265eb650 John Ousterhout 2024-11-11  195  	 * the next socket instead.
8ddf00265eb650 John Ousterhout 2024-11-11  196  	 */
8ddf00265eb650 John Ousterhout 2024-11-11  197  	spin_lock_bh(&socktab->write_lock);
8ddf00265eb650 John Ousterhout 2024-11-11  198  	list_for_each_entry(scan, &socktab->active_scans, scan_links) {
8ddf00265eb650 John Ousterhout 2024-11-11  199  		if (!scan->next || scan->next->sock != hsk)
8ddf00265eb650 John Ousterhout 2024-11-11  200  			continue;
8ddf00265eb650 John Ousterhout 2024-11-11 @201  		scan->next = (struct homa_socktab_links *)hlist_next_rcu(&scan
8ddf00265eb650 John Ousterhout 2024-11-11  202  				->next->hash_links);
8ddf00265eb650 John Ousterhout 2024-11-11  203  	}
8ddf00265eb650 John Ousterhout 2024-11-11  204  	hlist_del_rcu(&hsk->socktab_links.hash_links);
8ddf00265eb650 John Ousterhout 2024-11-11  205  	spin_unlock_bh(&socktab->write_lock);
8ddf00265eb650 John Ousterhout 2024-11-11  206  }
8ddf00265eb650 John Ousterhout 2024-11-11  207
John Ousterhout Nov. 18, 2024, 9:23 p.m. UTC | #7
I believe I have fixed all of the kernel test robot issues reported
under this subject line.

-John-


On Wed, Nov 13, 2024 at 5:53 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi John,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on net-next/main]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/John-Ousterhout/net-homa-define-user-visible-API-for-Homa/20241112-074535
> base:   net-next/main
> patch link:    https://lore.kernel.org/r/20241111234006.5942-13-ouster%40cs.stanford.edu
> patch subject: [PATCH net-next v2 12/12] net: homa: create Makefile and Kconfig
> config: riscv-randconfig-r112-20241113 (https://download.01.org/0day-ci/archive/20241113/202411132114.VB5yFmtR-lkp@intel.com/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
> reproduce: (https://download.01.org/0day-ci/archive/20241113/202411132114.VB5yFmtR-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202411132114.VB5yFmtR-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> >> net/homa/homa_sock.c:201:31: sparse: sparse: cast removes address space '__rcu' of expression
>    net/homa/homa_sock.c:248:17: sparse: sparse: context imbalance in 'homa_sock_shutdown' - different lock contexts for basic block
>    net/homa/homa_sock.c:303:21: sparse: sparse: context imbalance in 'homa_sock_bind' - different lock contexts for basic block
>
> vim +/__rcu +201 net/homa/homa_sock.c
>
> 8ddf00265eb650 John Ousterhout 2024-11-11  183
> 8ddf00265eb650 John Ousterhout 2024-11-11  184  /*
> 8ddf00265eb650 John Ousterhout 2024-11-11  185   * homa_sock_unlink() - Unlinks a socket from its socktab and does
> 8ddf00265eb650 John Ousterhout 2024-11-11  186   * related cleanups. Once this method returns, the socket will not be
> 8ddf00265eb650 John Ousterhout 2024-11-11  187   * discoverable through the socktab.
> 8ddf00265eb650 John Ousterhout 2024-11-11  188   */
> 8ddf00265eb650 John Ousterhout 2024-11-11  189  void homa_sock_unlink(struct homa_sock *hsk)
> 8ddf00265eb650 John Ousterhout 2024-11-11  190  {
> 8ddf00265eb650 John Ousterhout 2024-11-11  191          struct homa_socktab *socktab = hsk->homa->port_map;
> 8ddf00265eb650 John Ousterhout 2024-11-11  192          struct homa_socktab_scan *scan;
> 8ddf00265eb650 John Ousterhout 2024-11-11  193
> 8ddf00265eb650 John Ousterhout 2024-11-11  194          /* If any scans refer to this socket, advance them to refer to
> 8ddf00265eb650 John Ousterhout 2024-11-11  195           * the next socket instead.
> 8ddf00265eb650 John Ousterhout 2024-11-11  196           */
> 8ddf00265eb650 John Ousterhout 2024-11-11  197          spin_lock_bh(&socktab->write_lock);
> 8ddf00265eb650 John Ousterhout 2024-11-11  198          list_for_each_entry(scan, &socktab->active_scans, scan_links) {
> 8ddf00265eb650 John Ousterhout 2024-11-11  199                  if (!scan->next || scan->next->sock != hsk)
> 8ddf00265eb650 John Ousterhout 2024-11-11  200                          continue;
> 8ddf00265eb650 John Ousterhout 2024-11-11 @201                  scan->next = (struct homa_socktab_links *)hlist_next_rcu(&scan
> 8ddf00265eb650 John Ousterhout 2024-11-11  202                                  ->next->hash_links);
> 8ddf00265eb650 John Ousterhout 2024-11-11  203          }
> 8ddf00265eb650 John Ousterhout 2024-11-11  204          hlist_del_rcu(&hsk->socktab_links.hash_links);
> 8ddf00265eb650 John Ousterhout 2024-11-11  205          spin_unlock_bh(&socktab->write_lock);
> 8ddf00265eb650 John Ousterhout 2024-11-11  206  }
> 8ddf00265eb650 John Ousterhout 2024-11-11  207
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 1389704c7d8d..935d1e995018 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10391,6 +10391,13 @@  F:	lib/test_hmm*
 F:	mm/hmm*
 F:	tools/testing/selftests/mm/*hmm*
 
+HOMA TRANSPORT PROTOCOL
+M:	John Ousterhout <ouster@cs.stanford.edu>
+S:	Maintained
+W:	https://homa-transport.atlassian.net/wiki/spaces/HOMA/overview
+F:	include/uapi/linux/homa.h
+F:	net/homa/
+
 HONEYWELL HSC030PA PRESSURE SENSOR SERIES IIO DRIVER
 M:	Petre Rodan <petre.rodan@subdimension.ro>
 L:	linux-iio@vger.kernel.org
diff --git a/net/Kconfig b/net/Kconfig
index a629f92dc86b..ca8551c1a226 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -244,6 +244,7 @@  endif
 
 source "net/dccp/Kconfig"
 source "net/sctp/Kconfig"
+source "net/homa/Kconfig"
 source "net/rds/Kconfig"
 source "net/tipc/Kconfig"
 source "net/atm/Kconfig"
diff --git a/net/Makefile b/net/Makefile
index 65bb8c72a35e..18fa3c323187 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -44,6 +44,7 @@  obj-y				+= 8021q/
 endif
 obj-$(CONFIG_IP_DCCP)		+= dccp/
 obj-$(CONFIG_IP_SCTP)		+= sctp/
+obj-$(CONFIG_HOMA)              += homa/
 obj-$(CONFIG_RDS)		+= rds/
 obj-$(CONFIG_WIRELESS)		+= wireless/
 obj-$(CONFIG_MAC80211)		+= mac80211/
diff --git a/net/homa/Kconfig b/net/homa/Kconfig
new file mode 100644
index 000000000000..8ba81b00d35f
--- /dev/null
+++ b/net/homa/Kconfig
@@ -0,0 +1,19 @@ 
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Homa transport protocol
+#
+
+menuconfig HOMA
+	tristate "The Homa transport protocol"
+	depends on INET
+	depends on IPV6
+
+	help
+	Homa is a network transport protocol for communication within
+	a datacenter. It provides significantly lower latency than TCP,
+	particularly for workloads containing a mixture of large and small
+	messages operating at high network utilization. For more information
+	see the homa(7) man page or checkout the Homa Wiki at
+	https://homa-transport.atlassian.net/wiki/spaces/HOMA/overview.
+
+	If unsure, say N.
diff --git a/net/homa/Makefile b/net/homa/Makefile
new file mode 100644
index 000000000000..3eb192a6ffa6
--- /dev/null
+++ b/net/homa/Makefile
@@ -0,0 +1,14 @@ 
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Makefile for the Linux implementation of the Homa transport protocol.
+
+obj-$(CONFIG_HOMA) := homa.o
+homa-y:=        homa_incoming.o \
+		homa_outgoing.o \
+		homa_peer.o \
+		homa_pool.o \
+		homa_plumbing.o \
+		homa_rpc.o \
+		homa_sock.o \
+		homa_timer.o \
+		homa_utils.o