lkml.org 
[lkml]   [2023]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [RFC v1 1/4] dma-mapping: introduce the DMA_ATTR_MAY_SLEEP attribute
    On 3/28/2023 5:57 AM, Christoph Hellwig wrote:
    > On Mon, Mar 20, 2023 at 01:28:13PM +0100, Petr Tesarik wrote:
    >> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
    >>
    >> Introduce a DMA attribute to tell the DMA-mapping subsystem that
    >> the operation is allowed to sleep.
    >>
    >> This patch merely adds the flag, which is not used for anything at
    >> the moment. It should be used by users who can sleep (e.g. dma-buf
    >> ioctls) to allow page reclaim and/or allocations from CMA.
    >
    > So what drivers would call this? As-is it doesn't have any users in
    > the series.

    Yes, I removed one patch from the RFC series to reduce the Cc list while
    I wasn't sure if the proposal would be considered at all.

    The full series in my local tree added it to the implementation of
    DRM_IOCTL_PRIME_FD_TO_HANDLE:

    diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
    index f924b8b4ab6b..f32e12445570 100644
    --- a/drivers/gpu/drm/drm_prime.c
    +++ b/drivers/gpu/drm/drm_prime.c
    @@ -635,7 +635,7 @@ struct sg_table *drm_gem_map_dma_buf(struct
    dma_buf_attachment *attach,
    return sgt;

    ret = dma_map_sgtable(attach->dev, sgt, dir,
    - DMA_ATTR_SKIP_CPU_SYNC);
    + DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MAY_SLEEP);
    if (ret) {
    sg_free_table(sgt);
    kfree(sgt);
    I also noticed a similar place in udmabuf, but since I don't have a use
    case ATM, I haven't added the flag there (yet).

    Petr T

    \
     
     \ /
      Last update: 2023-03-28 09:23    [W:7.273 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site