Bug 2099502

Summary: [Hyper-V][RHEL9.1]Hyper-V console goes into blank/hang state after server crash until reboot due to no hyperv_drm in kdump initramfs
Product: Red Hat Enterprise Linux 9 Reporter: xxiong
Component: dracutAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: xxiong
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: cavery, dracut-maint-list, dtardon, eterrell, huzhao, lnykryn, mmorsy, pvalena, ruyang, vkuznets, xuli, yacao, yuxisun
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dracut-057-13.git20220816.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 11:22:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description xxiong 2022-06-21 06:45:36 UTC
Description of problem:
Due to non-availability of Hyper-V video driver hyperv_drm in kdump
initramfs, the console seems to be in hang state with no text over it.

Version-Release number of selected component (if applicable):
RHEL-9.1.0-20220616.1-x86_64-gen2
kexec-tools-2.0.24-3.el9.x86_64
5.14.0-111.el9.x86_64
How reproducible:
100%

Steps to Reproduce:
1. Start GEN2 VM
2. With default kernel parameters and reboot
3. Start kdump service and check kdump is running
# kdumpctl status
Kdump is operational
4. Check the kdump initramfs does not include hyperv_drm
# lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep hyperv_drm
5. Trigger the crash and check the console
# echo c > /proc/sysrq-trigger

Actual results:
1. [root@bootp-73-75-3 ~]# lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep hyperv
-rw-r--r-- root/root              4620 2022-06-14 21:18 squashfs-root/usr/lib/modules/5.14.0-111.el9.x86_64/kernel/drivers/hid/hid-hyperv.ko.xz
-rw-r--r-- root/root              4396 2022-06-14 21:18 squashfs-root/usr/lib/modules/5.14.0-111.el9.x86_64/kernel/drivers/input/serio/hyperv-keyboard.ko.xz
[root@bootp-73-75-3 ~]# uname -r
5.14.0-111.el9.x86_64
[root@bootp-73-75-3 ~]# 

2. after kernel crash, the console seems to be in hang state with no text
over it until reboot

Expected results:
The logs will be visible over console after crash

Additional info:
If add hyperv_drm in kdump initramfs, the logs will be visible over console
1) Ensure /etc/kdump.conf contains the following line :
extra_modules hyperv_drm
2) Restart kdump service and check the kdump initramfs including the
hyperv_drm module
[root@bootp-73-75-3 ~]#  lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep hyperv_drm
Arguments:  --add 'kdumpbase' --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode 'strict' -o 'plymouth resume ifcfg earlykdump' --mount '/dev/mapper/rhel_vm--74--9-root /sysroot xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota' --compress 'zstd' --add-drivers ' hyperv_drm' --no-hostonly-default-device -f
-rw-r--r-- root/root              8008 2022-06-14 21:18 squashfs-root/usr/lib/modules/5.14.0-111.el9.x86_64/kernel/drivers/gpu/drm/hyperv/hyperv_drm.ko.xz
[root@bootp-73-75-3 ~]# 


3) Trigger the crash and check the console, check logs will be visible
over console
# echo c > /proc/sysrq-trigger

4)This issue does not occur on GEN1 VM with the same version
5)This issue also occurs on RHEL-9.0.0-20220430.0 GEN2 VM
6)This issue doesn't occur on RHEL-8.7.0-20220620.2 (hyperv_fb) GEN1/GEN2

Refer to bug:https://bugzilla.redhat.com/show_bug.cgi?id=1637753

Comment 1 Eduardo Otubo 2022-06-22 08:15:37 UTC
@vkuznets do you believe this is something is in our domain to fix?

Comment 2 Vitaly Kuznetsov 2022-06-22 13:04:41 UTC
It seems this is a dracut issue.

/usr/lib/dracut/modules.d/50drm/module-setup.sh has the following code:

...
    instmods amdkfd hyperv_fb "=drivers/pwm"

    # if the hardware is present, include module even if it is not currently loaded,
    # as we could e.g. be in the installer; nokmsboot boot parameter will disable
    # loading of the driver if needed
    if [[ $hostonly ]]; then
        for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
            [[ -e $i ]] || continue
            [[ -n $(< "$i") ]] || continue
            # shellcheck disable=SC2046
            if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(< "$i"); then
                if strstr "$(modinfo -F filename $(< "$i") 2> /dev/null)" radeon.ko; then
                    hostonly='' instmods amdkfd
                fi
            fi
        done
    else
        dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging"
    fi
