All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexei Starovoitov <ast@kernel.org>,
	atishp04@gmail.com, dancol@google.com,
	Dan Williams <dan.j.williams@intel.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Guenter Roeck <groeck@chromium.org>,
	Jonathan Corbet <corbet@lwn.net>,
	karim.yaghmour@opersys.com, Kees Cook <keescook@chromium.org>,
	Android Kernel Team <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>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	qais.yousef@arm.com, Randy Dunlap <rdunlap@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Shuah Khan <shuah@kernel.org>,
	yhs@fb.com
Subject: Re: [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel
Date: Thu, 7 Mar 2019 11:54:33 -0500	[thread overview]
Message-ID: <20190307165433.GA90983@google.com> (raw)
In-Reply-To: <20190307152303.GA9819@kroah.com>

On Thu, Mar 07, 2019 at 04:23:03PM +0100, Greg KH wrote:
> > > On Fri, Mar 1, 2019 at 5:10 PM Joel Fernandes (Google)
> > > <joel@joelfernandes.org> wrote:
> > > > Introduce in-kernel headers and other artifacts which are made available
> > > > as an archive through proc (/proc/kheaders.tar.xz file). This archive makes
> > > > it possible to build kernel modules, run eBPF programs, and other
> > > > tracing programs that need to extend the kernel for tracing purposes
> > > > without any dependency on the file system having headers and build
> > > > artifacts.
> > > >
> > > > On Android and embedded systems, it is common to switch kernels but not
> > > > have kernel headers available on the file system. Raw kernel headers
> > > > also cannot be copied into the filesystem like they can be on other
> > > > distros, due to licensing and other issues. There's no linux-headers
> > > > package on Android. Further once a different kernel is booted, any
> > > > headers stored on the file system will no longer be useful. 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 feature is also buildable as a module just in case the user desires
> > > > it not being part of the kernel image. This makes it possible to load
> > > > and unload the headers on demand. A tracing program, or a kernel module
> > > > builder can load the module, do its operations, and then unload the
> > > > module to save kernel memory. The total memory needed is 3.8MB.
> > > >
> > > > The code to read the headers is based on /proc/config.gz code and uses
> > > > the same technique to embed the headers.
> > > >
> > > > To build a module, the below steps have been tested on an x86 machine:
> > > > modprobe kheaders
> > > > rm -rf $HOME/headers
> > > > mkdir -p $HOME/headers
> > > > tar -xvf /proc/kheaders.tar.xz -C $HOME/headers >/dev/null
> > > > cd my-kernel-module
> > > > make -C $HOME/headers M=$(pwd) modules
> > > > rmmod kheaders
> > > 
> > > As the usage pattern will be accessing the individual files, what about
> > > implementing a file system that provides read-only access to the internal
> > > kheaders archive?
> > > 
> > >     mount kheaders $HOME/headers -t kheaders
> > 
> > I thought about it already. This is easier said than done though. The archive
> > is compressed from 40MB to 3.6MB. If we leave it uncompressed in RAM, then it
> > will take up the entire 40MB of RAM and in Android we don't even use
> > disk-based swap.
> > 
> > So we will need some kind of intra file compressed memory representation that
> > a filesystem can use for the backing store. I thought of RAM-backed squashfs
> > but it requires squashfs-tools to be installed at build time (which my host
> > distro itself didn't have).
> > 
> > It is just so much easier to use tar + xz at build time, and leave the
> > decompression task to the user. After decompression, the files will live on
> > the disk and the page-cache mechanism will free memory when/if the files fall
> > off the LRUs.
> > 
> > WDYT?
> 
> I think the compressed tarball is much simpler/easier overall.  If
> someone really wants the filesystem, they just uncompress it into a
> tmpfs mount.  It's much less moving kernel code to worry about.

Agreed, I also feel the same. thanks,

 - Joel


WARNING: multiple messages have this Message-ID (diff)
From: joel at joelfernandes.org (Joel Fernandes)
Subject: [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel
Date: Thu, 7 Mar 2019 11:54:33 -0500	[thread overview]
Message-ID: <20190307165433.GA90983@google.com> (raw)
In-Reply-To: <20190307152303.GA9819@kroah.com>

On Thu, Mar 07, 2019 at 04:23:03PM +0100, Greg KH wrote:
> > > On Fri, Mar 1, 2019 at 5:10 PM Joel Fernandes (Google)
> > > <joel at joelfernandes.org> wrote:
> > > > Introduce in-kernel headers and other artifacts which are made available
> > > > as an archive through proc (/proc/kheaders.tar.xz file). This archive makes
> > > > it possible to build kernel modules, run eBPF programs, and other
> > > > tracing programs that need to extend the kernel for tracing purposes
> > > > without any dependency on the file system having headers and build
> > > > artifacts.
> > > >
> > > > On Android and embedded systems, it is common to switch kernels but not
> > > > have kernel headers available on the file system. Raw kernel headers
> > > > also cannot be copied into the filesystem like they can be on other
> > > > distros, due to licensing and other issues. There's no linux-headers
> > > > package on Android. Further once a different kernel is booted, any
> > > > headers stored on the file system will no longer be useful. 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 feature is also buildable as a module just in case the user desires
> > > > it not being part of the kernel image. This makes it possible to load
> > > > and unload the headers on demand. A tracing program, or a kernel module
> > > > builder can load the module, do its operations, and then unload the
> > > > module to save kernel memory. The total memory needed is 3.8MB.
> > > >
> > > > The code to read the headers is based on /proc/config.gz code and uses
> > > > the same technique to embed the headers.
> > > >
> > > > To build a module, the below steps have been tested on an x86 machine:
> > > > modprobe kheaders
> > > > rm -rf $HOME/headers
> > > > mkdir -p $HOME/headers
> > > > tar -xvf /proc/kheaders.tar.xz -C $HOME/headers >/dev/null
> > > > cd my-kernel-module
> > > > make -C $HOME/headers M=$(pwd) modules
> > > > rmmod kheaders
> > > 
> > > As the usage pattern will be accessing the individual files, what about
> > > implementing a file system that provides read-only access to the internal
> > > kheaders archive?
> > > 
> > >     mount kheaders $HOME/headers -t kheaders
> > 
> > I thought about it already. This is easier said than done though. The archive
> > is compressed from 40MB to 3.6MB. If we leave it uncompressed in RAM, then it
> > will take up the entire 40MB of RAM and in Android we don't even use
> > disk-based swap.
> > 
> > So we will need some kind of intra file compressed memory representation that
> > a filesystem can use for the backing store. I thought of RAM-backed squashfs
> > but it requires squashfs-tools to be installed at build time (which my host
> > distro itself didn't have).
> > 
> > It is just so much easier to use tar + xz at build time, and leave the
> > decompression task to the user. After decompression, the files will live on
> > the disk and the page-cache mechanism will free memory when/if the files fall
> > off the LRUs.
> > 
> > WDYT?
> 
> I think the compressed tarball is much simpler/easier overall.  If
> someone really wants the filesystem, they just uncompress it into a
> tmpfs mount.  It's much less moving kernel code to worry about.

Agreed, I also feel the same. thanks,

 - Joel

WARNING: multiple messages have this Message-ID (diff)
From: joel@joelfernandes.org (Joel Fernandes)
Subject: [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel
Date: Thu, 7 Mar 2019 11:54:33 -0500	[thread overview]
Message-ID: <20190307165433.GA90983@google.com> (raw)
Message-ID: <20190307165433.ddWuTFhNBzbJdhWmCIuDzaELFNzruSz-QxTdpfdmr1g@z> (raw)
In-Reply-To: <20190307152303.GA9819@kroah.com>

On Thu, Mar 07, 2019@04:23:03PM +0100, Greg KH wrote:
> > > On Fri, Mar 1, 2019 at 5:10 PM Joel Fernandes (Google)
> > > <joel@joelfernandes.org> wrote:
> > > > Introduce in-kernel headers and other artifacts which are made available
> > > > as an archive through proc (/proc/kheaders.tar.xz file). This archive makes
> > > > it possible to build kernel modules, run eBPF programs, and other
> > > > tracing programs that need to extend the kernel for tracing purposes
> > > > without any dependency on the file system having headers and build
> > > > artifacts.
> > > >
> > > > On Android and embedded systems, it is common to switch kernels but not
> > > > have kernel headers available on the file system. Raw kernel headers
> > > > also cannot be copied into the filesystem like they can be on other
> > > > distros, due to licensing and other issues. There's no linux-headers
> > > > package on Android. Further once a different kernel is booted, any
> > > > headers stored on the file system will no longer be useful. 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 feature is also buildable as a module just in case the user desires
> > > > it not being part of the kernel image. This makes it possible to load
> > > > and unload the headers on demand. A tracing program, or a kernel module
> > > > builder can load the module, do its operations, and then unload the
> > > > module to save kernel memory. The total memory needed is 3.8MB.
> > > >
> > > > The code to read the headers is based on /proc/config.gz code and uses
> > > > the same technique to embed the headers.
> > > >
> > > > To build a module, the below steps have been tested on an x86 machine:
> > > > modprobe kheaders
> > > > rm -rf $HOME/headers
> > > > mkdir -p $HOME/headers
> > > > tar -xvf /proc/kheaders.tar.xz -C $HOME/headers >/dev/null
> > > > cd my-kernel-module
> > > > make -C $HOME/headers M=$(pwd) modules
> > > > rmmod kheaders
> > > 
> > > As the usage pattern will be accessing the individual files, what about
> > > implementing a file system that provides read-only access to the internal
> > > kheaders archive?
> > > 
> > >     mount kheaders $HOME/headers -t kheaders
> > 
> > I thought about it already. This is easier said than done though. The archive
> > is compressed from 40MB to 3.6MB. If we leave it uncompressed in RAM, then it
> > will take up the entire 40MB of RAM and in Android we don't even use
> > disk-based swap.
> > 
> > So we will need some kind of intra file compressed memory representation that
> > a filesystem can use for the backing store. I thought of RAM-backed squashfs
> > but it requires squashfs-tools to be installed at build time (which my host
> > distro itself didn't have).
> > 
> > It is just so much easier to use tar + xz at build time, and leave the
> > decompression task to the user. After decompression, the files will live on
> > the disk and the page-cache mechanism will free memory when/if the files fall
> > off the LRUs.
> > 
> > WDYT?
> 
> I think the compressed tarball is much simpler/easier overall.  If
> someone really wants the filesystem, they just uncompress it into a
> tmpfs mount.  It's much less moving kernel code to worry about.

Agreed, I also feel the same. thanks,

 - Joel

  reply	other threads:[~2019-03-07 16:54 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 16:08 [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel Joel Fernandes (Google)
2019-03-01 16:08 ` Joel Fernandes (Google)
2019-03-01 16:08 ` joel
2019-03-01 16:08 ` [PATCH v4 2/2] Add selftests for module build using in-kernel headers Joel Fernandes (Google)
2019-03-01 16:08   ` Joel Fernandes (Google)
2019-03-01 16:08   ` joel
2019-03-02 21:59 ` [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel kbuild test robot
2019-03-02 21:59   ` kbuild test robot
2019-03-02 21:59   ` lkp
2019-03-03 16:11   ` Joel Fernandes
2019-03-03 16:11     ` Joel Fernandes
2019-03-03 16:11     ` joelaf
2019-03-06 12:26     ` Masahiro Yamada
2019-03-06 12:26       ` Masahiro Yamada
2019-03-06 12:26       ` yamada.masahiro
2019-03-06 17:49       ` Joel Fernandes
2019-03-06 17:49         ` Joel Fernandes
2019-03-06 17:49         ` joel
2019-03-07  4:59         ` Masahiro Yamada
2019-03-07  4:59           ` Masahiro Yamada
2019-03-07  4:59           ` yamada.masahiro
2019-03-07 14:54           ` Joel Fernandes
2019-03-07 14:54             ` Joel Fernandes
2019-03-07 14:54             ` joel
2019-03-07 23:23       ` Justin Capella
2019-03-07 23:23         ` Justin Capella
2019-03-07 23:23         ` justincapella
2019-03-06 18:16     ` Joel Fernandes
2019-03-06 18:16       ` Joel Fernandes
2019-03-06 18:16       ` joel
2019-03-07  4:54       ` Masahiro Yamada
2019-03-07  4:54         ` Masahiro Yamada
2019-03-07  4:54         ` yamada.masahiro
2019-03-03  2:04 ` kbuild test robot
2019-03-03  2:04   ` kbuild test robot
2019-03-03  2:04   ` lkp
2019-03-04 14:00 ` Qais Yousef
2019-03-04 14:00   ` Qais Yousef
2019-03-04 14:00   ` qais.yousef
2019-03-05 16:27   ` Joel Fernandes
2019-03-05 16:27     ` Joel Fernandes
2019-03-05 16:27     ` joel
2019-03-04 22:48 ` Dietmar Eggemann
2019-03-04 22:48   ` Dietmar Eggemann
2019-03-04 22:48   ` dietmar.eggemann
2019-03-05 16:25   ` Joel Fernandes
2019-03-05 16:25     ` Joel Fernandes
2019-03-05 16:25     ` joel
2019-03-07  8:58 ` Geert Uytterhoeven
2019-03-07  8:58   ` Geert Uytterhoeven
2019-03-07  8:58   ` geert
2019-03-07 15:03   ` Joel Fernandes
2019-03-07 15:03     ` Joel Fernandes
2019-03-07 15:03     ` joel
2019-03-07 15:23     ` Greg KH
2019-03-07 15:23       ` Greg KH
2019-03-07 15:23       ` gregkh
2019-03-07 16:54       ` Joel Fernandes [this message]
2019-03-07 16:54         ` Joel Fernandes
2019-03-07 16:54         ` joel
     [not found]       ` <20190318185742.109dee5c@alans-desktop>
2019-03-18 19:11         ` Daniel Colascione
2019-03-18 21:11         ` Karim Yaghmour
2019-03-18 21:11           ` Karim Yaghmour
2019-03-18 21:11           ` karim.yaghmour
2019-03-08  8:53     ` Geert Uytterhoeven
2019-03-08  8:53       ` Geert Uytterhoeven
2019-03-08  8:53       ` geert
2019-03-08 13:42       ` Joel Fernandes
2019-03-08 13:42         ` Joel Fernandes
2019-03-08 13:42         ` joel
2019-03-08 13:57         ` Enrico Weigelt, metux IT consult
2019-03-08 13:57           ` Enrico Weigelt, metux IT consult
2019-03-08 13:57           ` lkml
2019-03-08 14:04           ` Greg KH
2019-03-08 14:04             ` Greg KH
2019-03-08 14:04             ` gregkh
2019-03-08 14:02         ` Greg KH
2019-03-08 14:02           ` Greg KH
2019-03-08 14:02           ` gregkh
2019-03-08 17:58           ` Joel Fernandes
2019-03-08 17:58             ` Joel Fernandes
2019-03-08 17:58             ` joel
2019-03-08 17:59           ` Geert Uytterhoeven
2019-03-08 17:59             ` Geert Uytterhoeven
2019-03-08 17:59             ` geert
2019-03-09  7:16             ` Greg KH
2019-03-09  7:16               ` Greg KH
2019-03-09  7:16               ` gregkh
2019-03-09 11:40               ` Geert Uytterhoeven
2019-03-09 11:40                 ` Geert Uytterhoeven
2019-03-09 11:40                 ` geert
2019-03-09 12:11                 ` Greg KH
2019-03-09 12:11                   ` Greg KH
2019-03-09 12:11                   ` gregkh
2019-03-09 16:51                   ` Karim Yaghmour
2019-03-09 16:51                     ` Karim Yaghmour
2019-03-09 16:51                     ` karim.yaghmour
2019-03-09 19:26                     ` Geert Uytterhoeven
2019-03-09 19:26                       ` Geert Uytterhoeven
2019-03-09 19:26                       ` geert
2019-03-09 21:44                       ` Karim Yaghmour
2019-03-09 21:44                         ` Karim Yaghmour
2019-03-09 21:44                         ` karim.yaghmour
2019-03-11  8:03                         ` Geert Uytterhoeven
2019-03-11  8:03                           ` Geert Uytterhoeven
2019-03-11  8:03                           ` geert
2019-03-12 15:15                           ` Karim Yaghmour
2019-03-12 15:15                             ` Karim Yaghmour
2019-03-12 15:15                             ` karim.yaghmour
2019-03-11 23:36                         ` Steven Rostedt
2019-03-11 23:36                           ` Steven Rostedt
2019-03-11 23:36                           ` rostedt
2019-03-11 23:58                           ` Daniel Colascione
2019-03-11 23:58                             ` Daniel Colascione
2019-03-11 23:58                             ` dancol
2019-03-12  0:39                             ` Joel Fernandes
2019-03-12  0:39                               ` Joel Fernandes
2019-03-12  0:39                               ` joel
2019-03-12  1:28                               ` Steven Rostedt
2019-03-12  1:28                                 ` Steven Rostedt
2019-03-12  1:28                                 ` rostedt
2019-03-12  1:38                                 ` Joel Fernandes
2019-03-12  1:38                                   ` Joel Fernandes
2019-03-12  1:38                                   ` joelaf
2019-03-13  1:18                                   ` Masami Hiramatsu
2019-03-13  1:18                                     ` Masami Hiramatsu
2019-03-13  1:18                                     ` mhiramat
2019-03-14 12:27                                     ` Joel Fernandes
2019-03-14 12:27                                       ` Joel Fernandes
2019-03-14 12:27                                       ` joel
2019-03-15 13:14                                       ` Masami Hiramatsu
2019-03-15 13:14                                         ` Masami Hiramatsu
2019-03-15 13:14                                         ` mhiramat
2019-03-12  1:45                                 ` Alexei Starovoitov
2019-03-12  1:45                                   ` Alexei Starovoitov
2019-03-12  1:45                                   ` alexei.starovoitov
2019-03-12 15:26                                   ` Steven Rostedt
2019-03-12 15:26                                     ` Steven Rostedt
2019-03-12 15:26                                     ` rostedt
2019-03-12  1:22                             ` Steven Rostedt
2019-03-12  1:22                               ` Steven Rostedt
2019-03-12  1:22                               ` rostedt

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=20190307165433.GA90983@google.com \
    --to=joel@joelfernandes.org \
    --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=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.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=yamada.masahiro@socionext.com \
    --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 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.