On 7/21/2021 8:44 AM, Lennert Buytenhek wrote:
For the printing of RMP_HW_ERROR / RMP_PAGE_FAULT / IO_PAGE_FAULT
events, the AMD IOMMU code uses such logic:

        if (pdev)
                dev_data = dev_iommu_priv_get(&pdev->dev);

        if (dev_data && __ratelimit(&dev_data->rs)) {
                pci_err(pdev, ...
        } else {
                printk_ratelimit() / pr_err{,_ratelimited}(...
        }

This means that if we receive an event for a PCI devid which actually
does have a struct pci_dev and an attached struct iommu_dev_data, but
rate limiting kicks in, we'll fall back to the non-PCI branch of the
test, and print the event in a different format.

Fix this by changing the logic to:

        if (dev_data) {
                if (__ratelimit(&dev_data->rs)) {
                        pci_err(pdev, ...
                }
        } else {
                pr_err_ratelimited(...
        }

Suggested-by: Suravee Suthikulpanit<suravee.suthikulpa...@amd.com>
Signed-off-by: Lennert Buytenhek<buyt...@wantstofly.org>

Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to