From: Song Liu <songliubraving@meta.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
Luis Chamberlain <mcgrof@kernel.org>
Cc: Song Liu <songliubraving@meta.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
Kernel Team <Kernel-team@fb.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"song@kernel.org" <song@kernel.org>, "hch@lst.de" <hch@lst.de>,
"x86@kernel.org" <x86@kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"Hansen, Dave" <dave.hansen@intel.com>,
"urezki@gmail.com" <urezki@gmail.com>
Subject: Re: [RFC v2 4/4] vmalloc_exec: share a huge page with kernel text
Date: Wed, 12 Oct 2022 19:01:44 +0000 [thread overview]
Message-ID: <0209B426-E425-44C2-825C-8AAC59B5BB2D@fb.com> (raw)
In-Reply-To: <6fb1ef25df1caa7206572f24a70da0c2f2714135.camel@intel.com>
> On Oct 12, 2022, at 11:38 AM, Edgecombe, Rick P <rick.p.edgecombe@intel.com> wrote:
>
> On Wed, 2022-10-12 at 05:37 +0000, Song Liu wrote:
>>> Then you have code that operates on module text like:
>>> if (is_vmalloc_or_module_addr(addr))
>>> pfn = vmalloc_to_pfn(addr);
>>>
>>> It looks like it would work (on x86 at least). Should it be
>>> expected
>>> to?
>>>
>>> Especially after this patch, where there is memory that isn't even
>>> tracked by the original vmap_area trees, it is pretty much a
>>> separate
>>> allocator. So I think it might be nice to spell out which other
>>> vmalloc
>>> APIs work with these new functions since they are named "vmalloc".
>>> Maybe just say none of them do.
>>
>> I guess it is fair to call this a separate allocator. Maybe
>> vmalloc_exec is not the right name? I do think this is the best
>> way to build an allocator with vmap tree logic.
>
> Yea, I don't know about the name. I think someone else suggested it
> specifically, right?
I think Luis suggested rename module_alloc to vmalloc_exec. But I
guess we still need module_alloc for module data allocations.
>
> I had called mine perm_alloc() so it could also handle read-only and
> other permissions.
What are other permissions that we use? We can probably duplicate
the free_text_are_ tree logic for other cases.
> If you keep vmalloc_exec() it needs some big
> comments about which APIs can work with it, and an audit of the
> existing code that works on module and JIT text.
>
>>
>>>
>>>
>>> Separate from that, I guess you are planning to make this limited
>>> to
>>> certain architectures? It might be better to put logic with
>>> assumptions
>>> about x86 boot time page table details inside arch/x86 somewhere.
>>
>> Yes, the architecture need some text_poke mechanism to use this.
>
> It also depends on the space between _etext and the PMD aligned _etext
> to be present and not get used by anything else. For other
> architectures, there might be rodata there or other things.
Good point! We need to make sure this part is not used by other things.
>
>> On BPF side, x86_64 calls this directly from arch code (jit engine),
>> so it is mostly covered. For modules, we need to handle this better.
>
> That old RFC has some ideas around this. I kind of like your
> incremental approach though. To me it seems to be moving in the right
> direction.
Thanks!
Song
next prev parent reply other threads:[~2022-10-12 19:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 23:43 [RFC v2 0/4] vmalloc_exec for modules and BPF programs Song Liu
2022-10-07 23:43 ` [RFC v2 1/4] vmalloc: introduce vmalloc_exec and vfree_exec Song Liu
2022-10-10 18:13 ` Edgecombe, Rick P
2022-10-10 19:04 ` Song Liu
2022-10-10 19:59 ` Edgecombe, Rick P
2022-10-07 23:43 ` [RFC v2 2/4] bpf: use vmalloc_exec Song Liu
2022-10-07 23:43 ` [RFC v2 3/4] modules, x86: use vmalloc_exec for module core Song Liu
2022-10-14 3:48 ` Aaron Lu
2022-10-14 6:07 ` Song Liu
[not found] ` <fb7a38faa52ce0f35061473c9c8b56394a726e59.camel@intel.com>
2022-10-14 18:26 ` Song Liu
2022-10-07 23:43 ` [RFC v2 4/4] vmalloc_exec: share a huge page with kernel text Song Liu
2022-10-10 18:32 ` Edgecombe, Rick P
2022-10-10 19:08 ` Song Liu
2022-10-10 20:09 ` Edgecombe, Rick P
[not found] ` <2B66E2E7-7D32-418C-9DFD-1E17180300B4@fb.com>
2022-10-11 20:40 ` Edgecombe, Rick P
2022-10-12 5:37 ` Song Liu
2022-10-12 18:38 ` Edgecombe, Rick P
2022-10-12 19:01 ` Song Liu [this message]
2022-10-08 0:17 ` [RFC v2 0/4] vmalloc_exec for modules and BPF programs Song Liu
2022-10-12 19:03 ` Song Liu
2022-10-17 7:26 ` Christoph Hellwig
2022-10-17 16:23 ` Song Liu
2022-10-18 14:50 ` Christoph Hellwig
2022-10-18 15:05 ` Song Liu
2022-10-18 15:40 ` Christoph Hellwig
2022-10-18 15:40 ` Christoph Hellwig
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=0209B426-E425-44C2-825C-8AAC59B5BB2D@fb.com \
--to=songliubraving@meta.com \
--cc=Kernel-team@fb.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=song@kernel.org \
--cc=urezki@gmail.com \
--cc=x86@kernel.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