Bug 2229357

Summary: [intel iommu][vfio-vf/vfio-pf] qemu-kvm: Fail to lookup the translated address
Product: Red Hat Enterprise Linux 9 Reporter: Yanghang Liu <yanghliu>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
qemu-kvm sub component: Networking QA Contact: Yanghang Liu <yanghliu>
Status: NEW --- Docs Contact:
Severity: low    
Priority: low CC: chayang, coli, jinli, jinl, jinzhao, juzhang, lvivier, virt-maint, yanghliu
Version: 9.3   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yanghang Liu 2023-08-05 09:24:57 UTC
Description of problem:
When reboot or shutdown the VM with an Intel iommu device and PF/VF, the qemu-kvm throws the error info like : Fail to lookup the translated address fff22000

Version-Release number of selected component (if applicable):
5.14.0-348.el9.x86_64
qemu-kvm-8.0.0-9.el9.x86_64
libvirt-9.5.0-5.el9.x86_64
edk2-ovmf-20230524-2.el9.noarch


How reproducible:
100%

Steps to Reproduce:
1. import a VM which has two VFs

# virt-install --machine=q35 --noreboot --name=rhel93 --memory=4096 --vcpus=4 --graphics type=vnc,port=5993,listen=0.0.0.0 --osinfo detect=on,require=off --check all=off --memtune hard_limit=12582912 --memballoon virtio,driver.iommu=on,driver.ats=on --import --noautoconsole --check all=off --network bridge=switch,model=virtio,mac=52:54:00:03:93:93,driver.iommu=on,driver.ats=on --disk path=/home/images/RHEL93.qcow2,bus=virtio,cache=none,format=qcow2,io=threads,size=20,driver.iommu=on,driver.ats=on --features ioapic.driver=qemu --iommu model=intel,driver.intremap=on,driver.caching_mode=on,driver.iotlb=on --boot=uefi --hostdev pci_0000_3b_0e_0  --hostdev pci_0000_3b_0e_1 



2. make sure the VM kernel has enabled intel_iommu=on option


3. start a VM which has two VFs

# virsh start rhel93

4. reboot or shutdown the VM
(1) 
run "virsh reboot rhel93" or  "virsh shutdown rhel93" on the host 
(2)
run "reboot" or "shutdown -h now" in the VM

5. repeated the step 2 for 5 times

Actual results:
The qemu-kvm throws the error info like : Fail to lookup the translated address fff22000

Expected results:
The qemu-kvm does not throw any error

Additional info:
(1) The cmd I used to reproduce this issue via auto tests: 
# python3 /home/private_autocase/vfio/vfio_sriov_test.py --feature=vf --domain=rhel93 --device_name=MT2892  --machine_type=q35 --bios=ovmf  --test_list="intel_iommu_test"
or
python3 /home/private_autocase/vfio/vfio_sriov_test.py --feature=pf --domain=rhel93 --device_name=82599ES --machine_type=q35 --bios=ovmf  --test_list="intel_iommu_test"

Comment 1 Alex Williamson 2023-08-09 19:30:23 UTC
The only such message I see in QEMU is from vhost:

hw/virtio/vhost.c:
            error_report("Fail to lookup the translated address "
                         "%"PRIx64, iotlb.translated_addr);

Suspect this might have more to do with the virtio network device than the vfio devices.