Re: [PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper

From: Jason Gunthorpe
Date: Thu Jan 23 2025 - 08:42:51 EST


On Wed, Jan 22, 2025 at 11:54:52AM -0800, Nicolin Chen wrote:

> ARM seems to also have an interesting event merging feature:
> STE.MEV, bit [83]
> Merge Events arising from terminated transactions from this stream.
> 0b0 Do not merge similar fault records
> 0b1 Permit similar fault records to be merged
> The SMMU might be able to reduce the usage of the Event queue by
> coalescing fault records that share the same page granule of address,
> access type and SubstreamID.
> Setting MEV == 1 does not guarantee that faults will be coalesced.
> Setting MEV == 0 causes a physical SMMU to prevent coalescing of
> fault records, however, a hypervisor might not honour this setting
> if it deems a guest to be too verbose.
> Note: Software must expect, and be able to deal with, coalesced fault
> records even when MEV == 0.
>
> Yet, the driver doesn't seem to care setting it at this moment.

Yeah, we will eventually need to implement whatever DOS mitigations
are included in the IOMMU architectures..

I think DOS testing the event architecture should be part of the
testing/qualification.

It should be quite easy to make a DOS spammer using VFIO in userspace
in the VM to test it with the mlx5 vfio driver.. (though you need VFIO
to work in a VM which RMR will prevent, but that can be hacked around
I guess)

Jason