Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3976562rwl; Tue, 28 Mar 2023 00:23:13 -0700 (PDT) X-Google-Smtp-Source: AKy350ZSJoAxXSXTH01YOIvPkZZXCnO+Xue4vMIkSIuCODoh6AFCEf7jeHKUx4LzLyejiqEoFIkb X-Received: by 2002:a17:90a:1990:b0:23d:16d6:2f05 with SMTP id 16-20020a17090a199000b0023d16d62f05mr16481706pji.22.1679988193367; Tue, 28 Mar 2023 00:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679988193; cv=none; d=google.com; s=arc-20160816; b=HO2hBsNBZZD0pKxmcN6EWmoW4epBgtZMysK3rt9IqVuObPaUBDWTlJUOliEBqJ2jLZ 3BZyWWS2/feGgTl0zDlR4shlHWR1e6DM40iyXsWfRZtnA7sPWciq0aKQuNVyCu6s1qpO +RA+zBJIE2lJGzY1/prGpjUUqYmRQ9IN5Xg9BxrSR+Q7b1bQnYw+g1qTfpq8T1WaifzA ozb77drImvabNvv0gB9gYKkqnpCFl3Hv5NZiVY8EktwsMlNeGo1iaVp6SGzDRHvW6kKE tqgSOmveoKq06Xk3oqOXv1sIrOaqLh307SRwv97BurzqKdh9rxAPQU7Jn9x+dbKu9adi GjKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=K/61gishRPPzlOLpM7hX+veXHEU9Df+DGTwTG7Dfce8=; b=YrQJdl+oPxwik7XYnFrjBZETlLaGiW5GRBexfT2wTO4e44XaY4CsYfImit9/B5681k iYlruueTCwyTeHoXl0KAmmkCqV4W6k79lSTkIk+gCX542yql78OGAmCGgkJnssMEyBFx ENzHVmtO2XS6sMybv5LZZVCrGuIS+tBimgMQC0sslm0HAEw3p1U0qFLfDiLn8cEclQND uafRznEFdR7pslrueKVrOmgCrzM5cVEChmpa4p3r1KSMtXxlcvc7HXRYGqPjabfMGnCs tG7c2NaoG3UaYr71qh4ymuHAifev4Y0gEa3CxtgO9jTVGpLbDerF+pgDsvnWTv6MzxBd XZuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a17090aba8800b00233ce76f19dsi12020833pjr.11.2023.03.28.00.22.59; Tue, 28 Mar 2023 00:23:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjC1HV7 (ORCPT + 99 others); Tue, 28 Mar 2023 03:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbjC1HV6 (ORCPT ); Tue, 28 Mar 2023 03:21:58 -0400 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B1A212B; Tue, 28 Mar 2023 00:21:53 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4Pm18H5MnLz9xHMD; Tue, 28 Mar 2023 15:11:59 +0800 (CST) Received: from [10.48.131.174] (unknown [10.48.131.174]) by APP2 (Coremail) with SMTP id GxC2BwCXamFplSJkH5LUAQ--.63553S2; Tue, 28 Mar 2023 08:21:23 +0100 (CET) Message-ID: Date: Tue, 28 Mar 2023 09:21:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 From: Petr Tesarik Subject: Re: [RFC v1 1/4] dma-mapping: introduce the DMA_ATTR_MAY_SLEEP attribute To: Christoph Hellwig Cc: Jonathan Corbet , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Andrew Morton , Randy Dunlap , Damien Le Moal , Kim Phillips , "Steven Rostedt (Google)" , "open list:DOCUMENTATION" , open list , "open list:DMA MAPPING HELPERS" , Roberto Sassu , petr@tesarici.cz References: <20230328035725.GA25506@lst.de> Content-Language: en-US In-Reply-To: <20230328035725.GA25506@lst.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID: GxC2BwCXamFplSJkH5LUAQ--.63553S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Zr4fJr1UWFWfCFWrZw4rAFb_yoW8GFyUpF s3tFy7trs8tF4FvasrZw4DZF9Y9a1xJrWru3Wjvwn3urn8uFsFkry2yFW2934DJrnrJ3yS vrZFk345Z34UC37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv2b4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWUJVW8JwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1lc7I2V7IY0VAS 07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_ WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAF wI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa 7IU13rcDUUUUU== X-CM-SenderInfo: hshw23xhvd2x3n6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=NICE_REPLY_A,SPF_HELO_NONE, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> >> 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