>  
>  const struct iommu_ops intel_iommu_ops;
> @@ -903,7 +905,8 @@ static void pgtable_walk(struct intel_iommu *iommu, 
> unsigned long pfn, u8 bus, u
>       struct dmar_domain *domain;
>       int offset, level;
>  
> -     info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
> +     info = xa_load(&device_domain_array,
> +                    devi_idx(iommu->segment, bus, devfn));
>       if (!info || !info->domain) {
>               pr_info("device [%02x:%02x.%d] not probed\n",
>                       bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
> @@ -1742,14 +1745,14 @@ static int iommu_init_domains(struct intel_iommu 
> *iommu)

Don't we need a rcu critical section here?

> -     list_for_each_entry_safe(info, tmp, &device_domain_list, global) {
> +     rcu_read_lock();
> +     xa_for_each(&device_domain_array, index, info) {
>               if (info->iommu != iommu)
>                       continue;
>  
> @@ -1758,7 +1761,7 @@ static void disable_dmar_iommu(struct intel_iommu 
> *iommu)
>  
>               __dmar_remove_one_dev_info(info);
>       }
> -     spin_unlock_irqrestore(&device_domain_lock, flags);
> +     rcu_read_unlock();

__dmar_remove_one_dev_info asserts that device_domain_lock is held,
which these two hunks remove.

>       spin_lock_irqsave(&device_domain_lock, flags);
>       dev_iommu_priv_set(dev, NULL);
> -     list_del(&info->global);
> +     xa_erase(&device_domain_array,
> +              devi_idx(info->segment, info->bus, info->devfn));
>       spin_unlock_irqrestore(&device_domain_lock, flags);
>  
>       kfree(info);

Do we need a kfree_rcu here to allow rcu based access?
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to