sublogic Guru
Joined: 21 Mar 2022 Posts: 305 Location: Pennsylvania, USA
|
Posted: Fri Apr 21, 2023 4:15 am Post subject: [Moot] Call for testers -- display regression in kernel 6.3 |
|
|
Edit 2023-04-21: patch was updated.
Edit 2023-05-24: fixed in 6.4-rc3 and in 6.3.4
=========
Linux-6.3 should be released this weekend at kernel.org; meanwhile, I ran into a regression in all the -6.3-rc kernels. The framebuffer driver garbles the display during early boot. It's not a killer, the display is usable and gets cleaned up anyway when the final dri driver takes over. (I was temporarily running -rc kernels to fix another regression.) See this topic in the Gentoo forums for screenshots.
At first I blamed it on the ancient hardware, a ~2007 Gateway laptop, but I see the same problem on a ~2019 vintage tower (Dell Precision 3610). I worked with upstream, and now there is a patch that will probably get merged.
The kernel devs test their code, so it must not be common, but the 2019 Dell makes me think at least a few other users will get bitten. So it would help if people with a variety of hardware could test the kernel and the patch. I did all my testing (and bisecting) by just booting the naked bzImage, without modules, to see the early screens. It's a bit involved, but not as heavy as a full install.
The goal is to find out:- what hardware exhibits the problem;
- whether the patch fix the problem;
- whether the patch breaks perfectly good setups.
There is some risk, but if you understand what is going on it's pretty safe. If you feel uncomfortable, don't do it. Read on if you're interested.
(Minor incentive: your name after "Tested-by: " in a patch = bragging rights.)
The early driver is the simple framebuffer: Code: | CONFIG_SYSFB_SIMPLEFB=y | On the Gateway I also have On the Dell, Code: | CONFIG_DRM_SIMPLEDRM=y | The last two are mutually exclusive, you need one or the other but SYSFB_SIMPLEFB is what matters.
You need a bootloader like grub or rEFInd that lets you edit temporary boot entries so you don't have to change your settings permanently. I use grub.
The process is- download the kernel sources and the patch;
- compile a bzImage and copy to /boot
- patch, compile a second bzImage and copy to /boot
- reboot, edit the menu entry in the bootloader to point to one of the bzImages
- stop at a rescueshell (if you have an initramfs) or let it panic for lack of a root (if you don't) or let it resume from swap (if you hibernated instead of rebooting);
- CTL-ALT-DEL or power-cycle or reboot or hibernate, repeat with the other bzImage
- CTL-ALT-DEL or power-cycle or reboot normally or stay resumed; done
I'll expand on that below. You can do most of this as a normal user, only the copy to /boot and the reboot requires root.
That said, no two Gentoo installs are the same, perhaps a tiny detail makes this difficult on your system. You have to understand the process and make changes as needed.
====================================================================================
1. Download the kernel and the patch. Code: | $ cd some/work/area
$ wget https://git.kernel.org/torvalds/t/linux-6.3-rc7.tar.gz
$ wget -O simplefb.patch https://cgit.freedesktop.org/drm/drm-tip/patch/?id=1b617bc93178912fa36f87a957c15d1f1708c299 | The patch is off of -6.3-rc7; it will probably work with -6.3 but let's not complicate things.
2. Compile the kernel and copy to /boot . Code: | $ tar xzf linux-6.3-rc7.tar.gz
$ cd linux-6.3-rc7
$ zcat /proc/config.gz > .config
$ make olddefconfig
$ make menuconfig; : only if you need to set SYSFB_SIMPLEFB and { FB_SIMPLE or DRM_SIMPLEDRM }
$ make bzImage
$ sudo mount /boot
$ sudo cp arch/x86/boot/bzImage /boot/bzImage-0 |
3. Patch, recompile and copy. Code: | $ patch -b -p1 < ../simplefb.patch
$ make bzImage
$ sudo cp arch/x86/boot/bzImage /boot/bzImage-1 |
3. Reboot the bzImage-0 . A few things could go wrong here.- The bootloader has to set up a video mode that triggers the regression. More about that below.
- Your kernels need modules from a matching initramfs to finish booting ? Actually this is fine: bzImage-0 will probably panic, you will have a clean or garbled panic screen and you will know.
- You don't use an initramfs ? Suggest passing "root=/just/testing" to force an early panic and not touch your userspace.
- You hibernated and don't use an initramfs ? Suggest "root=/just/testing noresume"
- Hibernated, no initramfs and feel lucky ? "root=/just/testing" should resume your installed kernel out of hibernation (or panic if the resume fails).
- You do use an initramfs ? pass debug to stop at a rescue shell (genkernel; dracut must have a similar option; if you have a custom initramfs, only you can know).
Anyway, Code: | $ sudo reboot; : or loginctl reboot , or loginctl hibernate , or ... |
4. Catch the bootloader and edit the menu entry.
This is the critical step and details will vary depending on your installation. For me,- My bootloader is grub.
- Grub initalizes the video to 1024x768x32 (on the Gateway, bigger on the Dell).
- The 32 colordepth is probably the regression trigger.
- My /etc/default/grub has GRUB_GFXPAYLOAD_LINUX=keep, so all my grub menu entries have set gfxpayload=keep.
- gfxpayload=keep is necessary to initalize the simple framebuffer correctly. Otherwise the kernel will probably fall back to e.g. vesafb.
- An explicit gfxpayload=1024x768x32 also works.
- Fun fact: gfxpayload=1024x768x24 works around the regression.
So I type "e" in grub, edit the menu entry and press F10 to boot the modified entry. None of this is stored permanently. I'll copy-paste the menuentry for completeness. I use a "quote" tag rather than "code" because I want to highlight the important bits. Quote: | Gentoo GNU/Linux, with Linux 6.1.19-gentoo-x86' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.19-gentoo-x86-advanced-/dev/mapper/vg0-root' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 276fbb4c-dba9-4166-b291-a1d1411f2769
else
search --no-floppy --fs-uuid --set=root 276fbb4c-dba9-4166-b291-a1d1411f2769
fi
echo 'Loading Linux 6.1.19-gentoo-x86 ...'
linux /bzImage-0 debug root=/dev/mapper/vg0-root ro dolvm crypt_root=UUID=64aaa737-a3d3-4d45-8468-cc6a0ec58883 hpet=force resume=/dev/vg0/swap
echo 'Loading initial ramdisk ...'
initrd /initramfs-generic
} | The gfxpayload=keep was already there but the linux line is critical. I had to change the vmlinuz to /bzimage and I added debug because I have a genkernel initramfs. The rest of the linux line is idiosyncratic to my laptop.
Then, F10 boots the bzImage-0 . Note if the screen is normal or squished.
If you use rEFInd there must be a similar procedure, but you'll have to fill in the details.
5. Reboot the bzImage-1.
Repeat steps 3 and 4, but use bzImage-1. Note if the screen is normal or squished.
6. Reboot normally. Or stay resumed, etc.
7. Cleanup Code: | $ sudo mount /boot
$ sudo rm /boot/bzImage-0
$ sudo rm /boot/bzImage-1
$ sudo umount /boot
$ rm -rf linux-6.3-rc7
$ rm linux-6.3-rc7.tar.gz
$ rm simplefb.patch |
8. Post your results ! Especially if the patch breaks your setup !
====================================================================================
That's it. I think I got everything right. Thanks for taking the time to read this far. |
|