Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5C6EC05027 for ; Mon, 20 Feb 2023 14:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231919AbjBTOuu (ORCPT ); Mon, 20 Feb 2023 09:50:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjBTOus (ORCPT ); Mon, 20 Feb 2023 09:50:48 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FFFE1C5A4 for ; Mon, 20 Feb 2023 06:50:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676904599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14aOzXv8/LFbctYEfZwWWmrtrURJsidYi3oSxaFz0Xw=; b=dJjDqq9nQeGAtaGn/elYkQbmnBvbpDrw1X7OUQKTwZJiInENZvjZL7V6TNiYkReuUVKEke jEIs0SlRZs6jw+u9iaUVHv5n1YXXE+Dvs2XO2xRpBTw8inIndPCUmBwJr0tHyIZuvT4dPL cJjzlCdhSvyT2EWuuBRziSY2o+9udfc= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-315-sMuYcFrLOzOxxaZrgI4i4Q-1; Mon, 20 Feb 2023 09:49:58 -0500 X-MC-Unique: sMuYcFrLOzOxxaZrgI4i4Q-1 Received: by mail-ed1-f72.google.com with SMTP id b1-20020aa7dc01000000b004ad062fee5eso1946263edu.17 for ; Mon, 20 Feb 2023 06:49:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=14aOzXv8/LFbctYEfZwWWmrtrURJsidYi3oSxaFz0Xw=; b=UQwQtKfZM8Gltn1jzXXoXY6XaoOwLL0GcK8o3wqmfKfO/LCQpSG3q+jTYB7nvcjbhy fISAovoBnhstiOrpGgFrmOqtESjbFrA+zhKDXU5zjcpfO+CybRuiJ5lhJjrFt30Tft+n 1LAZRfeR84HwaLBXHuLEegPheF/gCznCVKzFsUXWtU49N/VH1LTAazFTD45h/45DKsfg G/gcqVo3qXCa1mUuNH/86Sb3BwcsnEbvqd8pR35YSgOC3P3T9Ng1QKPD9eftBH4zEXK1 yC++opSKqRLaudtigg8TSwcD0QwfMUJVg8edkqnOMttJJXfILPrcnptbw1tTPo0HPuVl J8cA== X-Gm-Message-State: AO0yUKXqy5stmv6vQlxfcBvMN4LzBcMAr+9/LO/0jOBkp6xUKbQzt2sS UK1FTh3XL830uq8wu/r85ASiOmDe+txn8nfE9Ylu/6bjuZSqTAdDX4B7OMPHiPK91CEf541HjBK fX1Hu5uaKgPhI+whMuJP6yFjF X-Received: by 2002:a17:906:c451:b0:88b:4962:b72f with SMTP id ck17-20020a170906c45100b0088b4962b72fmr7384953ejb.20.1676904597384; Mon, 20 Feb 2023 06:49:57 -0800 (PST) X-Google-Smtp-Source: AK7set+98u/y2Cal3np2ksbwfkOOCjcq6rtCsH8aYGEsMo5bVtK+OVJWU6UbYetsNggJNxfOhh/MAw== X-Received: by 2002:a17:906:c451:b0:88b:4962:b72f with SMTP id ck17-20020a170906c45100b0088b4962b72fmr7384942ejb.20.1676904597149; Mon, 20 Feb 2023 06:49:57 -0800 (PST) Received: from ?IPV6:2a02:810d:4b3f:de78:642:1aff:fe31:a15c? ([2a02:810d:4b3f:de78:642:1aff:fe31:a15c]) by smtp.gmail.com with ESMTPSA id jr14-20020a170906a98e00b008af574fbfc2sm5934451ejb.33.2023.02.20.06.49.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Feb 2023 06:49:56 -0800 (PST) Message-ID: <3bb02ec3-4d19-9135-cabc-26ed210f7396@redhat.com> Date: Mon, 20 Feb 2023 15:00:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH drm-next v2 04/16] maple_tree: add flag MT_FLAGS_LOCK_NONE Content-Language: en-US To: Matthew Wilcox Cc: matthew.brost@intel.com, dri-devel@lists.freedesktop.org, corbet@lwn.net, nouveau@lists.freedesktop.org, ogabbay@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, boris.brezillon@collabora.com, bskeggs@redhat.com, tzimmermann@suse.de, Liam.Howlett@oracle.com, bagasdotme@gmail.com, christian.koenig@amd.com, jason@jlekstrand.net References: <20230217134422.14116-1-dakr@redhat.com> <20230217134422.14116-5-dakr@redhat.com> From: Danilo Krummrich Organization: RedHat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/17/23 20:38, Matthew Wilcox wrote: > On Fri, Feb 17, 2023 at 02:44:10PM +0100, Danilo Krummrich wrote: >> Generic components making use of the maple tree (such as the >> DRM GPUVA Manager) delegate the responsibility of ensuring mutual >> exclusion to their users. >> >> While such components could inherit the concept of an external lock, >> some users might just serialize the access to the component and hence to >> the internal maple tree. >> >> In order to allow such use cases, add a new flag MT_FLAGS_LOCK_NONE to >> indicate not to do any internal lockdep checks. > > I'm really against this change. > > First, we really should check that users have their locking right. > It's bitten us so many times when they get it wrong. In case of the DRM GPUVA manager, some users might serialize the access to the GPUVA manager and hence to it's maple tree instances, e.g. through the drm_gpu_scheduler. In such a case ensuring to hold a lock would be a bit pointless and I wouldn't really know how to "sell" this to potential users of the GPUVA manager. > > Second, having a lock allows us to defragment the slab cache. The > patches to do that haven't gone anywhere recently, but if we drop the > requirement now, we'll never be able to compact ranges of memory that > have slabs allocated to them. > Not sure if I get that, do you mind explaining a bit how this would affect other users of the maple tree, such as my use case, the GPUVA manager?