bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Hao Luo <haoluo@google.com>, Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Andrii Nakryiko <andriin@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
	Oleg Rombakh <olegrom@google.com>,
	Martin KaFai Lau <kafai@fb.com>
Subject: Re: accessing global and per-cpu vars
Date: Thu, 28 May 2020 17:58:31 -0300	[thread overview]
Message-ID: <A5E8516C-3386-4F59-AC6C-11F2BE4A02CB@gmail.com> (raw)
In-Reply-To: <CA+khW7hqemc+xsbMQq-DW3X+mHKO+Lm64hNpWNRyZ75MkUa0Gg@mail.gmail.com>



On May 28, 2020 5:50:52 PM GMT-03:00, Hao Luo <haoluo@google.com> wrote:
>A quick update on this thread.
>
>I came up with a draft patch that fulfills step 1. I added a ".ksym"
>section for extern vars. The libbpf fills these vars' values by reading
>/proc/kallsyms at load time. I think I am going to upload this patch
>for
>review together with step 3 and 4 after I work them out.
>
>Regarding step 2, I have also worked out a patch in pahole that inserts
>the
>kernel's percpu vars into BTF. I realized, because step 2 happens at
>compile time, there is no kallsyms file available to extract symbols,
>so we
>have to read the global vars from vmlinux. Currently on v5.7-rc7, I was
>able to extract 291 percpu vars, static or global. The .BTF size
>increases
>from 2d2c10 to 2d4dd0. A clean build on my local workstation increases
>from
>10m13s to 11m24s (wall time). Common global percpu vars can be found in
>.BTF.
>
>haoluo@haoluo:~/kernel/tip/pkgs/images/boot$ bpftool btf dump file
>vmlinux-5.7.0-smp-DEV | grep runqueues
>
>[14098] VAR 'runqueues' type_id=13725, linkage=global-alloc
>
>haoluo@haoluo:~/kernel/tip/pkgs/images/boot$ bpftool btf dump file
>vmlinux-5.7.0-smp-DEV | grep cpu_stopper
>
>[17589] STRUCT 'cpu_stopper' size=72 vlen=5
>[17609] VAR 'cpu_stopper' type_id=17589, linkage=global-alloc
>
>Arnaldo, would you please advise on how to upload the pahole patch for
>review? I am going to polish it a bit and think I can upload it for
>review.

Cool, send it to me, CC dwarves@vger.kernel.org,

Thanks, 

- Arnaldo

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

  parent reply	other threads:[~2020-05-28 20:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 17:03 accessing global and per-cpu vars Alexei Starovoitov
2020-05-21 18:58 ` Andrii Nakryiko
2020-05-22 14:28   ` Arnaldo Carvalho de Melo
     [not found]     ` <CA+khW7j=ejncVYgY=hKEnkrkwA=Wjwa6Y2PFWgzrV1EV_8rvpw@mail.gmail.com>
2020-05-26 18:20       ` Andrii Nakryiko
     [not found]         ` <CA+khW7ha-5YSgm5kARO=+JEtf-Ahmc1N_TBJ2iLSntk12pfy3w@mail.gmail.com>
     [not found]           ` <CA+khW7hqemc+xsbMQq-DW3X+mHKO+Lm64hNpWNRyZ75MkUa0Gg@mail.gmail.com>
2020-05-28 20:58             ` Arnaldo Carvalho de Melo [this message]
2020-05-28 20:58             ` Andrii Nakryiko

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=A5E8516C-3386-4F59-AC6C-11F2BE4A02CB@gmail.com \
    --to=arnaldo.melo@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=kafai@fb.com \
    --cc=olegrom@google.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).