VirtualBox

Ticket #19845 (closed defect: fixed)

Opened 2 months ago

Last modified 7 days ago

Linux kernel version 5.9 - we need changes

Reported by: burdi01 Owned by:
Component: other Version: VirtualBox 6.1.10
Keywords: linux kernel 5.9 Cc:
Guest type: Linux Host type: Linux

Description

Stock kernel 5.9-rc3 on Slackware Current64:
-- VirtualBox-6.1.13-140124-Linux_amd64.run with Oracle_VM_VirtualBox_Extension_Pack-6.1.13-140124.vbox-extpack: build failure

I know this is early in the cycle :)

Attachments

vbox-setup.log Download (43.7 KB) - added by burdi01 2 months ago.
vbox-setup.log.new Download (159.5 KB) - added by burdi01 4 weeks ago.
59-diffs.txt Download (7.1 KB) - added by fbatschu 4 weeks ago.
for 5.9-rc7 59-diffs-29092020.txt

Change History

Changed 2 months ago by burdi01

comment:1 Changed 8 weeks ago by burdi01

From the above vbox-setup.log:

In file included from /tmp/vbox.0/linux/SUPDrv-linux.c:33:[[BR]] /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:141:11: fatal error: linux/smp_lock.h: No such file or directory

comment:2 Changed 8 weeks ago by fbatschu

using:  https://git.kernel.org/torvalds/t/linux-5.9-rc3.tar.gz

1) smp_lock.h issue:

$kmk KERN_VER=linux-5.9-rc3 KERN_DIR=/home/ws/linux-5.9-rc3

In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/VBoxGuest-linux.c:36:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:141:11: fatal error: linux/smp_lock.h: No such file or directory
 # include <linux/smp_lock.h>
           ^~~~~~~~~~~~~~~~~~

$ cd out/linux.amd64/debug/bin/src
$ kmk KERN_VER=linux-5.9-rc3 KERN_DIR=/home/ws/linux-5.9-rc3
=== Building 'vboxdrv' module ===
kmk[1]: Entering directory '/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv'
/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Makefile-header.gmk:128: Using VBOX_KBUILD_TYPE='debug' from the environment (KBUILD_TYPE).
kmk V= CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /home/ws/linux-5.9-rc3 M=/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv SRCROOT=/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv -j4 modules
kmk[2]: Entering directory '/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv'
kmk[2]: warning: -jN forced in submake: disabling jobserver mode.
kmk[3]: Entering directory '/home/ws/linux-5.9-rc3'
/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Makefile-header.gmk:128: Using VBOX_KBUILD_TYPE='debug' from the environment (KBUILD_TYPE).
  CC [M]  /home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/SUPDrvSem.o
  CC [M]  /home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/linux/SUPDrv-linux.o
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/linux/SUPDrv-linux.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/r0drv/linux/the-linux-kernel.h:141:11: fatal error: linux/smp_lock.h: No such file or directory
 # include <linux/smp_lock.h>
           ^~~~~~~~~~~~~~~~~~
compilation terminated.

Files #including this file: smp_lock.h

  File               Line
0 the-linux-kernel.h 141 #include <linux/smp_lock.h>

from trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h

140 #ifndef HAVE_UNLOCKED_IOCTL /* linux/fs.h defines this */                                                                          
141 # include <linux/smp_lock.h>                                                                                                       
142 #endif 

"linux/smp_lock.h" is the header file for the "Big Kernel Lock",

which as such no longer exists after Linux kernel version 2.6.39.

 https://elixir.bootlin.com/linux/v2.6.38/source/include/linux/smp_lock.h

 https://elixir.bootlin.com/linux/v2.6.38/source/include/linux/fs.h

/* These macros are for out of kernel modules to test that
 * the kernel supports the unlocked_ioctl and compat_ioctl
 * fields in struct file_operations. */
#define HAVE_COMPAT_IOCTL 1
#define HAVE_UNLOCKED_IOCTL 1

