Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp415793rwd; Wed, 17 May 2023 21:24:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7H3N+kEHBeT55BFQsmnV1mmvdfmwL//E69f2DQVL3fMT9XZ+z4JE0YK28Q2KH/OjbYX9Cc X-Received: by 2002:a05:6a20:7287:b0:100:bae5:acf3 with SMTP id o7-20020a056a20728700b00100bae5acf3mr754413pzk.37.1684383888272; Wed, 17 May 2023 21:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684383888; cv=none; d=google.com; s=arc-20160816; b=YoMNw6FGGSd3+HA9RqUKmn61yY7bO3sO+F5uGSLZysGs8TWf+3dtMF8YdYVLjxJDQc pPeBsQAILYmSsCBGCCTp6Z0fokZVXB8g4PO+5m+uHJpgTYnZHjmzIdMn18tRCdUB56E5 mBOPSZBt3N/HiN01481qJLFjTSqMCSolnqOQTvqB/+l7kLEu7BqPhZajvvPy1VnvQjto IhRcSpeiehBqGyyr9VSf3fRhzlgNOwSdBnA7CtY94iEa0p6pynI4Kec1z11lRJ7oGv+M 5NoyDekNKv2f0ngvFpX9ID8tXUTQwu/qpDaQ80ak1l0eW+eJo2eGmptRShWyXmwG4Bb7 i6Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XIkCd52W+zN1SoFPBBm4oRim+UuYVpQOjJ1oTywL0QA=; b=FRa3rtvOrW7pHS+uIBOD+L3Fl1XwKZ/2y6C5l2CIB+aZbA9wiLZrO48YfiA5ixNouw i3vM+ic7GmwmFI+1jZsvXMXJlcJ/1UwqyE9t9nbAL2QNsBZDfGEXSnpOA12GCf8miIrQ s9V3A2WpcqZmN5Xx5SedKT0O645qoCbDHF0mjwYWHrxSOF9QVWsOY17tOW1XPbqpoPlt dIG6++gySRARDMQmJp+sCvafObBYpmvA4RRyWyWNs8gBIAtBpSi14XfkxSgWiFW8Iy18 B6MhjODz0vRqulrthX+LdJ/xuOi3FkvlATouaSeqZkm9md1RBvPOj3QUBYCcb0I+TVZY iq+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=jeegl84L; 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 c5-20020a633505000000b0052c75ef69b6si515169pga.231.2023.05.17.21.24.36; Wed, 17 May 2023 21:24:48 -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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=jeegl84L; 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 S230010AbjEREVO (ORCPT + 99 others); Thu, 18 May 2023 00:21:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbjEREVI (ORCPT ); Thu, 18 May 2023 00:21:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F0B035AD for ; Wed, 17 May 2023 21:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XIkCd52W+zN1SoFPBBm4oRim+UuYVpQOjJ1oTywL0QA=; b=jeegl84LJTWlBvMYHO6PjMdDOZ bHFnD2cjDSkO9WsX8M0mJPhrPc5QnpgcLPvvcqFDTU2v5dx7rIVO4y1ptyGkIrXJL9vKSWz3FrFAe jWlyQJGTJTJJCU2eSZ57ncHshcFo62zj6HBUHeJ6cYTTyr2wKaYItDCsTo1Qv6df1wZu56SNewTU8 XrW7oDDOM3PRMh9I3LGqIU49LiEBcvIbuBG44FDLmyun/cKcamm4sJBrvScr+zmVUMshR2+f5zRzu 98hmyKVBf+Nk6YnDTfPJPMLS4UZYf1+IHxvdTKQVkm9Ny3D+zy+gdMAdjAO7j/obg3S73305dWtFo mKCcUBjw==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pzV8N-00Bq7k-20; Thu, 18 May 2023 04:20:59 +0000 Date: Wed, 17 May 2023 21:20:59 -0700 From: Christoph Hellwig To: David Hildenbrand Cc: Sumit Garg , Christoph Hellwig , Xiaoming Ding , Jens Wiklander , Matthias Brugger , AngeloGioacchino Del Regno , op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, fei.xu@mediatek.com, srv_heupstream@mediatek.com, linux-mm@kvack.org Subject: FOLL_LONGTERM vs FOLL_EPHEMERAL Re: [PATCH] tee: add FOLL_LONGTERM for CMA case when alloc shm Message-ID: References: <20230517031856.19660-1-xiaoming.ding@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Wed, May 17, 2023 at 08:23:33PM +0200, David Hildenbrand wrote: > In general: if user space controls it -> possibly forever -> long-term. Even > if in most cases it's a short delay: there is no trusting on user space. > > For example, iouring fixed buffers keep pages pinned until user space > decides to unregistered the buffers -> long-term. > > Short-term is, for example, something like O_DIRECT where we pin -> DMA -> > unpin in essentially one operation. Btw, one thing that's been on my mind is that I think we got the polarity on FOLL_LONGTERM wrong. Instead of opting into the long term behavior it really should be the default, with a FOLL_EPHEMERAL flag to opt out of it. And every users of this flag is required to have a comment explaining the life time rules for the pin..