lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/9] iommu/dma-iommu: Add iommu_map_atomic
    On Thu, Apr 11, 2019 at 07:47:30PM +0100, Tom Murphy via iommu wrote:
    > The iommu ops .map function (or the iommu_map function which calls it)
    > was always supposed to be sleepable (according to Joerg's comment in
    > this thread: https://lore.kernel.org/patchwork/patch/977520/ ) and so
    > should probably have had a "might_sleep()" since it was written. However
    > currently the dma-iommu api can call iommu_map in an atomic context,
    > which it shouldn't do. This doesn't cause any problems because any iommu
    > driver which uses the dma-iommu api uses gfp_atomic in it's iommu_ops
    > .map function. But doing this wastes the memory allocators atomic pools.
    >
    > Add a new function iommu_map_atomic, use it in the dma-iommu api and add
    > “might_sleep()” to the iommu_map function.
    >
    > After this change all drivers which use the dma-iommu api need to
    > implement the new iommu ops .map_atomic function. For the moment just
    > reuse the driver's iommus ops .map function for .map_atomic.

    Instead of duplicating the callchain shouldn't we just pass down a flag
    to indicate if the context can sleep or not? Especially as all the
    existing arm drivers already implement the atomic behavior, which is
    a majority of struct iommu_ops based iommu drivers.

    \
     
     \ /
      Last update: 2019-04-15 08:32    [W:4.847 / U:1.140 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site