[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250506172941.GB33739@ziepe.ca>
Date: Tue, 6 May 2025 14:29:41 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Kevin Tian <kevin.tian@...el.com>, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] iommu/vt-d: Replace spin_lock with mutex to
protect domain ida
On Wed, Apr 30, 2025 at 10:11:35AM +0800, Lu Baolu wrote:
> The domain ID allocator is currently protected by a spin_lock. However,
> ida_alloc_range can potentially block if it needs to allocate memory to
> grow its internal structures.
>
> Replace the spin_lock with a mutex which allows sleep on block. Thus,
> the memory allocation flags can be updated from GFP_ATOMIC to GFP_KERNEL
> to allow blocking memory allocations if necessary.
>
> Introduce a new mutex, did_lock, specifically for protecting the domain
> ida. The existing spinlock will remain for protecting other intel_iommu
> fields.
>
> Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@...el.com>
> ---
> drivers/iommu/intel/dmar.c | 1 +
> drivers/iommu/intel/iommu.c | 12 ++++--------
> drivers/iommu/intel/iommu.h | 2 ++
> 3 files changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Jason
Powered by blists - more mailing lists