RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1715801 - qemu-kvn get SIGABRT when live attach and detach usbredir device
Summary: qemu-kvn get SIGABRT when live attach and detach usbredir device
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: qemu-kvm
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.0
Assignee: Gerd Hoffmann
QA Contact: yduan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-31 10:16 UTC by Han Han
Modified: 2020-06-22 19:30 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-06-22 19:30:29 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
all threads backtrace (15.19 KB, text/plain)
2019-05-31 10:16 UTC, Han Han
no flags Details

Description Han Han 2019-05-31 10:16:12 UTC
Created attachment 1575642 [details]
all threads backtrace

Description of problem:
As subject

Version-Release number of selected component (if applicable):

usbredir-server-0.8.0-1.el8.x86_64
qemu-kvm-4.0.0-3.module+el8.1.0+3265+26c4ed71.x86_64
libvirt-5.3.0-1.module+el8.1.0+3225+a8268fde.x86_64


How reproducible:
80%

Steps to Reproduce:
1. Prepare a usb device on host and setup a usbredir server:
# lsusb
Bus 002 Device 005: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive

# usbredirserver -p 6000 090c:1000


2. Start a Vm with libvirt


3. Attach and detach following usb redir device:
# cat /tmp/usbredir.xml                                                                                                               
<redirdev bus="usb" type="tcp">
      <source host="localhost" mode="connect" service="6000" tls="no" />
      <protocol type="raw" />
      <alias name="ua-redir0e13ad0d8-d98e-4811-b3d7-814af4d9bf9d" />
      <address bus="0" port="2" type="usb" />
    </redirdev>

# while true;do shuf -n 1 -e 1 2 3;virsh attach-device pc /tmp/usbredir.xml; shuf -n 1 -e 1 2 3;virsh detach-device pc /tmp/usbredir.xml;done

Stop it when get this error:
virsh detach-device pc /var/tmp/xml_utils_temp_4zv0ipkq.xml
error: Failed to detach device from /tmp/usbredir.xml
error: Unable to read from monitor: Connection reset by peer

Then find the SIGABRT:
id a4b31dc3cb8e32d338b8325586ec05cf47a33df0
reason:         _nl_load_domain.cold.0(): qemu-kvm killed by SIGABRT
time:           Wed 29 May 2019 06:28:04 PM CST
cmdline:        /usr/libexec/qemu-kvm -name guest=avocado-vt-vm1,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1-avocado-vt-vm1/master-key.aes -machine pc-q35-rhel8.0.0,accel=kvm,usb=off,dump-guest-core=off -cpu Opteron_G3,vme=on,x2apic=on,tsc-deadline=on,hypervisor=on,arat=on,mmxext=on,fxsr_opt=on,pdpe1gb=on,3dnowext=on,3dnow=on,cmp_legacy=on,cr8legacy=on,3dnowprefetch=on,osvw=on,monitor=off,rdtscp=off,svm=off -m 1024 -overcommit mem-lock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 82210bbf-3c3c-44e4-9ef6-3cbef3a46e68 -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=30,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 -boot strict=on -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,addr=0x1 -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 -device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.2,addr=0x1 -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x7 -drive file=/var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pcie.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=32,id=hostnet0,vhost=on,vhostfd=33 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:09:a1:cc,bus=pcie.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,fd=34,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -chardev socket,id=charchannel1,fd=35,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=org.qemu.guest_agent.0 -device usb-tablet,id=input0,bus=usb.0,port=1 -vnc 127.0.0.1:0 -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x2 -chardev socket,id=charua-redir055e772a0-b5b9-4452-8133-9f3476f0d137,host=localhost,port=6000 -device usb-redir,chardev=charua-redir055e772a0-b5b9-4452-8133-9f3476f0d137,id=ua-redir055e772a0-b5b9-4452-8133-9f3476f0d137,bus=usb.0,port=2 -device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x6 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on
package:        15:qemu-kvm-core-4.0.0-3.module+el8.1.0+3265+26c4ed71
uid:            107 (qemu)
count:          10
Directory:      /var/spool/abrt/ccpp-2019-05-29-18:28:04-22658
Run 'abrt-cli report /var/spool/abrt/ccpp-2019-05-29-18:28:04-22658' for creating a case in Red Hat Customer Portal

Actual results:
As above

Expected results:
No SIGABRT

Additional info:
No reproduced on rhel7.7:
usbredir-server-0.7.1-3.el7.x86_64
libvirt-4.5.0-18.virtcov.el7.x86_64
qemu-kvm-rhev-2.12.0-30.el7.x86_64