smp_lock.h has been removed in Linux kernel version 2.6.39 but the HAVE_UNLOCKED_IOCTL is still there in 2.6.39, 3.19, 4.20.17 and 5.8.5 b ut is finally removed in 5.9-rc1 with commit:

 https://www.spinics.net/lists/linux-block/msg57152.html
 https://patchwork.kernel.org/patch/11696859/

     fs: remove the HAVE_UNLOCKED_IOCTL and HAVE_COMPAT_IOCTL defines

comment:3 Changed 8 weeks ago by fbatschu

  • Host type changed from other to Linux
  • Guest type changed from other to Linux

comment:4 Changed 8 weeks ago by fbatschu

after fixing issue 1) we find issue 2)

2) HAVE_UNLOCKED_IOCTL removed from linux/fs.h

We have a lot of places throughout the code base that make use of HAVE_UNLOCKED_IOCTL on Linux to decided how the struct 'file_operations" is defined. Those fail now since 5.9 removed it, yet its meaning as such remains valid. to fix both we can do:

VBox/Trunk fbatschu@lserver trunk $ svn diff
Index: src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
===================================================================
--- src/VBox/Runtime/r0drv/linux/the-linux-kernel.h	(revision 140172)
+++ src/VBox/Runtime/r0drv/linux/the-linux-kernel.h	(working copy)
@@ -137,7 +137,11 @@
 #include <linux/interrupt.h>
 #include <linux/completion.h>
 #include <linux/compiler.h>
-#ifndef HAVE_UNLOCKED_IOCTL /* linux/fs.h defines this */
+/* linux/fs.h defines HAVE_UNLOCKED_IOCTL from 2.6.11 till 5.9, but its meaning remains valid */
+#if RTLNX_VER_MIN(5,9,0)
+# define HAVE_UNLOCKED_IOCTL 1
+#endif
+#if !defined(HAVE_UNLOCKED_IOCTL) && RTLNX_VER_MAX(2,6,38)
 # include <linux/smp_lock.h>
 #endif
 /* For the shared folders module */

comment:5 Changed 8 weeks ago by fbatschu

next issue

3) get_user_pages_remote() changed in Linux kernel version 5.9

'get_user_pages_remote()' API doesn't get 'struct task_struct' parameter after:

commit 64019a2e467a ("mm/gup: remove task_struct pointer for all gup code")  https://lkml.kernel.org/lkml/20200630204609.39736-1-peterx@redhat.com/T/

and we fail like this

In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeLockUser’:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1184:33: error: passing argument 1 of ‘get_user_pages_remote’ from incompatible pointer type [-Werror=incompatible-pointer-types]
                                 pTask,                  /* Task for fault accounting. */
                                 ^~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:102:0,
                 from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:28:
