[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220225140617.63a95344@jacob-builder>
Date: Fri, 25 Feb 2022 14:09:37 -0800
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Joerg Roedel <joro@...tes.org>, Kevin Tian <kevin.tian@...el.com>,
Ashok Raj <ashok.raj@...el.com>, Liu Yi L <yi.l.liu@...el.com>,
Robin Murphy <robin.murphy@....com>,
Jason Gunthorpe <jgg@...dia.com>,
Christoph Hellwig <hch@....de>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH v1 09/10] iommu/vt-d: Refactor
dmar_insert_one_dev_info()
Hi BaoLu,
On Mon, 7 Feb 2022 14:41:41 +0800, Lu Baolu <baolu.lu@...ux.intel.com>
wrote:
>
> - if (dev && domain_context_mapping(domain, dev)) {
> - dev_err(dev, "Domain context map failed\n");
> - dmar_remove_one_dev_info(dev);
> - return NULL;
> - }
> + /* Setup the context entry for device: */
> + ret = domain_context_mapping(domain, dev);
> + if (ret)
> + goto setup_context_err;
>
> - return domain;
> + info->domain = domain;
> + list_add_rcu(&info->link, &domain->devices);
> +
There seems to be an ordering problem. We need to do list_add_rcu()
*before* domain_context_mapping(). Otherwise, while doing context mapping
the search for dev IOTLB support in iommu_support_dev_iotlb() will fail.
Then ATS capable device context will not have DTE bit set. The result is
DMAR unrecoverable fault while doing DMA.
Thanks,
Jacob
Powered by blists - more mailing lists