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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 616A4C77B7D for ; Thu, 18 May 2023 04:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbjEREVP (ORCPT ); Thu, 18 May 2023 00:21:15 -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 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..