lkml.org 
[lkml]   [2022]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC 12/13] mm/gup: trigger FAULT_FLAG_UNSHARE when R/O-pinning a possibly shared anonymous page
On Wed, Mar 02, 2022 at 09:38:09PM +0100, David Hildenbrand wrote:

> (a) I want a R/O pin to observe file modifications.
> (b) I want the R/O pin to *not* observe file modifications but observe
> my (eventual? if any) private modifications,

A scenario I know that motivated this is fairly straightfoward:

static char data[] = {};

ibv_reg_mr(data, READ_ONLY)
data[0] = 1
.. go touch data via DMA ..

We want to reliably observe the '1'

What is happening under the covers is that 'data' is placed in the
.data segment and becomes a file backed MAP_PRIVATE page. The write
COWs that page

It would work OK if it was in .bss instead

I think the FOLL_FORCE is there because otherwise the trick doesn't
work on true RO pages and the API becomes broken.

Jason

\
 
 \ /
  Last update: 2022-03-02 22:00    [W:0.062 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site