From: Peter Zijlstra <peterz@infradead.org>
To: Song Liu <songliubraving@fb.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
the arch/x86 maintainers <x86@kernel.org>,
bpf <bpf@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"andrii@kernel.org" <andrii@kernel.org>,
Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 2/7] set_memory: introduce set_memory_[ro|x]_noalias
Date: Thu, 18 Nov 2021 19:28:42 +0100 [thread overview]
Message-ID: <20211118182842.GJ174703@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <9DB9C25B-735F-4310-B937-56124DB59CDF@fb.com>
On Thu, Nov 18, 2021 at 05:16:24PM +0000, Song Liu wrote:
>
>
> > On Nov 17, 2021, at 11:54 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Wed, Nov 17, 2021 at 11:57:12PM +0000, Song Liu wrote:
> >
> >> I would agree that __text_poke() is a safer option. But in this case, we
> >> will need the temporary hole to be 2MB in size. Also, we will probably
> >> hold the temporary mapping for longer time (the whole JITing process).
> >> Does this sound reasonable?
> >
> > No :-)
> >
> > Jit to a buffer, then copy the buffer into the 2M page using 4k aliases.
> > IIRC each program is still smaller than a single page, right? So at no
> > point do you need more than 2 pages mapped anyway.
>
> JITing to a separate buffer adds complexity to the JIT process, as we
> need to redo some offsets before the copy to match the final location of
> the program. I don't have much experience with the JIT engine, so I am
> not very sure how much work it gonna be.
You're going to have to do that anyway if you're going to write to the
directmap while executing from the alias.
> The BPF program could have up to 1000000 (BPF_COMPLEXITY_LIMIT_INSNS)
> instructions (BPF instructions). So it could easily go beyond a few
> pages. Mapping the 2MB page all together should make the logic simpler.
Then copy it in smaller chunks I suppose.
next prev parent reply other threads:[~2021-11-18 18:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211116071347.520327-1-songliubraving@fb.com>
[not found] ` <20211116071347.520327-3-songliubraving@fb.com>
2021-11-16 8:00 ` [PATCH bpf-next 2/7] set_memory: introduce set_memory_[ro|x]_noalias Peter Zijlstra
2021-11-17 21:36 ` Song Liu
2021-11-17 22:01 ` Peter Zijlstra
2021-11-17 23:57 ` Song Liu
2021-11-18 0:11 ` Song Liu
2021-11-18 7:54 ` Peter Zijlstra
2021-11-18 17:16 ` Song Liu
2021-11-18 18:28 ` Peter Zijlstra [this message]
2021-11-18 18:39 ` Song Liu
2021-11-18 18:58 ` Peter Zijlstra
2021-11-19 4:14 ` Song Liu
2021-11-19 9:35 ` Peter Zijlstra
2021-11-19 16:06 ` Johannes Weiner
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=20211118182842.GJ174703@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Kernel-team@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=hannes@cmpxchg.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.