From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1285C433E1 for ; Thu, 30 Jul 2020 13:17:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 585332074B for ; Thu, 30 Jul 2020 13:17:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Tj45p5a0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726772AbgG3NR1 (ORCPT ); Thu, 30 Jul 2020 09:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbgG3NR0 (ORCPT ); Thu, 30 Jul 2020 09:17:26 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A12C061794 for ; Thu, 30 Jul 2020 06:17:26 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id q9so4358335oth.5 for ; Thu, 30 Jul 2020 06:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=l6NNuTlAlb+T71eovQReK+men4boXEXZJmc745e1mek=; b=Tj45p5a06zkqFl6bUdtEmCxMS67sh1pLfLaP0MJK1JKsob6GFGtCQSeLESCL2s30Bo ou0Hr4WM+OKrYig/4okfOklio8NyYxv+hqW65aWlMC+/KH2ReSdB2qWfNUvAmIpCL5GB NCD+kQkkx7Q/TROpmA3URVMeplfnD5XbvU6DY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=l6NNuTlAlb+T71eovQReK+men4boXEXZJmc745e1mek=; b=leF8XmofnOQw/0tfIsRvkp9RxFE5zr3ObSRG97l99uzcnJbg4WGFLxzOQxp8OmDLK1 rgXXfymU/+elmASP/TW2hNMd4J6Lz7W76k5vyrhekDOAxzBAlVIQmQy+SqXfaUWYTWZX Xzb9d+aApc4IHowWR3arrbahcXDs7yVvk6boW5Do86C2lSGIupDm+ublXJGJlyNA28mh sDVT7AP0DhWKzYExvruM1rFOezMyCgweuWp0uHHSv5piwdpttAdp170RBojm2JJZc8k3 2jqs0kD82+EiZA5aKjWOca9R3P9L7EosQZTFfNp5B3/E2jQR/RkHKiHgXl8WTswWmlU8 bARg== X-Gm-Message-State: AOAM530aRj8TtBBAwOO/yHogEPCjN21hmCMpPcAAMckRugD0uYpMQvV9 zKlVEek5ZIPS7ccNR5dT3h3PZGQo2LrbFy7NZ8056g== X-Google-Smtp-Source: ABdhPJyT+P5EKFUT/rekKMDvcsT0JZ6B1aXbsvpwMmAI2gySdtJl4PHRq6e+n9dVUTuKG5DRk4IoPKAkcy7FpSExRU8= X-Received: by 2002:a9d:6052:: with SMTP id v18mr2134622otj.303.1596115045756; Thu, 30 Jul 2020 06:17:25 -0700 (PDT) MIME-Version: 1.0 References: <20200728135839.1035515-1-daniel.vetter@ffwll.ch> <38cbc4fb-3a88-47c4-2d6c-4d90f9be42e7@shipmail.org> In-Reply-To: <38cbc4fb-3a88-47c4-2d6c-4d90f9be42e7@shipmail.org> From: Daniel Vetter Date: Thu, 30 Jul 2020 15:17:14 +0200 Message-ID: Subject: Re: [PATCH] dma-resv: lockdep-prime address_space->i_mmap_rwsem for dma-resv To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m_=28Intel=29?= Cc: DRI Development , Intel Graphics Development , Daniel Vetter , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , "open list:DMA BUFFER SHARING FRAMEWORK" , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Dave Chinner , Qian Cai , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Jason Gunthorpe , Linux MM , linux-rdma , Maarten Lankhorst Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Thu, Jul 30, 2020 at 2:17 PM Thomas Hellstr=C3=B6m (Intel) wrote: > > > On 7/28/20 3:58 PM, Daniel Vetter wrote: > > GPU drivers need this in their shrinkers, to be able to throw out > > mmap'ed buffers. Note that we also need dma_resv_lock in shrinkers, > > but that loop is resolved by trylocking in shrinkers. > > > > So full hierarchy is now (ignore some of the other branches we already > > have primed): > > > > mmap_read_lock -> dma_resv -> shrinkers -> i_mmap_lock_write > > > > I hope that's not inconsistent with anything mm or fs does, adding > > relevant people. > > > Looks OK to me. The mapping_dirty_helpers run under the i_mmap_lock, but > don't allocate any memory AFAICT. > > Since huge page-table-entry splitting may happen under the i_mmap_lock > from unmap_mapping_range() it might be worth figuring out how new page > directory pages are allocated, though. ofc I'm not an mm expert at all, but I did try to scroll through all i_mmap_lock_write/read callers. Found the following: - kernel/events/uprobes.c in build_map_info: /* * Needs GFP_NOWAIT to avoid i_mmap_rwsem recursion through * reclaim. This is optimistic, no harm done if it fails. */ - I got lost in the hugetlb.c code and couldn't convince myself it's not allocating page directories at various levels with something else than GFP_KERNEL. So looks like the recursion is clearly there and known, but the hugepage code is too complex and flying over my head. -Daniel > > /Thomas > > > --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch