Build kernel module against kernel version 5.8.x

112 views
Skip to first unread message

Bharat Kunwar

unread,
May 4, 2021, 5:37:40 PM5/4/21
to beegfs-user
Hi all,

I am trying to build BeeGFS kernel module against 5.8.x version of kernel and am getting lots of errors about timespec64_trunc being unavailable. I went down the rabbit hole of trying to replace this with timestamp_truncate but that didn't help either. Has anyone figured out a way to crack this?

Thanks

Bharat

Toby Darling

unread,
May 5, 2021, 5:07:00 AM5/5/21
to fhgfs...@googlegroups.com
Hi Bharat

Don't know what version of beegfs you're trying to build, but I patched
some timespec64 stuff to build 7.1.4 on kernel 5.6. Might give you a
starting point: https://github.com/tobydarling/beegfs-7.1.4-kernel-5.6.4

Cheers
Toby
> --
> You received this message because you are subscribed to the Google
> Groups "beegfs-user" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fhgfs-user+...@googlegroups.com
> <mailto:fhgfs-user+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fhgfs-user/cdfba6c3-2206-4689-9989-672395a3edb9n%40googlegroups.com
> <https://groups.google.com/d/msgid/fhgfs-user/cdfba6c3-2206-4689-9989-672395a3edb9n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Toby Darling, Scientific Computing (2N249)
MRC Laboratory of Molecular Biology
https://www.mrc-lmb.cam.ac.uk/scicomp/
Message has been deleted

Bharat Kunwar

unread,
May 6, 2021, 10:02:29 AM5/6/21
to beegfs-user
With 5.8.x kernel, it fails with the following error:

/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/ibv/IBVSocket.c: In function '__IBVSocket_cmaHandler':
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/ibv/IBVSocket.c:1644:10: error: too few arguments to function 'rdma_reject'
 1644 |          rdma_reject(cm_id, NULL, 0);
      |          ^~~~~~~~~~~
In file included from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/ibv/IBVBuffer.h:7,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/ibv/IBVSocket.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/ibv/IBVSocket.c:1:
./include/rdma/rdma_cm.h:322:5: note: declared here
  322 | int rdma_reject(struct rdma_cm_id *id, const void *private_data,
      |     ^~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:281: /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/ibv/IBVSocket.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c: In function 'sock_readable':
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:65:27: error: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Werror]
   65 |    if (__sock_has_sleeper(wq))
      |                           ^~
      |                           |
      |                           struct socket_wq *
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:30:49: note: in definition of macro '__sock_has_sleeper'
   30 | # define __sock_has_sleeper(wq) (wq_has_sleeper(wq))
      |                                                 ^~
In file included from ./include/linux/mmzone.h:10,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/umh.h:4,
                 from ./include/linux/kmod.h:9,
                 from ./include/linux/module.h:16,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/Common.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/toolkit/StringTk.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.h:5,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:1:
./include/linux/wait.h:151:59: note: expected 'struct wait_queue_head *' but argument is of type 'struct socket_wq *'
  151 | static inline bool wq_has_sleeper(struct wait_queue_head *wq_head)
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c: In function 'sock_write_space':
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:95:27: error: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Werror]
   95 |    if (__sock_has_sleeper(wq))
      |                           ^~
      |                           |
      |                           struct socket_wq *
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:30:49: note: in definition of macro '__sock_has_sleeper'
   30 | # define __sock_has_sleeper(wq) (wq_has_sleeper(wq))
      |                                                 ^~
In file included from ./include/linux/mmzone.h:10,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/umh.h:4,
                 from ./include/linux/kmod.h:9,
                 from ./include/linux/module.h:16,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/Common.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/toolkit/StringTk.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.h:5,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:1:
./include/linux/wait.h:151:59: note: expected 'struct wait_queue_head *' but argument is of type 'struct socket_wq *'
  151 | static inline bool wq_has_sleeper(struct wait_queue_head *wq_head)
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c: In function 'sock_wakeup':
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:115:27: error: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Werro]
  115 |    if (__sock_has_sleeper(wq))
      |                           ^~
      |                           |
      |                           struct socket_wq *
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:30:49: note: in definition of macro '__sock_has_sleeper'
   30 | # define __sock_has_sleeper(wq) (wq_has_sleeper(wq))
      |                                                 ^~
In file included from ./include/linux/mmzone.h:10,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/umh.h:4,
                 from ./include/linux/kmod.h:9,
                 from ./include/linux/module.h:16,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/Common.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/toolkit/StringTk.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.h:5,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:1:
