From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Alexei Starovoitov <ast@kernel.org>,
atish patra <atishp04@gmail.com>,
Daniel Colascione <dancol@google.com>,
Dan Williams <dan.j.williams@intel.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Guenter Roeck <groeck@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
Karim Yaghmour <karim.yaghmour@opersys.com>,
Kees Cook <keescook@chromium.org>,
"Cc: Android Kernel" <kernel-team@android.com>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
linux-trace-devel@vger.kernel.org,
Manoj Rao <linux@manojrajarao.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Qais Yousef <qais.yousef@arm.com>,
Randy Dunlap <rdunlap@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Shuah Khan <shuah@kernel.org>, Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH v7 1/2] Provide in-kernel headers to make extending kernel easier
Date: Sat, 13 Apr 2019 10:30:10 +0900 [thread overview]
Message-ID: <CAK7LNAR=KN3gnJT5w1HgrZ5UyeiNZy_rn1Z1wWwgwy3eGF4RgQ@mail.gmail.com> (raw)
In-Reply-To: <20190412195125.3891-1-joel@joelfernandes.org>
On Sat, Apr 13, 2019 at 4:54 AM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> Introduce in-kernel headers which are made available as an archive
> through proc (/proc/kheaders.tar.xz file). This archive makes it
> possible to run eBPF and other tracing programs that need to extend the
> kernel for tracing purposes without any dependency on the file system
> having headers.
>
> A github PR is sent for the corresponding BCC patch at:
> https://github.com/iovisor/bcc/pull/2312
>
> On Android and embedded systems, it is common to switch kernels but not
> have kernel headers available on the file system. Further once a
> different kernel is booted, any headers stored on the file system will
> no longer be useful. This is an issue even well known to distros.
> By storing the headers as a compressed archive within the kernel, we can
> avoid these issues that have been a hindrance for a long time.
>
> The best way to use this feature is by building it in. Several users
> have a need for this, when they switch debug kernels, they do not want to
> update the filesystem or worry about it where to store the headers on
> it. However, the feature is also buildable as a module in case the user
> desires it not being part of the kernel image. This makes it possible to
> load and unload the headers from memory on demand. A tracing program can
> load the module, do its operations, and then unload the module to save
> kernel memory. The total memory needed is 3.3MB.
>
> By having the archive available at a fixed location independent of
> filesystem dependencies and conventions, all debugging tools can
> directly refer to the fixed location for the archive, without concerning
> with where the headers on a typical filesystem which significantly
> simplifies tooling that needs kernel headers.
>
> The code to read the headers is based on /proc/config.gz code and uses
> the same technique to embed the headers.
>
> Other approaches were discussed such as having an in-memory mountable
> filesystem, but that has drawbacks such as requiring an in-kernel xz
> decompressor which we don't have today, and requiring usage of 42 MB of
> kernel memory to host the decompressed headers at anytime. Also this
> approach is simpler than such approaches.
>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
I just noticed minor typos in comment lines (see below).
Anyway, I have no more comment from the build system of view.
So,
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> diff --git a/kernel/kheaders.c b/kernel/kheaders.c
> new file mode 100644
> index 000000000000..19526294a4e8
> --- /dev/null
> +++ b/kernel/kheaders.c
> @@ -0,0 +1,74 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Provide kernel headers useful to build tracing programs
> + * such as for running eBPF tracing tools.
> + *
> + * (Borrowed code from kernel/configs.c)
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/proc_fs.h>
> +#include <linux/init.h>
> +#include <linux/uaccess.h>
> +
> +/*
> + * Define kernel_headers_data and kernel_headers_data_end, within which the the
> + * compressed kernel headers are stpred. The file is first compressed with xz.
> + */
"the the" -> "the" ?
"stpred" -> "stored" ?
It is up to you if you want to send v8.
--
Best Regards
Masahiro Yamada
prev parent reply other threads:[~2019-04-13 1:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 19:51 [PATCH v7 1/2] Provide in-kernel headers to make extending kernel easier Joel Fernandes (Google)
2019-04-12 19:51 ` [PATCH v7 2/2] init/config: Do not select BUILD_BIN2C for IKCONFIG Joel Fernandes (Google)
2019-04-13 1:30 ` Masahiro Yamada [this message]
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='CAK7LNAR=KN3gnJT5w1HgrZ5UyeiNZy_rn1Z1wWwgwy3eGF4RgQ@mail.gmail.com' \
--to=yamada.masahiro@socionext.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=atishp04@gmail.com \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dancol@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=joel@joelfernandes.org \
--cc=karim.yaghmour@opersys.com \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=linux@manojrajarao.com \
--cc=mhiramat@kernel.org \
--cc=qais.yousef@arm.com \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).