...

So 'hyperv_fb' is included explicitly and hyperv_drm is not a virtio/PCI device
(with Gen2 VMs)

I'd suggest to add '/sys/bus/vmbus/devices/' to the search list, i.e.:
...
    if [[ $hostonly ]]; then
        for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?,vmbus/devices}/*/modalias; do
...

This seems to work for me. Reassigning to dracut.

Comment 3 Dave Young 2022-06-23 01:33:24 UTC
Vitaly, thanks for your inputs.  If anything need to do in kexec-tools please feel free to move back.

Comment 4 David Tardon 2022-06-23 12:38:09 UTC
(In reply to Vitaly Kuznetsov from comment #2)
> I'd suggest to add '/sys/bus/vmbus/devices/' to the search list, i.e.:
> ...
>     if [[ $hostonly ]]; then
>         for i in
> /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?,vmbus/
> devices}/*/modalias; do
> ...

Sounds reasonable to me.

Comment 6 Lukáš Nykrýn 2022-08-15 14:38:00 UTC
https://github.com/dracutdevs/dracut/pull/1917

Comment 10 xxiong 2022-08-17 07:53:15 UTC
Checked with dracut-057-13.git20220816.el9.x86_64
1. Install dracut-057-13.git20220816.el9.x86_64
2. Rebuild kdump.img
3. Check the hyperv_drm was included in kdump initramfs
4. Restart kdump.service and trigger kdump
5. Check log display on console 

[root@vm-197-36 ~]# lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep hyperv_drm
[root@vm-197-36 ~]# dracut -f /boot/initramfs-$(uname -r)kdump.img $(uname -r)
[root@vm-197-36 ~]# lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep hyperv_drm
-rw-r--r--   1 root     root        23736 Aug 11 00:34 usr/lib/modules/5.14.0-145.el9.x86_64/kernel/drivers/gpu/drm/hyperv/hyperv_drm.ko.xz
[root@vm-197-36 ~]#systemctl restart kdump.service
[root@vm-197-36 ~]# echo c > /proc/sysrq-trigger


Will check with this again when the new compose build available.

Comment 11 xxiong 2022-08-18 12:22:01 UTC
Checked with compose: RHEL-9.1.0-20220817.6_x86_64 GEN2 VM, now the console can display the kdump log before reboot. issue fixed

[root@vm-197-199 ~]# uname -r
5.14.0-145.el9.x86_64
[root@vm-197-199 ~]# rpm -qa dracut
dracut-057-13.git20220816.el9.x86_64
[root@vm-197-199 ~]# lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep hyperv_drm
-rw-r--r-- root/root             23736 2022-08-11 00:34 squashfs-root/usr/lib/modules/5.14.0-145.el9.x86_64/kernel/drivers/gpu/drm/hyperv/hyperv_drm.ko.xz
[root@vm-197-199 ~]# systemctl status kdump.service
● kdump.service - Crash recovery kernel arming
     Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled)
     Active: active (exited) since Thu 2022-08-18 20:10:46 CST; 4min 6s ago
    Process: 837 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS)
   Main PID: 837 (code=exited, status=0/SUCCESS)
        CPU: 1.342s

Aug 18 20:10:43 vm-197-199.lab.eng.pek2.redhat.com systemd[1]: Starting Crash recovery kernel arming...
Aug 18 20:10:46 vm-197-199.lab.eng.pek2.redhat.com kdumpctl[936]: kdump: kexec: loaded kdump kernel
Aug 18 20:10:46 vm-197-199.lab.eng.pek2.redhat.com kdumpctl[936]: kdump: Starting kdump: [OK]
Aug 18 20:10:46 vm-197-199.lab.eng.pek2.redhat.com systemd[1]: Finished Crash recovery kernel arming.
[root@vm-197-199 ~]# echo c > /proc/sysrq-trigger

Comment 14 errata-xmlrpc 2022-11-15 11:22:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dracut bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8379