./include/linux/wait.h:151:59: note: expected 'struct wait_queue_head *' but argument is of type 'struct socket_wq *'
  151 | static inline bool wq_has_sleeper(struct wait_queue_head *wq_head)
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c: In function 'sock_error_report':
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:134:27: error: passing argument 1 of 'wq_has_sleeper' from incompatible pointer type [-Werro]
  134 |    if (__sock_has_sleeper(wq))
      |                           ^~
      |                           |
      |                           struct socket_wq *
/opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:30:49: note: in definition of macro '__sock_has_sleeper'
   30 | # define __sock_has_sleeper(wq) (wq_has_sleeper(wq))
      |                                                 ^~
In file included from ./include/linux/mmzone.h:10,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/umh.h:4,
                 from ./include/linux/kmod.h:9,
                 from ./include/linux/module.h:16,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/Common.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/toolkit/StringTk.h:4,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.h:5,
                 from /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.c:1:
./include/linux/wait.h:151:59: note: expected 'struct wait_queue_head *' but argument is of type 'struct socket_wq *'
  151 | static inline bool wq_has_sleeper(struct wait_queue_head *wq_head)
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:280: /opt/beegfs/src/client/client_module_7/build/../source/common/net/sock/StandardSocket.o] Error 1
make[2]: *** [Makefile:1752: /opt/beegfs/src/client/client_module_7/build/../source] Error 2
make[1]: *** [Makefile:137: module] Error 2
make: *** [AutoRebuild.mk:34: auto_rebuild] Error 2

On Thursday, May 6, 2021 at 11:01:51 AM UTC+1 Bharat Kunwar wrote:
Hi Toby

I could not apply your patch cleanly to 5.8.x but it compiled successfully with 5.6.14-300.fc32.x86_64.

I also found a small bug in your diff.

```
diff -ru -X diff-ignore orig/source/common/Common.h client_module_7/source/common/Common.h
--- orig/source/common/Common.h 2020-04-15 15:06:50.720271730 +0100
+++ client_module_7/source/common/Common.h 2020-04-15 17:13:54.943177923 +0100
@@ -152,15 +152,15 @@
 #endif

 #if defined(KERNEL_HAS_64BIT_TIMESTAMPS)
-static inline struct timespec64 current_fs_time(struct super_block *sb)
+static inline struct timespec64 current_fs_time(struct inode *inode)
 {
-   struct timespec64 now = current_kernel_time64();
-   return timespec64_trunc(now, sb->s_time_gran);
+   struct timespec64 now; ktime_get_coarse_real_ts64(&now);
+   return timestamp_truncate(now, inode);
 }
 #elif !defined(KERNEL_HAS_CURRENT_FS_TIME)
-static inline struct timespec current_fs_time(struct super_block *sb)
+static inline struct timespec64 current_fs_time(struct inode *inode)
 {
    struct timespec now = current_kernel_time();
-   return timespec_trunc(now, sb->s_time_gran);
+   return timespec_trunc(now, inode->i_sb->s_time_gran);
 }
 #endif
```

Bharat Kunwar

unread,
May 6, 2021, 10:04:25 AM5/6/21
to beegfs-user
I found a small bug in your hunk (notably the reference to sb in return timespec_trunc(now, sb->s_time_gran);) which can be fixed as follows:

diff -ru -X diff-ignore orig/source/common/Common.h client_module_7/source/common/Common.h
--- orig/source/common/Common.h 2020-04-15 15:06:50.720271730 +0100
+++ client_module_7/source/common/Common.h 2020-04-15 17:13:54.943177923 +0100
@@ -152,15 +152,15 @@
 #endif

 #if defined(KERNEL_HAS_64BIT_TIMESTAMPS)
-static inline struct timespec64 current_fs_time(struct super_block *sb)
+static inline struct timespec64 current_fs_time(struct inode *inode)
 {
-   struct timespec64 now = current_kernel_time64();
-   return timespec64_trunc(now, sb->s_time_gran);
+   struct timespec64 now; ktime_get_coarse_real_ts64(&now);
+   return timestamp_truncate(now, inode);
 }
 #elif !defined(KERNEL_HAS_CURRENT_FS_TIME)
-static inline struct timespec current_fs_time(struct super_block *sb)
+static inline struct timespec64 current_fs_time(struct inode *inode)
 {
    struct timespec now = current_kernel_time();
-   return timespec_trunc(now, sb->s_time_gran);
+   return timespec_trunc(now, inode->i_sb->s_time_gran);
 }
 #endif

Reply all
Reply to author
Forward
0 new messages