From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] perf: map pages in advance
Date: Fri, 29 Nov 2024 15:48:33 +0100 [thread overview]
Message-ID: <fda2336c-7d00-4a5d-8a81-4cb1e58bb8ce@redhat.com> (raw)
In-Reply-To: <be33a685-f6e0-41b0-ba3b-d1d7c2d743b8@lucifer.local>
On 29.11.24 15:35, Lorenzo Stoakes wrote:
> On Fri, Nov 29, 2024 at 03:09:49PM +0100, David Hildenbrand wrote:
>>>>> I just tested it and write() works fine, it uses uaccess afaict as part of the
>>>>> lib/iov_iter.c code:
>>>>>
>>>>> generic_perform_write()
>>>>> -> copy_folio_from_iter_atomic()
>>>>> -> copy_page_from_iter_atomic()
>>>>> -> __copy_from_iter()
>>>>> -> copy_from_user_iter()
>>>>> -> raw_copy_from_user()
>>>>> -> copy_user_generic()
>>>>> -> [uaccess asm]
>>>>>
>>>>
>>>> Ah yes. O_DIRECT is the problematic bit I suspect, which will use GUP.
>>>>
>>>> Ptrace access and friends should also no longer work on these pages, likely
>>>> that's tolerable.
>>>
>>> Yeah Peter can interject if not, but I'd be _very_ surprised if anybody expects
>>> to be able to ptrace perf counter mappings in another process (it'd be kind of
>>> totally insane to do that anyway since it's a ring buffer that needs special
>>> handing anyway).
>>
>> I think so as well. Disallowing GUP has some side effects, like not getting
>> these pages included in a coredump etc ... at least I hope nobody uses
>> O_DIRECT on them.
>
> We set VM_DONTDUMP anyway (set by remap_pfn_range() also) so this part won't be
> a problem, and I can't see anybody using O_DIRECT on them, sensibly.
Ah, even better.
>>
>> Actually, the whole thing is on my todo list, because messing with the RMAP
>> with vm_insert_pages() doesn't make any sense (whereby the refcount might!).
>> See the TODO I added in __folio_rmap_sanity_checks().
>
> How long is your TODO list I wonder? :)) I imagine it requires a huge page to
> map at this point..
:D
Too long, but as some of these TODOs stand in the memdesc way,
fortunately other people might be able to give a helping hand at some
point ;)
I'll play with using a page type for some of these "simple" cases and
see how hard it will get.
>
>>
>> --
>> Cheers,
>>
>> David / dhildenb
>>
>
> Cool will respin and send out shortly with an appropriately 'forgive us father
> for we have sinned' comment.
>
> Thanks for taking the time to discuss this! Much appreciated.
Thanks for bearing with me. Whenever PFNMAP/MIXEDMAP is involved it gets
tricky, and as soon as PFNMAP/MIXEDMAP is inevitable, things get ugly. :)
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-11-29 14:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 11:37 Lorenzo Stoakes
2024-11-28 13:08 ` David Hildenbrand
2024-11-28 13:20 ` Lorenzo Stoakes
2024-11-28 13:37 ` David Hildenbrand
2024-11-28 14:23 ` Lorenzo Stoakes
2024-11-29 12:12 ` David Hildenbrand
2024-11-29 12:26 ` Peter Zijlstra
2024-11-29 12:45 ` David Hildenbrand
2024-11-29 12:55 ` Lorenzo Stoakes
2024-11-29 12:59 ` David Hildenbrand
2024-11-29 13:02 ` Lorenzo Stoakes
2024-11-29 13:12 ` David Hildenbrand
2024-11-29 13:19 ` Lorenzo Stoakes
2024-11-29 13:24 ` David Hildenbrand
2024-11-29 13:38 ` Lorenzo Stoakes
2024-11-29 13:47 ` David Hildenbrand
2024-11-29 13:59 ` Lorenzo Stoakes
2024-11-29 14:09 ` David Hildenbrand
2024-11-29 14:35 ` Lorenzo Stoakes
2024-11-29 14:48 ` David Hildenbrand [this message]
2024-11-29 20:42 ` Matthew Wilcox
2024-11-29 12:48 ` Lorenzo Stoakes
2024-11-29 13:11 ` David Hildenbrand
2024-11-28 20:47 ` Lorenzo Stoakes
2024-11-29 8:52 ` Peter Zijlstra
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=fda2336c-7d00-4a5d-8a81-4cb1e58bb8ce@redhat.com \
--to=david@redhat.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=willy@infradead.org \
/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