Wind River Support Network

HomeDefectsLIN1021-989
Fixed

LIN1021-989 : qemu: guest kernel panic due to deadlock with host

Created: Jul 28, 2021    Updated: Sep 8, 2021
Resolved Date: Aug 9, 2021
Found In Version: 10.21.20.4
Fix Version: 10.21.20.2
Severity: Standard
Applicable for: Wind River Linux LTS 21
Component/s: Userspace

Description

Avoid  guest deadlocks with heavy I/O, some of the threads are deadlocked on /var/db/login-locks,  some process inside the OS has accessed this file and not released it because of which the deadlock has happened.

Steps to Reproduce

Build LTS19 OVP Host image,

LTS19 RCPL0015

Setup Project:

$ ./wrlinux-x/setup.sh --dl-layers --distros wrlinux-ovp --machines intel-x86-64 --templates feature/initramfs,feature/kdump,feature/kexec,feature/sysklogd,feature/dpdk,feature/package-management 

Source bitbake build env.

$ . ./environment-setup-x86_64-wrlinuxsdk-linux

$ . ./oe-init-build-env

Set PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt" in conf/local.conf

Build images.

$ bitbake wrlinux-image-ovp-kvm

-> Deploy LTS19 OVP Host image to Intel-x86-64 target and boot.

 

-> On LTS19 Host OS console : 

1) Download FreeBSD-11.2-RELEASE-amd64.qcow2 from FreeBSD website and convert it to raw image :  

[/]

root@intel-x86-64:~# qemu-img convert -p -f qcow2 -O raw -o preallocation=off FreeBSD-11.2-RELEASE-amd64.qcow2 FreeBSD-11.2-RELEASE-amd64.img

2) Use attached freebsd_11_2_reproducer.xml file to create a guest VM using virsh.

root@intel-x86-64:~# uname -a
Linux intel-x86-64 5.2.60-rt15-yocto-preempt-rt #1 SMP PREEMPT RT Wed Feb 3 15:42:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
root@intel-x86-64:~# 

root@intel-x86-64:~# virsh create freebsd_11_2_reproducer.xml

virsh list
 Id Name State
-------------------------
 1 vjunos0 running

root@intel-x86-64:~#

3) Access guest VM serial console : 

root@intel-x86-64:~# virsh console vjunos0

-> Once in Guest VM, use below test.sh script to reproduce the issue.


root@freebsd:~ # uname -a
FreeBSD freebsd 11.2-RELEASE FreeBSD 11.2-RELEASE #0 r335510: Fri Jun 22 04:32:14 UTC 2018 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
root@freebsd:~ #

root@freebsd:~ # cat test.sh
#!/bin/sh

helper() {
 if test -n "${child}"; then
 kill -9 ${child}
 fi
 exit 1
}

sysctl debug.deadlkres.blktime_threshold=60
sysctl debug.deadlkres.slptime_threshold=60

trap 'helper' SIGINT

( iter=1; while true; do echo "Iteration: ${iter}"; iter=$(( iter + 1 )); dd if=/dev/zero of=/root/zero.bin bs=8M count=128; sleep 1; done ) &
child=${!}

while true; do
 ls -l /root/zero.bin
 sleep 5
done
root@freebsd:~ #
root@freebsd:~ # chmod a+x test.sh
root@freebsd:~ # ./test.sh
Live chat
Online