./include/linux/mm.h:1712:6: note: expected ‘struct mm_struct *’ but argument is of type ‘struct task_struct *’
 long get_user_pages_remote(struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1185:33: error: passing argument 2 of ‘get_user_pages_remote’ makes integer from pointer without a cast [-Werror=int-conversion]
                                 pTask->mm,              /* Whose pages. */
                                 ^~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:102:0,
                 from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:28:
./include/linux/mm.h:1712:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
 long get_user_pages_remote(struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1189:33: error: passing argument 5 of ‘get_user_pages_remote’ makes pointer from integer without a cast [-Werror=int-conversion]
                                 fWrite ? FOLL_WRITE |   /* Write to memory. */
                                 ^~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:102:0,
                 from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:28:
./include/linux/mm.h:1712:6: note: expected ‘struct page **’ but argument is of type ‘int’
 long get_user_pages_remote(struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1196:33: error: passing argument 6 of ‘get_user_pages_remote’ from incompatible pointer type [-Werror=incompatible-pointer-types]
                                 &pMemLnx->apPages[0],   /* Page array. */
                                 ^
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:102:0,
                 from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:28:
./include/linux/mm.h:1712:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘struct page **’
 long get_user_pages_remote(struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1197:33: error: passing argument 7 of ‘get_user_pages_remote’ from incompatible pointer type [-Werror=incompatible-pointer-types]
                                 papVMAs                 /* vmas */
                                 ^~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:102:0,
                 from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:28:
./include/linux/mm.h:1712:6: note: expected ‘int *’ but argument is of type ‘struct vm_area_struct **’
 long get_user_pages_remote(struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:33:0:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/memobj-r0drv-linux.c:1183:18: error: too many arguments to function ‘get_user_pages_remote’
             rc = get_user_pages_remote(
                  ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/r0drv/linux/the-linux-kernel.h:102:0,
                 from /home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxguest-src_mod/combined-os-specific.c:28:
./include/linux/mm.h:1712:6: note: declared here
 long get_user_pages_remote(struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~

{ https://elixir.bootlin.com/linux/v5.9-rc1/source/include/linux/mm.h#L1707][[BR]]

long get_user_pages_remote(struct mm_struct *mm,
			    unsigned long start, unsigned long nr_pages,
			    unsigned int gup_flags, struct page **pages,
			    struct vm_area_struct **vmas, int *locked);

 https://elixir.bootlin.com/linux/v5.8.5/source/include/linux/mm.h#L1694

long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
			    unsigned long start, unsigned long nr_pages,
			    unsigned int gup_flags, struct page **pages,
			    struct vm_area_struct **vmas, int *locked);

=> 1st arg struct task_struct *tsk removed

trunk $ svn diff
Index: src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
===================================================================
--- src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(revision 140172)
+++ src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(working copy)
@@ -1181,7 +1181,9 @@
          */
         else
             rc = get_user_pages_remote(
+# if GET_USER_PAGES_API < KERNEL_VERSION(5, 9, 0)
                                 pTask,                  /* Task for fault accounting. */
+# endif
                                 pTask->mm,              /* Whose pages. */
                                 R3Ptr,                  /* Where from. */
                                 cPages,                 /* How many pages. */
Index: src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
===================================================================
--- src/VBox/Runtime/r0drv/linux/the-linux-kernel.h	(revision 140172)
+++ src/VBox/Runtime/r0drv/linux/the-linux-kernel.h	(working copy)
@@ -137,7 +137,11 @@
 #include <linux/interrupt.h>
 #include <linux/completion.h>
 #include <linux/compiler.h>
-#ifndef HAVE_UNLOCKED_IOCTL /* linux/fs.h defines this */
+/* linux/fs.h defines HAVE_UNLOCKED_IOCTL from 2.6.11 till 5.9, but its meaning remains valid */
+#if RTLNX_VER_MIN(5,9,0)
+# define HAVE_UNLOCKED_IOCTL 1
+#endif
+#if !defined(HAVE_UNLOCKED_IOCTL) && RTLNX_VER_MAX(2,6,38)
 # include <linux/smp_lock.h>
 #endif
 /* For the shared folders module */
Last edited 8 weeks ago by fbatschu (previous) (diff)

comment:6 Changed 8 weeks ago by fbatschu

next issue:

4) sched_setscheduler() has been unexported

Subject PATCH 22/23 sched: Remove sched_setscheduler*() EXPORTs
 https://lkml.org/lkml/2020/4/22/1071
 https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=616d91b68cd56bcb1954b6a5af7d542401fde772
 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d2b84a4e5b954bd2587e06c29577256f59e0030

I.e. no more EXPORT_SYMBOL_GPL(sched_setscheduler) available with 5.9-rc1

and is thus no longer available to us in 5.9, typical failure mode while building the vboxdrv module:

/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Makefile-header.gmk:128: Using VBOX_KBUILD_TYPE='debug' from the environment (KBUILD_TYPE).
kmk[3]: *** Deleting file '/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Module.symvers'
  MODPOST /home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Module.symvers
ERROR: modpost: "sched_setscheduler" [/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/vboxdrv.ko] undefined!
kmk[3]: *** [scripts/Makefile.modpost:111: /home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Module.symvers] Error 1
kmk[3]: Leaving directory '/home/ws/linux-5.9-rc3'
kmk[2]: *** [Makefile:1701: modules] Error 2
kmk[2]: Leaving directory '/home/ws/linux-5.9-rc3'
kmk[1]: *** [/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/Makefile-footer.gmk:117: vboxdrv] Error 2
kmk[1]: Leaving directory '/home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv'
kmk: *** [Makefile:60: vboxdrv] Error 2

$ nm /home/ws/vb/trunk/out/linux.amd64/debug/bin/src/vboxdrv/vboxdrv.o|grep setscheduler
                 U sched_setscheduler

sched_setscheduler() is a problem in: trunk/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c

thread2-r0drv-linux.c rtThreadNativeSetPriority  95 sched_setscheduler(current, iSchedClass, &Param);

where we attempt to set scheduling priorities for our kernel threads. We do this for 2 scheduling classes, SCHED_NORMAL and SCHED_FIFO.

For the SCHED_FIFO case in this code, we should use instead the new sched_set_fifo() and sched_set_fifo_low() interfaces. However in general SCHED_FIFO is discouraged and we probably should drop that in the longer run. For the rest of the cases of SCHED_NORMAL we should probably use sched_set_normal() and set a nice value instead of the current priority for sched_setscheduler().

Eg something like this is a start and with that, no more other failures crop up with 5.9-rc3

Index: src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
===================================================================
--- src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c	(revision 140198)
+++ src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c	(working copy)
@@ -78,13 +78,21 @@
             break;
 
         case RTTHREADTYPE_IO:
+/* Set maximum priority to preempt all other threads on this CPU. */
+# if RTLNX_VER_MAX(5,9,0)
             iSchedClass = SCHED_FIFO;
             Param.sched_priority = MAX_RT_PRIO - 1;
+# else 
+/* Effectively changes prio from 99 to 50 */ 
+            sched_set_fifo(current);
+# endif
             break;
 
         case RTTHREADTYPE_TIMER:
+# if RTLNX_VER_MAX(5,9,0)
             iSchedClass = SCHED_FIFO;
             Param.sched_priority = 1; /* not 0 just in case */
+# else
+            sched_set_fifo_low(current);
+# endif
             break;
 
         default:
@@ -91,8 +99,13 @@
             AssertMsgFailed(("enmType=%d\n", enmType));
             return VERR_INVALID_PARAMETER;
     }
-
+# if RTLNX_VER_MAX(5,9,0)
     sched_setscheduler(current, iSchedClass, &Param);
+# else
+/* XXX handle SCHED_NORMAL case! */
+     RT_NOREF_PV(iSchedClass);
+     RT_NOREF_PV(Param);
+# endif
 #else
     RT_NOREF_PV(enmType);
 #endif
Last edited 8 weeks ago by fbatschu (previous) (diff)

comment:7 Changed 8 weeks ago by fbatschu

  • Owner set to fbatschu
  • Status changed from new to accepted

comment:8 Changed 8 weeks ago by burdi01

Stock kernel 5.9-rc3 on Slackware Current64:
-- VirtualBox-6.1.13-140124-Linux_amd64.run with Oracle_VM_VirtualBox_Extension_Pack-6.1.13-140124.vbox-extpack:
After applying the 59-diffs.txt patch and copying the vboxdrv/r0drv/linux/the-linux-kernel.h file to vboxnet{adp,flt}/r0drv/linux/ the host kernel modules built without a problem and my (non-guest-additions) guests run OK.
:D

Last edited 7 weeks ago by burdi01 (previous) (diff)

comment:9 Changed 7 weeks ago by burdi01

Stock kernel 5.9-rc3 on Slackware Current64:
-- VirtualBox-6.1.14-140239-Linux_amd64.run with Oracle_VM_VirtualBox_Extension_Pack-6.1.14-140239.vbox-extpack:
After applying the 59-diffs.txt patch and copying the vboxdrv/r0drv/linux/the-linux-kernel.h file to vboxnet{adp,flt}/r0drv/linux/ the host kernel modules built without a problem and my (non-guest-additions) guests run OK.
:D

Last edited 7 weeks ago by burdi01 (previous) (diff)

comment:10 Changed 7 weeks ago by burdi01

Stock kernel 5.9-rc4 on Slackware Current64:
-- VirtualBox-6.1.14-140239-Linux_amd64.run with Oracle_VM_VirtualBox_Extension_Pack-6.1.14-140239.vbox-extpack:
After applying the 59-diffs.txt patch and copying the vboxdrv/r0drv/linux/the-linux-kernel.h file to vboxnet{adp,flt}/r0drv/linux/ the host kernel modules built without a problem and my guests (I only have guests without guestadditions) run OK.
:D

comment:11 Changed 7 weeks ago by fbatschu

the next one is:

5) drm_gem_object_put_unlocked() removed

kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/io/nsIFastLoadService.idl
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_fb.c:403:3: error: implicit declaration of function ‘drm_gem_object_put_unlocked’; did you mean ‘drm_gem_object_put_locked’? [-Werror=implicit-function-declaration]
   drm_gem_object_put_unlocked(afb->obj);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drm_gem_object_put_locked

/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_mode.c: In function ‘vbox_cursor_set2’:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_mode.c:882:2: error: implicit declaration of function ‘drm_gem_object_put_unlocked’; did you mean ‘drm_gem_object_put_locked’? [-Werror=implicit-function-declaration]
  drm_gem_object_put_unlocked(obj);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  drm_gem_object_put_locked
kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/components/nsINativeComponentLoader.idl
kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/components/nsIClassInfo.idl
kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/components/nsIComponentRegistrar.idl
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.c: In function ‘vbox_bo_gpu_offset’:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.c:443:15: error: ‘struct ttm_buffer_object’ has no member named ‘offset’
  return bo->bo.offset;
               ^
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.c:444:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1: all warnings being treated as errors
make[2]: *** [/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.o] Error 1
make[2]: *** Waiting for unfinished jobs....
kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/components/nsIFactory.idl
kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/components/nsIModule.idl
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_main.c: In function ‘vbox_user_framebuffer_destroy’:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_main.c:44:3: error: implicit declaration of function ‘drm_gem_object_put_unlocked’; did you mean ‘drm_gem_object_put_locked’? [-Werror=implicit-function-declaration]
   drm_gem_object_put_unlocked(vbox_fb->obj);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drm_gem_object_put_locked

=> entirely gone in 5.9-rc1, but new introduced in 5.9-rc1 this which has been renamed from previous: drm_gem_object_put(). We can use that instead.

 https://lore.kernel.org/lkml/CAPM=9ty8hOY0m2+RJdRiRADY5Li-hs3ZaDEK-DTf6rgFewar7g@mail.gmail.com/

      drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()
      drm/gem: add _locked suffix to drm_gem_object_put
      drm/gem: add drm_gem_object_put helper
      drm: remove _unlocked suffix in drm_gem_object_put_unlocked

 https://lists.freedesktop.org/archives/dri-devel/2020-June/269832.html
Subject linux-next: manual merge of the drm tree with the drm-misc-fixes tree
 https://lkml.org/lkml/2020/7/27/2044

Last edited 7 weeks ago by fbatschu (previous) (diff)

comment:12 Changed 7 weeks ago by fbatschu

next issue:

6) struct drm_driver .master_set - function return value change from int to void

kBuild: xpidl XPCOM - /home/ws/vb/trunk/src/libs/xpcom18a4/xpcom/ds/nsISupportsPrimitives.idl
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_drv.c:319:16: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .master_set = vbox_master_set,
                ^~~~~~~~~~~~~~~

 https://elixir.bootlin.com/linux/v5.9-rc1/source/include/drm/drm_drv.h#L162

	 * Called whenever the minor master is set. Only used by vmwgfx.
	 */
	void (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
			   bool from_open);

vrs:
 https://elixir.bootlin.com/linux/v5.8.7/source/include/drm/drm_drv.h#L162

	 * Called whenever the minor master is set. Only used by vmwgfx.
	 */
	int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
			  bool from_open);

comment:13 Changed 7 weeks ago by burdi01

Stock kernel 5.9-rc4 on Slackware Current64:
-- VirtualBox-6.1.14-140239-Linux_amd64.run with Oracle_VM_VirtualBox_Extension_Pack-6.1.14-140239.vbox-extpack:
After applying the revised 59-diffs.txt patch (excluding the Additions patch) and copying the vboxdrv/r0drv/linux/the-linux-kernel.h file to vboxnet{adp,flt}/r0drv/linux/ the host kernel modules built without a problem and my guests (I only have guests without guestadditions) run OK.

Stock kernel 5.9-rc4 on Slackware Current64:
-- VirtualBox-6.1.15-140270-Linux_amd64.run with Oracle_VM_VirtualBox_Extension_Pack-6.1.15-140270.vbox-extpack:
After applying the revised 59-diffs.txt patch (excluding the Additions patch) and copying the vboxdrv/r0drv/linux/the-linux-kernel.h file to vboxnet{adp,flt}/r0drv/linux/ the host kernel modules built without a problem and my guests (I only have guests without guestadditions) run OK.

:D

Last edited 7 weeks ago by burdi01 (previous) (diff)

comment:14 Changed 7 weeks ago by fbatschu

next issue:

7) struct ttm_buffer_object has no member 'offset' anymore in 5.9-rc1

PATCH 0/8 do not store GPU address in TTM
 https://www.spinics.net/lists/amd-gfx/msg45290.html

  drm/amdgpu: move ttm bo->offset to amdgpu_bo
  drm/radeon: don't use ttm bo->offset
  drm/vmwgfx: don't use ttm bo->offset
  drm/nouveau: don't use ttm bo->offset
  drm/qxl: don't use ttm bo->offset
  drm/vram-helper: don't use ttm bo->offset
  drm/bochs: use drm_gem_vram_offset to get bo offset
  drm/ttm: do not keep GPU dependent addresses

v2,8/8 drm/ttm: do not keep GPU dependent addresses
 https://patchwork.kernel.org/patch/11390641/
 https://www.spinics.net/lists/dri-devel/msg247344.html

/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.c: In function ‘vbox_bo_gpu_offset’:
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.c:443:15: error: ‘struct ttm_buffer_object’ has no member named ‘offset’
  return bo->bo.offset;
               ^
/home/ws/vb/trunk/out/linux.amd64/debug/obj/tstvboxvideo-src_mod/vbox_ttm.c:444:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^

This affects:

trunk/src/VBox/Additions/linux/drm/vbox_ttm.c

446 static inline u64 vbox_bo_gpu_offset(struct vbox_bo *bo)                                                                           
447 {                                                                                                                                  
448         return bo->bo.offset;                                                                                                      
449 }  

401 struct vbox_bo {                                                                                                                   
402         struct ttm_buffer_object bo;                                                                                               
403         struct ttm_placement placement;                                                                                            
404         struct ttm_bo_kmap_obj kmap;                                                                                               
405         struct drm_gem_object gem;                                                                                                 
406 #if RTLNX_VER_MAX(3,18,0) && !RTLNX_RHEL_MAJ_PREREQ(7,2)                                                                           
407         u32 placements[3];                                                                                                         
408 #else                                                                                                                              
409         struct ttm_place placements[3];                                                                                            
410 #endif                                                                                                                             
411         int pin_count;                                                                                                             
412 };  

previously that was:  https://elixir.bootlin.com/linux/v5.8.7/source/include/drm/ttm/ttm_bo_api.h#L166

	uint64_t offset; /* GPU address space is independent of CPU word size */

Solution: we will calculate directly as 'bo->bo.mem.start << PAGE_SHIFT' instead.

Last edited 7 weeks ago by fbatschu (previous) (diff)

comment:15 Changed 7 weeks ago by fbatschu

the attached diffs should work for 5.9-rc4:  https://git.kernel.org/torvalds/t/linux-5.9-rc4.tar.gz for both host & guest

comment:16 Changed 6 weeks ago by fbatschu

the attached diffs still work for  https://git.kernel.org/torvalds/t/linux-5.9-rc5.tar.gz and Trunk svn revision r140354

comment:17 Changed 5 weeks ago by fbatschu

the attached diffs still work for  https://git.kernel.org/torvalds/t/linux-5.9-rc6.tar.gz and Trunk svn revision r140354

Last edited 5 weeks ago by fbatschu (previous) (diff)

comment:18 Changed 5 weeks ago by burdi01

Thank you for keeping us posted.
:D

comment:19 Changed 4 weeks ago by fbatschu

the attached diffs still work for  https://git.kernel.org/torvalds/t/linux-5.9-rc7.tar.gz and Trunk SVN revision r140593

comment:20 follow-up: ↓ 21 Changed 4 weeks ago by burdi01

Kernel 5.9-rc7 crashes on my system -- see  https://lkml.org/lkml/2020/9/28/674 .
Therefore I tested VirtualBox-6.1.15-140592-Linux_amd64.run with kernel 5.8.12: OK.
Alas after applying the diffs vboxconfig fails.
Uploading vbox-setup.log ...

Last edited 4 weeks ago by burdi01 (previous) (diff)

Changed 4 weeks ago by burdi01

Changed 4 weeks ago by fbatschu

for 5.9-rc7 59-diffs-29092020.txt

comment:21 in reply to: ↑ 20 Changed 4 weeks ago by fbatschu

Replying to burdi01:

Kernel 5.9-rc7 crashes on my system -- see  https://lkml.org/lkml/2020/9/28/674 .
Therefore I tested VirtualBox-6.1.15-140592-Linux_amd64.run with kernel 5.8.12: OK.
Alas after applying the diffs vboxconfig fails.
Uploading vbox-setup.log ...

make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/5.8.12-burdi64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j8 modules
/tmp/vbox.0/r0drv/linux/thread2-r0drv-linux.c: In function ‘rtThreadNativeSetPriority’:
/tmp/vbox.0/r0drv/linux/thread2-r0drv-linux.c:86:16: error: ‘VERR_IPE_UNEXPECTED_ERROR_STATUS’ undeclared (first use in this function)
   86 |         return VERR_IPE_UNEXPECTED_ERROR_STATUS;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Yikes! That is strange, on my 5.4.0 Trunk build system this does not occure.

The problem presumably is that thread2-r0drv-linux.c does not include iprt/err.h but only iprt/errcore.h which duplicates some but not all of the error values declared in err.h thus giving the wrong impression it is equivilent in that regard to err.h which it is not.

Lets swap VERR_IPE_UNEXPECTED_ERROR_STATUS with VERR_GENERAL_FAILURE for the time until this is putbacked. See attached new diffs 59-diffs-29092020.txt

Last edited 4 weeks ago by fbatschu (previous) (diff)

comment:22 Changed 4 weeks ago by burdi01

Confirming the new 59-diffs.txt host patches for VirtualBox-6.1.15-140592-Linux_amd64.run with kernel 5.8.12.
:D

comment:23 Changed 4 weeks ago by fbatschu

  • Owner fbatschu deleted
  • Status changed from accepted to assigned

comment:24 Changed 4 weeks ago by burdi01

The kernel 5.9-rc7 crash I mentioned previously occurs in the i915 (intel integrated graphics) driver. By starting a VNCserver on a Slackware Current64 host with such hardware running in CLI mode under the 5.9-rc7 kernel and remotely accessing that host via a VNCviewer I was able to verify the Sep 29 59-diffs.txt on VirtualBox-6.1.15-140592-Linux_amd64.run under kernel 5.9-rc7: OK.
:D

Last edited 4 weeks ago by burdi01 (previous) (diff)

comment:25 Changed 7 days ago by arudnev

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed in 6.1.16

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use