CachyOS / kernel-patches

Custom Linux kernel patches
140 stars 20 forks source link

problem compiling 6.6.20 #50

Closed dim-geo closed 8 months ago

dim-geo commented 8 months ago

Gentoo use here, try to compile 6.6.20 from genkernel patches + cachyos patches, it fails with:

In file included from ./include/linux/list.h:9,
                 from ./include/linux/swait.h:5,
                 from ./include/linux/completion.h:12,
                 from ./include/linux/crypto.h:15,
                 from ./include/crypto/hash.h:12,
                 from net/ipv4/tcp.c:246:
net/ipv4/tcp.c: In function 'tcp_get_info':
net/ipv4/tcp.c:3792:47: error: implicit declaration of function 'tcp_delack_max' [-Werror=implicit-function-declaration]
 3792 |                                               tcp_delack_max(sk)));
      |                                               ^~~~~~~~~~~~~~
./include/linux/const.h:12:55: note: in definition of macro '__is_constexpr'
   12 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
      |                                                       ^
./include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp'
   85 | #define min(x, y)       __careful_cmp(min, x, y)
      |                         ^~~~~~~~~~~~~
net/ipv4/tcp.c:3791:43: note: in expansion of macro 'min'
 3791 |         info->tcpi_ato = jiffies_to_usecs(min(icsk->icsk_ack.ato,
      |                                           ^~~
In file included from ./include/linux/atomic/atomic-instrumented.h:15,
                 from ./include/linux/atomic.h:82,
                 from ./include/crypto/hash.h:11:
./include/linux/build_bug.h:78:41: error: static assertion failed: "min(icsk->icsk_ack.ato, tcp_delack_max(sk)) signedness error, fix types or consider umin() before min_t()"
   78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
      |                                         ^~~~~~~~~~~~~~
./include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
   77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
      |                                  ^~~~~~~~~~~~~~~
./include/linux/minmax.h:51:9: note: in expansion of macro 'static_assert'
   51 |         static_assert(__types_ok(x, y),                 \
      |         ^~~~~~~~~~~~~
./include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once'
   58 |                 __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
      |                 ^~~~~~~~~~
./include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp'
   85 | #define min(x, y)       __careful_cmp(min, x, y)
      |                         ^~~~~~~~~~~~~
net/ipv4/tcp.c:3791:43: note: in expansion of macro 'min'
 3791 |         info->tcpi_ato = jiffies_to_usecs(min(icsk->icsk_ack.ato,
      |                                           ^~~
  CC      lib/sg_pool.o
cc1: some warnings being treated as errors

I think this patch line is to blame:

https://github.com/CachyOS/kernel-patches/blob/c3f02a81e5f68c62958237e6cbc336f31dbd3c71/6.6/all/0001-cachyos-base-all.patch#L3865

Relavant code in tcp.c after patching:

        if (tp->rx_opt.tstamp_ok)
                info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
        if (tcp_is_sack(tp))
                info->tcpi_options |= TCPI_OPT_SACK;
        if (tp->rx_opt.wscale_ok) {
                info->tcpi_options |= TCPI_OPT_WSCALE;
                info->tcpi_snd_wscale = tp->rx_opt.snd_wscale;
                info->tcpi_rcv_wscale = tp->rx_opt.rcv_wscale;
        }

        if (tp->ecn_flags & TCP_ECN_OK)
                info->tcpi_options |= TCPI_OPT_ECN;
        if (tp->ecn_flags & TCP_ECN_SEEN)
                info->tcpi_options |= TCPI_OPT_ECN_SEEN;
        if (tp->ecn_flags & TCP_ECN_LOW)
                info->tcpi_options |= TCPI_OPT_ECN_LOW;
        if (tp->syn_data_acked)
                info->tcpi_options |= TCPI_OPT_SYN_DATA;

        info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto);
        info->tcpi_ato = jiffies_to_usecs(min(icsk->icsk_ack.ato,
                                              tcp_delack_max(sk)));
        info->tcpi_snd_mss = tp->mss_cache;
        info->tcpi_rcv_mss = icsk->icsk_ack.rcv_mss;

        info->tcpi_unacked = tp->packets_out;
        info->tcpi_sacked = tp->sacked_out;
ptr1337 commented 8 months ago

Fixed it for now removing bbr3. Need to look for a solution in the future.

dim-geo commented 8 months ago

BTW, when I removed the faulty line above (I added actually the missing line from tcp.h), kernel compiled,booted and connected to internet successfully.

If you want, xanmod's bbrv3 apply cleanly as well.

https://gitlab.com/xanmod/linux-patches/-/tree/master/linux-6.6.y-xanmod/net/tcp/bbr3?ref_type=heads