linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Daniel Colascione <dancol@google.com>,
	Karim Yaghmour <karim.yaghmour@opersys.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexei Starovoitov <ast@kernel.org>,
	atish patra <atishp04@gmail.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Guenter Roeck <groeck@chromium.org>,
	Jonathan Corbet <corbet@lwn.net>,
	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>,
	Qais Yousef <qais.yousef@arm.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shuah Khan <shuah@kernel.org>, Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel
Date: Thu, 14 Mar 2019 08:27:48 -0400	[thread overview]
Message-ID: <20190314122748.GA101545@google.com> (raw)
In-Reply-To: <20190313101843.800dd8d6a9babb635580ebdc@kernel.org>

Hi Masami,
Sorry for late reply as I was traveling.

On Wed, Mar 13, 2019 at 10:18:43AM +0900, Masami Hiramatsu wrote:
> On Mon, 11 Mar 2019 18:38:49 -0700
> Joel Fernandes <joelaf@google.com> wrote:
> 
> > On Mon, Mar 11, 2019 at 6:28 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > On Mon, 11 Mar 2019 20:39:12 -0400
> > > Joel Fernandes <joel@joelfernandes.org> wrote:
> > >
> > > > I think even though the kernel-headers can't have information about all data
> > > > structures, they do already contain a lot of data structure definitions we
> > > > need already. And anything needed can/should arguably be moved to include/ if
> > > > they are really needed for kernel extension by something "external" to the
> > > > kernel such as kernel modules or eBPF, right?
> > >
> > > That's not my worry. I would like to be able to easily walk data
> > > structures from within the kernel, without having to do a lot of work
> > > in userspace to get that information. The kprobe_events could then be
> > > passed type casts or such to access data fields of arguments to
> > > functions and such.
> > 
> > Ok.
> > 
> > > > In any case, such a solution such as what Steve suggested, still cannot do
> > > > what we can with headers - such as build kernel modules on the fly using the
> > > > C-compiler without any auto-generation of C code from any debug artifiacts.
> > > > Think systemtap working with the module-backend without any need for
> > > > linux-headers package on the file system. So such a solution would still be a
> > > > bit orthogonal in scope to what this proposed solution can solve IMO.
> > > >
> > >
> > > With the information I would like to have, it would be trivial to read
> > > the data to create the header files needed for modules.
> > 
> > But there are macros and other #define things too. We lose all of them
> > and can't recreate them from just DWARF (AFAIK). Including
> > include/generated/autoconf.h which #defines the CONFIG options. For
> > that we either need headers, or full kernel's sources with build
> > artifacts.
> 
> What kind of macros would you concern?
> 
> > I do see a use case for the debug info you are talking about as you
> > mentioned for the kprobe_events argument list types, and I already
> > thought about it. But it does not seem to work for all the use cases I
> > am referring to here.
> 
> But the eBPF is based on kprobe-events. What kind of usage would you
> expected? (with macros??)

eBPF C programs are compiled with kernel headers. They can execute inline
functions or refer to macros in the kernel headers. They are similar to
kernel modules where you build a C program that then later is executed in
kernel context. It goes through the whole compiler pipeline. This is slightly
different usage from pure kprobe-events.  Also eBPF kprobe programs need
LINUX_VERSION_CODE (or similarly named) macro which it provides to the bpf(2)
syscall when loading kprobe programs. This is because eBPF implementation in
the kernel checks if the eBPF programs that use kprobes are being loaded
against the right kernel.

thanks,

- Joel


  reply	other threads:[~2019-03-14 12:27 UTC|newest]

Thread overview: 48+ 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 ` [PATCH v4 2/2] Add selftests for module build using in-kernel headers Joel Fernandes (Google)
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-03 16:11   ` Joel Fernandes
2019-03-06 12:26     ` Masahiro Yamada
2019-03-06 17:49       ` Joel Fernandes
2019-03-07  4:59         ` Masahiro Yamada
2019-03-07 14:54           ` Joel Fernandes
2019-03-07 23:23       ` Justin Capella
2019-03-06 18:16     ` Joel Fernandes
2019-03-07  4:54       ` Masahiro Yamada
2019-03-03  2:04 ` kbuild test robot
2019-03-04 14:00 ` Qais Yousef
2019-03-05 16:27   ` Joel Fernandes
2019-03-04 22:48 ` Dietmar Eggemann
2019-03-05 16:25   ` Joel Fernandes
2019-03-07  8:58 ` Geert Uytterhoeven
2019-03-07 15:03   ` Joel Fernandes
2019-03-07 15:23     ` Greg KH
2019-03-07 16:54       ` Joel Fernandes
     [not found]       ` <20190318185742.109dee5c@alans-desktop>
2019-03-18 19:11         ` Daniel Colascione
2019-03-18 21:11         ` Karim Yaghmour
2019-03-08  8:53     ` Geert Uytterhoeven
2019-03-08 13:42       ` Joel Fernandes
2019-03-08 13:57         ` Enrico Weigelt, metux IT consult
2019-03-08 14:04           ` Greg KH
2019-03-08 14:02         ` Greg KH
2019-03-08 17:58           ` Joel Fernandes
2019-03-08 17:59           ` Geert Uytterhoeven
2019-03-09  7:16             ` Greg KH
2019-03-09 11:40               ` Geert Uytterhoeven
2019-03-09 12:11                 ` Greg KH
2019-03-09 16:51                   ` Karim Yaghmour
2019-03-09 19:26                     ` Geert Uytterhoeven
2019-03-09 21:44                       ` Karim Yaghmour
2019-03-11  8:03                         ` Geert Uytterhoeven
2019-03-12 15:15                           ` Karim Yaghmour
2019-03-11 23:36                         ` Steven Rostedt
2019-03-11 23:58                           ` Daniel Colascione
2019-03-12  0:39                             ` Joel Fernandes
2019-03-12  1:28                               ` Steven Rostedt
2019-03-12  1:38                                 ` Joel Fernandes
2019-03-13  1:18                                   ` Masami Hiramatsu
2019-03-14 12:27                                     ` Joel Fernandes [this message]
2019-03-15 13:14                                       ` Masami Hiramatsu
2019-03-12  1:45                                 ` Alexei Starovoitov
2019-03-12 15:26                                   ` Steven Rostedt
2019-03-12  1:22                             ` Steven 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=20190314122748.GA101545@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 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).