From: David Hildenbrand <david@redhat.com>
To: Sumit Garg <sumit.garg@linaro.org>,
Christoph Hellwig <hch@infradead.org>
Cc: Xiaoming Ding <xiaoming.ding@mediatek.com>,
Jens Wiklander <jens.wiklander@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
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: Re: FOLL_LONGTERM vs FOLL_EPHEMERAL Re: [PATCH] tee: add FOLL_LONGTERM for CMA case when alloc shm
Date: Thu, 18 May 2023 15:56:09 +0200 [thread overview]
Message-ID: <8b898768-a3c0-198d-a70c-9aa96b7f4a29@redhat.com> (raw)
In-Reply-To: <CAFA6WYPgvifYcj_MT7BBcC0BtQDWXV0u+HY8qv0M9nNyiCgkow@mail.gmail.com>
On 18.05.23 08:08, Sumit Garg wrote:
> On Thu, 18 May 2023 at 09:51, Christoph Hellwig <hch@infradead.org> wrote:
>>
>> 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..
>
> It does look like a better approach to me given the very nature of
> user space pages.
Yeah, there is a lot of historical baggage. For example, FOLL_GET should
be inaccessible to kernel modules completely at one point, to be only
used by selected core-mm pieces.
Maybe we should even disallow passing in FOLL_LONGTERM as a flag and
only provide functions like pin_user_pages() vs.
pin_user_pages_longterm(). Then, discussions about conditional
flag-setting are no more :)
... or even use pin_user_pages_shortterm() vs. pin_user_pages() ... to
make the default be longterm.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-05-18 13:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230517031856.19660-1-xiaoming.ding@mediatek.com>
2023-05-17 7:34 ` Christoph Hellwig
2023-05-17 7:52 ` Sumit Garg
2023-05-17 8:08 ` Christoph Hellwig
2023-05-17 9:02 ` Xiaoming Ding (丁晓明)
2023-05-17 9:26 ` Sumit Garg
2023-05-17 9:36 ` Christoph Hellwig
2023-05-17 10:19 ` Sumit Garg
2023-05-17 18:23 ` David Hildenbrand
2023-05-18 4:20 ` FOLL_LONGTERM vs FOLL_EPHEMERAL " Christoph Hellwig
2023-05-18 6:08 ` Sumit Garg
2023-05-18 13:56 ` David Hildenbrand [this message]
2023-05-23 1:54 ` John Hubbard
2023-05-23 7:25 ` Lorenzo Stoakes
2023-06-13 5:30 ` Xiaoming Ding (丁晓明)
2023-06-13 8:48 ` Sumit Garg
2023-05-18 6:40 ` Xiaoming Ding (丁晓明)
2023-05-19 10:01 ` David Hildenbrand
2023-05-19 11:03 ` Sumit Garg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b898768-a3c0-198d-a70c-9aa96b7f4a29@redhat.com \
--to=david@redhat.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=fei.xu@mediatek.com \
--cc=hch@infradead.org \
--cc=jens.wiklander@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=matthias.bgg@gmail.com \
--cc=op-tee@lists.trustedfirmware.org \
--cc=srv_heupstream@mediatek.com \
--cc=sumit.garg@linaro.org \
--cc=xiaoming.ding@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox