From: Hiroshi Doyu Subject: Re: [PATCH 1/1] iommu/tegra: smmu: Fix unsleepable memory allocation Date: Thu, 28 Jun 2012 13:42:02 +0300 Message-ID: <20120628134202.2102f715496a3b980b43f3b0@nvidia.com> References: <20120627.124628.673793050413876363.hdoyu@nvidia.com> <1340790841-23349-1-git-send-email-hdoyu@nvidia.com> <4FEB3C04.6040606@wwwdotorg.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FEB3C04.6040606-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Stephen Warren , Chris Wright Cc: "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" List-Id: iommu@lists.linux-foundation.org On Wed, 27 Jun 2012 18:59:48 +0200 Stephen Warren wrote: > On 06/27/2012 03:54 AM, Hiroshi DOYU wrote: > > allo_pdir() is called in smmu_iommu_domain_init() with spin_lock > > held. memory allocations in it have to be atomic/unsleepable. > > Presumably this will cause allocation failures in situations with heavy > memory pressure, rather than triggering swapping. Is it normal for IOMMU > drivers to work that way? If so, I'm fine with it. Otherwise, can the > allocations be performed before the spinlock is taken? There are some requirement for atomic allocation from DMA mapping API, but it's not normla for IOMMU, especiall not for iommu_domain_alloc(). It has already used GFP_KERNEL and then, calls ->iommu_domain_init() in it. The update patch v2 follows.