Hi,
I wanted to experiment ‘creating’ my own low latency kernel for audio production (Jack server etc). Reading some articles including https://www.suse.com/c/compiling-de-linux-kernel-suse-way/ and https://www.kernel.org/doc/html/latest/admin-guide/README.html?highlight=menuconfig I felt confident enough to have a try at it.
I installed Leap 42.3 on a Virtualbox and did a refresh and update. The kernel was 4.4.155-68-default
chris@linux-6h1q:~> uname -r
4.4.155-68-default
and runs fine even though the virtualbox guest module was 5.2.18_k4.4.143_65-56.1.
Information for package virtualbox-guest-kmp-default:
-----------------------------------------------------
Repository : openSUSE-Leap-42.3-Update
Name : virtualbox-guest-kmp-default
Version : 5.2.18_k4.4.143_65-56.1
Arch : x86_64
Vendor : openSUSE
Installed Size : 606.4 KiB
Installed : Yes (automatically)
Status : up-to-date
Source package : virtualbox-5.2.18-56.1.src
Summary : Guest kernel modules for VirtualBox
Description :
VirtualBox is an extremely feature rich, high performance product
for enterprise customers, it is also the only professional solution
that is freely available as Open Source Software under the terms of the
GNU Public License (GPL).
I created a folder under my home called kernel/mykernel and copied the source kernel here as well as the default config file from /boot here as .config.
linux-6h1q:~/kernel/mykernel # cp -r /usr/src/linux-4.4.155-68/* .
linux-6h1q:~/kernel/mykernel # cp /boot/config-4.4.155-68-default .config
I next ran ‘make menuconfig’ to change only the LOCALVERSION to ‘-RTmine-default’ , the Preemption Model from Server to low latency (see pic at https://paste.opensuse.org/9184282 ) and changed the frequency to 100Hz. These were the only 3 edits and the diff results are shown here.
linux-6h1q:/home/chris/kernel/mykernel # diff /boot/config-4.4.155-68-default .config
3c3
< # Linux/x86_64 4.4.141 Kernel Configuration
---
> # Linux/x86 4.4.155 Kernel Configuration
56c56
< CONFIG_LOCALVERSION="-68-default"
---
> CONFIG_LOCALVERSION="-RTmine-default"
136c136
< CONFIG_TREE_RCU=y
---
> CONFIG_PREEMPT_RCU=y
262d261
< CONFIG_OPTPROBES=y
385,389c384
< CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
< CONFIG_INLINE_READ_UNLOCK=y
< CONFIG_INLINE_READ_UNLOCK_IRQ=y
< CONFIG_INLINE_WRITE_UNLOCK=y
< CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
---
> CONFIG_UNINLINE_SPIN_UNLOCK=y
467c462
< CONFIG_PREEMPT_NONE=y
---
> # CONFIG_PREEMPT_NONE is not set
469c464
< # CONFIG_PREEMPT is not set
---
> CONFIG_PREEMPT=y
583c578
< CONFIG_HZ_250=y
---
> # CONFIG_HZ_250 is not set
585,586c580,581
< # CONFIG_HZ_1000 is not set
< CONFIG_HZ=250
---
> CONFIG_HZ_1000=y
> CONFIG_HZ=1000
5092d5086
< # CONFIG_DRM_I810 is not set
7357a7352
> CONFIG_DEBUG_PREEMPT=y
7436a7432
> # CONFIG_PREEMPT_TRACER is not set
I then ran -
linux-6h1q:~/kernel/mykernel # time make -j6
.
.(line removed by me)
.
real 22m57.498s
user 84m46.396s
sys 9m14.464s
followed by
linux-6h1q:/home/chris/kernel/mykernel # time make -j6 modules
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/timeconst.h
CHK include/generated/bounds.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
Building modules, stage 2.
MODPOST 3697 modules
WARNING: arch/x86/kvm/kvm-intel.o(.init.text+0xd18): Section mismatch in reference from the function init_module() to the function .exit.text:vmx_exit()
The function __init init_module() references
a function __exit vmx_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
vmx_exit() so it may be used outside an exit section.
real 4m36.350s
user 2m14.241s
sys 0m40.028s
Next -
linux-6h1q:/home/chris/kernel/mykernel # time make -j6 modules_install
INSTALL /lib/firmware/4.4.155-RTmine-default/yam/1200.bin
INSTALL /lib/firmware/4.4.155-RTmine-default/yam/9600.bin
DEPMOD 4.4.155RTmine
real 2m30.570s
user 0m28.789s
sys 0m34.772s
And finally -
linux-6h1q:/home/chris/kernel/mykernel # time make -j6 install
dracut: root=UUID=33570143-ca15-447e-a3cd-974e9ed93c92 rootfstype=btrfs rootflags=rw,relatime,space_cache,subvolid=259,subvol=/@/.snapshots/1/snapshot,subvol=@/.snapshots/1/snapshot
dracut: *** Creating image file '/boot/initrd-4.4.15-RTmine-default' ***
dracut: *** Creating initramfs image file '/boot/initrd-4.4.15-RTmine-default' done ***
real 1m17.737s
user 0m49.606s
sys 0m21.512s
The results in /boot -
chris@linux-6h1q:~> ls -al /boot
total 153588
drwxr-xr-x 1 root root 1384 Oct 10 13:59 .
drwxr-xr-x 1 root root 166 Oct 10 12:41 ..
-rw-r--r-- 1 root root 512 Oct 10 12:04 backup_mbr
-rw-r--r-- 1 root root 1725 Jul 19 20:06 boot.readme
-rw-r--r-- 1 root root 180135 Sep 12 20:12 config-4.4.155-68-default
-rw-r--r-- 1 root root 180026 Oct 10 13:49 config-4.4.155-RTmine-default
-rw-r--r-- 1 root root 179969 Jul 16 2017 config-4.4.76-1-default
drwxr-xr-x 1 root root 140 Oct 10 14:57 grub2
lrwxrwxrwx 1 root root 25 Oct 10 12:39 initrd -> initrd-4.4.155-68-default
-rw------- 1 root root 9887520 Oct 10 12:41 initrd-4.4.155-68-default
-rw------- 1 root root 9689808 Oct 10 14:57 initrd-4.4.155-RTmine-default
-rw------- 1 root root 9677428 Oct 10 12:41 initrd-4.4.76-1-default
-rw-r--r-- 1 root root 502272 Oct 10 11:58 message
-rw-r--r-- 1 root root 999094 Sep 12 21:05 symtypes-4.4.155-68-default.gz
-rw-r--r-- 1 root root 995727 Jul 16 2017 symtypes-4.4.76-1-default.gz
-rw-r--r-- 1 root root 342888 Sep 12 21:01 symvers-4.4.155-68-default.gz
-rw-r--r-- 1 root root 340794 Jul 16 2017 symvers-4.4.76-1-default.gz
-rw-r--r-- 1 root root 377 Sep 12 21:01 sysctl.conf-4.4.155-68-default
-rw-r--r-- 1 root root 377 Jul 16 2017 sysctl.conf-4.4.76-1-default
-rw-r--r-- 1 root root 3297500 Sep 12 20:53 System.map-4.4.155-68-default
-rw-r--r-- 1 root root 3298407 Oct 10 14:07 System.map-4.4.155-RTmine-default
-rw-r--r-- 1 root root 3266760 Jul 16 2017 System.map-4.4.76-1-default
-rw-r--r-- 1 root root 7122536 Sep 12 21:06 vmlinux-4.4.155-68-default.gz
-rw-r--r-- 1 root root 81811001 Oct 10 14:57 vmlinux-4.4.155-RTmine-default.gz
-rw-r--r-- 1 root root 7022105 Jul 16 2017 vmlinux-4.4.76-1-default.gz
lrwxrwxrwx 1 root root 26 Oct 10 12:39 vmlinuz -> vmlinuz-4.4.155-68-default
-rw-r--r-- 1 root root 6205112 Sep 12 21:53 vmlinuz-4.4.155-68-default
-rw-r--r-- 1 root root 65 Sep 12 21:53 .vmlinuz-4.4.155-68-default.hmac
-rw-r--r-- 1 root root 6203200 Oct 10 14:07 vmlinuz-4.4.155-RTmine-default
-rw-r--r-- 1 root root 6006440 Jul 16 2017 vmlinuz-4.4.76-1-default
-rw-r--r-- 1 root root 65 Jul 16 2017 .vmlinuz-4.4.76-1-default.hmac
chris@linux-6h1q:~>
Well it booted sort of ok into my edited kernel
chris@linux-6h1q:~> uname -r
4.4.155-RTmine-default
And now the issues.
Question 1. The resultant modules under /lib/modules/4.4.155-RTmine-default/ are huge in size. Why won’t they build to the same size as the source kernel modules?
chris@linux-6h1q:~> du -hs /lib/modules/4.4.155-68-default/
199M /lib/modules/4.4.155-68-default/
chris@linux-6h1q:~> du -hs /lib/modules/4.4.155-RTmine-default/
2.9G /lib/modules/4.4.155-RTmine-default/
chris@linux-6h1q:~> ls -alR /lib/modules/4.4.155-68-default/ |wc -l
8971
chris@linux-6h1q:~> ls -alR /lib/modules/4.4.155-RTmine-default/ |wc -l
8928
chris@linux-6h1q:~>
Question 2. Why is the default Preemption Model set to server? I would have made an assumption it would have been set for low latency desktop since most of us would install on desktop/laptop.
Question 3. The video size in Virtualbox is stuck at 640x480 ie no options for other resolutions. See https://paste.opensuse.org/33386165 .Plus I can’t copy/paste from guest to host. I would have assumed that since 4.4.155-68-default worked ok with the current virtualbox guest kmp it would have also done so with mine. Any reasons why not?
Question 4. I have not tested the efficacy of my low latency kernel with Jack server yet but are my kernel writing processes valid or have I made a mistake(s) in my method?
Thanks,
Chris.
.