Comment 1 Han Han 2019-05-31 10:22:50 UTC
Covered by automation case usb_device.redirdev.tcp(https://github.com/autotest/tp-libvirt/pull/2175)

Comment 2 Gerd Hoffmann 2019-06-03 08:24:39 UTC
Probably ehci_find_device() in ehci_state_fetchqh() fails (i.e. returns NULL).

Comment 4 Gerd Hoffmann 2019-08-13 13:35:18 UTC
Oops, wrong repo link.  Use this:
http://brew-task-repos.usersys.redhat.com/repos/scratch/ghoffman/qemu-kvm/2.12.0/83.el8.bz1715801.1/

Comment 5 Han Han 2019-08-14 09:18:11 UTC
Unfortunately, I cannot reproduce this bug as comment0 with the same libvirt and qemu-kvm version. And also not reproducible with libvirt-5.3.0-1.module+el8.1.0+3225+a8268fde.x86_64 and the qemu-kvm in comment4.

Comment 6 Michael 2019-08-14 09:37:48 UTC
(In reply to Han Han from comment #5)
> Unfortunately, I cannot reproduce this bug as comment0 with the same libvirt
> and qemu-kvm version. And also not reproducible with
> libvirt-5.3.0-1.module+el8.1.0+3225+a8268fde.x86_64 and the qemu-kvm in
> comment4.

Hi hanhan:

I just want to double check. which usb controller is used by default in libvirt on RHEL8 ? Is it qemu-xhci ? 


Thanks

Comment 7 Han Han 2019-08-15 04:32:20 UTC
(In reply to Michael from comment #6)
> (In reply to Han Han from comment #5)
> > Unfortunately, I cannot reproduce this bug as comment0 with the same libvirt
> > and qemu-kvm version. And also not reproducible with
> > libvirt-5.3.0-1.module+el8.1.0+3225+a8268fde.x86_64 and the qemu-kvm in
> > comment4.
> 
> Hi hanhan:
> 
> I just want to double check. which usb controller is used by default in
> libvirt on RHEL8 ? Is it qemu-xhci ? 
What is the exact meanings of `default` in your words? I think there may be 3
different meanings:
1. Define & Start a VM without any usb controllers or usb devices, which usb controller
will be defaultly filled by libvirt?
2. Define & Start a VM with a usb controller, but its model is not set, which usb
controller model will be filled by libvirt?
3. Define & Start a VM with a usb device, without any usb controller, which usb controller
will be defaultly filled by libvirt?

For the Q1, the logic of default usb is defined by function qemuDomainDefAddDefaultDevices as following:
i. For machine type q35, check qemu-xhci, nec-xhci, echi-ich9 by order, if any model is found supported
for the first time, then use it as the default usb controller model.
ii. For machine type pc, the default usb controller will be set to piix3-uchi in function qemuDomainControllerDefPostParse.

For Q2, the same as Q1-ii, set to piix3-uchi

For Q3, the same as Q1.

> 
> 
> Thanks

Comment 8 Han Han 2019-08-15 04:40:24 UTC
All in all, for libvirt & qemu in rhel8:
1. if usb controller is set but model not set, model will be set to piix3-uchi
2. if usb controller is not set
i. for q35 machine, set to qemu-xhci
ii. for pc machine, set to piix3-uchi

Comment 9 Michael 2019-08-15 11:17:42 UTC
(In reply to Han Han from comment #8)
> All in all, for libvirt & qemu in rhel8:
> 1. if usb controller is set but model not set, model will be set to
> piix3-uchi
> 2. if usb controller is not set
> i. for q35 machine, set to qemu-xhci
> ii. for pc machine, set to piix3-uchi

Thank you. The information is really helpful. 

Now I am clear about RHEL8. If there is no controller set and define & start a VM with a usb device, like the Q3, what is the default controller for RHEL7. 


Thank you for your time.

Comment 10 Han Han 2019-08-16 07:33:59 UTC
(In reply to Michael from comment #9)
> (In reply to Han Han from comment #8)
> > All in all, for libvirt & qemu in rhel8:
> > 1. if usb controller is set but model not set, model will be set to
> > piix3-uchi
> > 2. if usb controller is not set
> > i. for q35 machine, set to qemu-xhci
> > ii. for pc machine, set to piix3-uchi
> 
> Thank you. The information is really helpful. 
> 
> Now I am clear about RHEL8. If there is no controller set and define & start
> a VM with a usb device, like the Q3, what is the default controller for
> RHEL7. 
For libvirt-4.5.0-23 of RHEL7, it is same to RHEL8. No significant changes.
> 
> 
> Thank you for your time.

Comment 11 Ademar Reis 2020-02-05 22:58:29 UTC
QEMU has been recently split into sub-components and as a one-time operation to avoid breakage of tools, we are setting the QEMU sub-component of this BZ to "General". Please review and change the sub-component if necessary the next time you review this BZ. Thanks

Comment 12 Gerd Hoffmann 2020-04-01 12:59:02 UTC
(In reply to Han Han from comment #5)
> Unfortunately, I cannot reproduce this bug as comment0 with the same libvirt
> and qemu-kvm version. And also not reproducible with
> libvirt-5.3.0-1.module+el8.1.0+3225+a8268fde.x86_64 and the qemu-kvm in
> comment4.

Hmm, so what is the status here?  Doesn't reproduce any more?
In case it does still reproduce:  Does it also happen with AV (qemu-kvm-4.2.0)?

Comment 13 Han Han 2020-04-08 03:07:50 UTC
(In reply to Gerd Hoffmann from comment #12)
> (In reply to Han Han from comment #5)
> > Unfortunately, I cannot reproduce this bug as comment0 with the same libvirt
> > and qemu-kvm version. And also not reproducible with
> > libvirt-5.3.0-1.module+el8.1.0+3225+a8268fde.x86_64 and the qemu-kvm in
> > comment4.
> 
> Hmm, so what is the status here?  Doesn't reproduce any more?
> In case it does still reproduce:  Does it also happen with AV
> (qemu-kvm-4.2.0)?

I cannot reproduce that on libvirt-6.0.0-16.module+el8.2.0+6139+d66dece5.x86_64 qemu-kvm-4.2.0-17.module+el8.2.0+6141+0f540f16.x86_64 usbredir-0.8.0-1.el8.x86_64 when attach/detach usbredir to ich9-ehci1 and qemu-xhci buses


Note You need to log in before you can comment on or make changes to this bug.