RE: [PATCH rc 3/8] iommu/vt-d: Add missing iotlb flush for parent domain

From: Tian, Kevin
Date: Thu Feb 08 2024 - 03:39:07 EST


> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Thursday, February 8, 2024 4:23 PM
>
> +/*
> + * Flush the relevant caches in nested translation if the domain
> + * also serves as a parent
> + */
> +static void parent_domain_flush(struct dmar_domain *domain,
> + unsigned long pfn,
> + unsigned long pages, int ih)
> +{
> + struct dmar_domain *s1_domain;
> +
> + spin_lock(&domain->s1_lock);
> + list_for_each_entry(s1_domain, &domain->s1_domains, s2_link) {
> + struct iommu_domain_info *info;
> + unsigned long i;
> +
> + xa_for_each(&s1_domain->iommu_array, i, info)
> + __iommu_flush_iotlb_psi(info->iommu, info->did,
> + pfn, pages, ih);
> + }

As Jason suggested before this xarray lacks of proper locking.

but given it's rc fix I'm fine with it. @Baolu we do need fix it soon so
this problem won't further expand like here.

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>