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

From: Baolu Lu
Date: Thu Feb 08 2024 - 21:40:26 EST


On 2024/2/8 16:38, Tian, Kevin wrote:
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.

Yes. I planned to fix the locking issue in a separated series.

Best regards,
baolu