Re: [PATCH] iommu: intel: remove flooding of non-error logs, when new-DMA-PTE is the same as old-DMA-PTE.

From: Ajay Garg
Date: Thu Oct 07 2021 - 05:04:08 EST


Thanks Alex for the reply.


Lu, Alex :

I got my diagnosis regarding the host-driver wrong, my apologies.
There is no issue with the pci-device's host-driver (confirmed by
preventing the loading of host-driver at host-bootup). Thus, nothing
to be fixed at the host-driver side.

Rather seems some dma mapping/unmapping inconsistency is happening,
when kvm/qemu boots up with the pci-device attached to the guest.

I put up debug-logs in "vfio_iommu_type1_ioctl" method in
"vfio_iommu_type1.c" (on the host-machine).
When the guest boots up, repeated DMA-mappings are observed for the
same address as per the host-machine's logs (without a corresponding
DMA-unmapping first) :

##########################################################################################
ajay@ajay-Latitude-E6320:~$ tail -f /var/log/syslog | grep "ajay: "
Oct 7 14:12:32 ajay-Latitude-E6320 kernel: [ 146.202297] ajay:
_MAP_DMA for [0x7ffe724a8670] status [0]
Oct 7 14:12:32 ajay-Latitude-E6320 kernel: [ 146.583179] ajay:
_MAP_DMA for [0x7ffe724a8670] status [0]
Oct 7 14:12:32 ajay-Latitude-E6320 kernel: [ 146.583253] ajay:
_MAP_DMA for [0x7ffe724a8670] status [0]
Oct 7 14:12:36 ajay-Latitude-E6320 kernel: [ 150.105584] ajay:
_MAP_DMA for [0x7ffe724a8670] status [0]
Oct 7 14:13:07 ajay-Latitude-E6320 kernel: [ 180.986499] ajay:
_UNMAP_DMA for [0x7ffe724a9840] status [0]
Oct 7 14:13:07 ajay-Latitude-E6320 kernel: [ 180.986559] ajay:
_MAP_DMA for [0x7ffe724a97d0] status [0]
Oct 7 14:13:07 ajay-Latitude-E6320 kernel: [ 180.986638] ajay:
_MAP_DMA for [0x7ffe724a97d0] status [0]
Oct 7 14:13:07 ajay-Latitude-E6320 kernel: [ 181.087359] ajay:
_MAP_DMA for [0x7ffe724a97d0] status [0]
Oct 7 14:13:13 ajay-Latitude-E6320 kernel: [ 187.271232] ajay:
_UNMAP_DMA for [0x7fde7b7fcfa0] status [0]
Oct 7 14:13:13 ajay-Latitude-E6320 kernel: [ 187.271320] ajay:
_UNMAP_DMA for [0x7fde7b7fcfa0] status [0]
....
##########################################################################################


I'll try and backtrack to the userspace process that is sending these ioctls.


Thanks and Regards,
Ajay






On Tue, Oct 5, 2021 at 4:01 AM Alex Williamson
<alex.williamson@xxxxxxxxxx> wrote:
>
> On Sat, 2 Oct 2021 22:48:24 +0530
> Ajay Garg <ajaygargnsit@xxxxxxxxx> wrote:
>
> > Thanks Lu for the reply.
> >
> > >
> > > Isn't the domain should be switched from a default domain to an
> > > unmanaged domain when the device is assigned to the guest?
> > >
> > > Even you want to r-setup the same mappings, you need to un-map all
> > > existing mappings, right?
> > >
> >
> > Hmm, I guess that's a (design) decision the KVM/QEMU/VFIO communities
> > need to take.
> > May be the patch could suppress the flooding till then?
>
> No, this is wrong. The pte values should not exist, it doesn't matter
> that they're the same. Is the host driver failing to remove mappings
> and somehow they persist in the new vfio owned domain? There's
> definitely a bug beyond logging going on here. Thanks,
>
> Alex
>