bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Bill Wendling <morbo@google.com>
Cc: "Arnaldo Carvalho de Melo" <arnaldo.melo@gmail.com>,
	dwarves@vger.kernel.org, "Alexei Starovoitov" <ast@kernel.org>,
	"Andrii Nakryiko" <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	"David Blaikie" <dblaikie@gmail.com>,
	"Fāng-ruì Sòng" <maskray@google.com>,
	kernel-team@fb.com, "Nick Desaulniers" <ndesaulniers@google.com>
Subject: Re: [PATCH dwarves 0/2] dwarf_loader: improve cus__merging_cu()
Date: Fri, 2 Apr 2021 07:34:41 -0700	[thread overview]
Message-ID: <3f29403d-4942-e362-c98a-4e2d20a3db88@fb.com> (raw)
In-Reply-To: <YGcbp5Y+RRWzGSia@kernel.org>



On 4/2/21 6:27 AM, Arnaldo Carvalho de Melo wrote:
> Em Thu, Apr 01, 2021 at 12:35:45PM -0700, Bill Wendling escreveu:
>> On Wed, Mar 31, 2021 at 7:58 PM Yonghong Song <yhs@fb.com> wrote:
> 
>>> Function cus__merging_cu() is introduced in Commit 39227909db3c
>>> ("dwarf_loader: Permit merging all DWARF CU's for clang LTO built
>>> binary") to test whether cross-cu references may happen.
>>> The original implementation anticipates compilation flags
>>> in dwarf, but later some concerns about binary size surfaced
>>> and the decision is to scan .debug_abbrev as a faster way
>>> to check cross-cu references. Also putting a note in vmlinux
>>> to indicate whether lto is enabled for built or not can
>>> provide a much faster way.
> 
>>> This patch set implemented this two approaches, first
>>> checking the note (in Patch #2), if not found, then
>>> check .debug_abbrev (in Patch #1).
> 
>>> Yonghong Song (2):
>>>    dwarf_loader: check .debug_abbrev for cross-cu references
>>>    dwarf_loader: check .notes section for lto build info
> 
>>>   dwarf_loader.c | 76 ++++++++++++++++++++++++++++++++++++--------------
>>>   1 file changed, 55 insertions(+), 21 deletions(-)
> 
>> With this series of patches, the compilation passes for me with
>> ThinLTO. You may add this if you like:
> 
>> Tested-by: Bill Wendling <morbo@google.com>
> 
> Thanks, added, and also this "Committer testing" section:
> 
> Committer testing:
> 
> Using a thin-LTO built vmlinux that doesn't have the
> LINUX_ELFNOTE_BUILD_LTO note:
> 
>    $ readelf --notes vmlinux.clang.thin.LTO
> 
>    Displaying notes found in: .notes
>      Owner                Data size 	Description
>      Xen                  0x00000006	Unknown note type: (0x00000006)
>       description data: 6c 69 6e 75 78 00
>      Xen                  0x00000004	Unknown note type: (0x00000007)
>       description data: 32 2e 36 00
>      Xen                  0x00000008	Unknown note type: (0x00000005)
>       description data: 78 65 6e 2d 33 2e 30 00
>      Xen                  0x00000008	Unknown note type: (0x00000003)
>       description data: 00 00 00 80 ff ff ff ff
>      Xen                  0x00000008	Unknown note type: (0x0000000f)
>       description data: 00 00 00 00 80 00 00 00
>      Xen                  0x00000008	NT_VERSION (version)
>       description data: c0 e1 33 83 ff ff ff ff
>      Xen                  0x00000008	NT_ARCH (architecture)
>       description data: 00 20 00 81 ff ff ff ff
>      Xen                  0x00000029	Unknown note type: (0x0000000a)
>       description data: 21 77 72 69 74 61 62 6c 65 5f 70 61 67 65 5f 74 61 62 6c 65 73 7c 70 61 65 5f 70 67 64 69 72 5f 61 62 6f 76 65 5f 34 67 62
>      Xen                  0x00000004	Unknown note type: (0x00000011)
>       description data: 01 88 00 00
>      Xen                  0x00000004	Unknown note type: (0x00000009)
>       description data: 79 65 73 00
>      Xen                  0x00000008	Unknown note type: (0x00000008)
>       description data: 67 65 6e 65 72 69 63 00
>      Xen                  0x00000010	Unknown note type: (0x0000000d)
>       description data: 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
>      Xen                  0x00000004	Unknown note type: (0x0000000e)
>       description data: 01 00 00 00
>      Xen                  0x00000004	Unknown note type: (0x00000010)
>       description data: 01 00 00 00
>      Xen                  0x00000008	Unknown note type: (0x0000000c)
>       description data: 00 00 00 00 00 80 ff ff
>      Xen                  0x00000008	Unknown note type: (0x00000004)
>       description data: 00 00 00 00 00 00 00 00
>      Xen                  0x00000008	Unknown note type: (0x00000012)
>       description data: e0 02 00 01 00 00 00 00
>      Linux                0x00000017	OPEN
>       description data: 34 2e 31 39 2e 34 2d 33 30 30 2e 66 63 32 39 2e 78 38 36 5f 36 34 00
>      GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
>        Build ID: 354f81317b1b3c35f3f81f8d9f04d0c8caccb09a
>    $
> 
> Then with one with the new ELF note stating that this binary was built
> with LTO:
> 
>    [acme@five pahole]$ readelf --notes vmlinux.clang.thin.LTO+ELF_note
>    
>    Displaying notes found in: .notes
>      Owner                Data size 	Description
>      Xen                  0x00000006	Unknown note type: (0x00000006)
>       description data: 6c 69 6e 75 78 00
>      Xen                  0x00000004	Unknown note type: (0x00000007)
>       description data: 32 2e 36 00
>      Xen                  0x00000008	Unknown note type: (0x00000005)
>       description data: 78 65 6e 2d 33 2e 30 00
>      Xen                  0x00000008	Unknown note type: (0x00000003)
>       description data: 00 00 00 80 ff ff ff ff
>      Xen                  0x00000008	Unknown note type: (0x0000000f)
>       description data: 00 00 00 00 80 00 00 00
>      Xen                  0x00000008	NT_VERSION (version)
>       description data: c0 e1 33 83 ff ff ff ff
>      Xen                  0x00000008	NT_ARCH (architecture)
>       description data: 00 20 00 81 ff ff ff ff
>      Xen                  0x00000029	Unknown note type: (0x0000000a)
>       description data: 21 77 72 69 74 61 62 6c 65 5f 70 61 67 65 5f 74 61 62 6c 65 73 7c 70 61 65 5f 70 67 64 69 72 5f 61 62 6f 76 65 5f 34 67 62
>      Xen                  0x00000004	Unknown note type: (0x00000011)
>       description data: 01 88 00 00
>      Xen                  0x00000004	Unknown note type: (0x00000009)
>       description data: 79 65 73 00
>      Xen                  0x00000008	Unknown note type: (0x00000008)
>       description data: 67 65 6e 65 72 69 63 00
>      Xen                  0x00000010	Unknown note type: (0x0000000d)
>       description data: 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
>      Xen                  0x00000004	Unknown note type: (0x0000000e)
>       description data: 01 00 00 00
>      Xen                  0x00000004	Unknown note type: (0x00000010)
>       description data: 01 00 00 00
>      Xen                  0x00000008	Unknown note type: (0x0000000c)
>       description data: 00 00 00 00 00 80 ff ff
>      Xen                  0x00000008	Unknown note type: (0x00000004)
>       description data: 00 00 00 00 00 00 00 00
>      Xen                  0x00000008	Unknown note type: (0x00000012)
>       description data: e0 02 00 01 00 00 00 00
>      Linux                0x00000017	OPEN
>       description data: 34 2e 31 39 2e 34 2d 33 30 30 2e 66 63 32 39 2e 78 38 36 5f 36 34 00
>      Linux                0x00000004	func
>       description data: 01 00 00 00
>      GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
>        Build ID: aeba9ffc929acd3cd573b4d1afc8df9af4f3694d
>    $
> 
> Now to see the diff:
> 
>    $ readelf --notes vmlinux.clang.thin.LTO+ELF_note > with-note
>    $ readelf --notes vmlinux.clang.thin.LTO > without-note
>    $ diff -u without-note with-note
>    --- without-note	2021-04-02 10:23:57.545349084 -0300
>    +++ with-note	2021-04-02 10:23:50.690196102 -0300
>    @@ -37,5 +37,7 @@
>        description data: e0 02 00 01 00 00 00 00
>       Linux                0x00000017	OPEN
>        description data: 34 2e 31 39 2e 34 2d 33 30 30 2e 66 63 32 39 2e 78 38 36 5f 36 34 00
>    +  Linux                0x00000004	func
>    +   description data: 01 00 00 00
>       GNU                  0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)
>    -    Build ID: 354f81317b1b3c35f3f81f8d9f04d0c8caccb09a
>    +    Build ID: aeba9ffc929acd3cd573b4d1afc8df9af4f3694d
>    $
> 
> Signed-off-by: Yonghong Song <yhs@fb.com>
> Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Tested-by: Bill Wendling <morbo@google.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: David Blaikie <dblaikie@gmail.com>
> Cc: Fāng-ruì Sòng <maskray@google.com>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: bpf@vger.kernel.org
> Cc: dwarves@vger.kernel.org
> Cc: kernel-team@fb.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Looks great! Thanks a lot for detailed testing log and 
Suggested-by/Tested-by/Cc list!

      reply	other threads:[~2021-04-02 14:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  2:58 [PATCH dwarves 0/2] dwarf_loader: improve cus__merging_cu() Yonghong Song
2021-04-01  2:58 ` [PATCH dwarves 1/2] dwarf_loader: check .debug_abbrev for cross-cu references Yonghong Song
2021-04-01 18:52   ` Nick Desaulniers
2021-04-01 19:36     ` Arnaldo
2021-04-01 20:54       ` Yonghong Song
2021-04-01  2:58 ` [PATCH dwarves 2/2] dwarf_loader: check .notes section for lto build info Yonghong Song
2021-04-01 12:59 ` [PATCH dwarves 0/2] dwarf_loader: improve cus__merging_cu() Arnaldo Carvalho de Melo
2021-04-01 18:50 ` Nick Desaulniers
2021-04-01 19:35 ` Bill Wendling
2021-04-01 20:56   ` Bill Wendling
2021-04-01 21:59     ` Yonghong Song
2021-04-02 19:44       ` Bill Wendling
2021-04-06 13:22         ` Arnaldo Carvalho de Melo
2021-04-06 13:23           ` Arnaldo Carvalho de Melo
2021-04-06 16:40           ` Arnaldo Carvalho de Melo
2021-04-06 16:55             ` Arnaldo Carvalho de Melo
2021-04-06 16:59               ` Arnaldo Carvalho de Melo
2021-04-06 17:03                 ` Arnaldo Carvalho de Melo
2021-04-06 17:07                   ` Arnaldo Carvalho de Melo
2021-04-06 17:25                     ` Arnaldo Carvalho de Melo
2021-04-06 17:23                   ` Yonghong Song
2021-04-06 17:34                     ` Arnaldo Carvalho de Melo
2021-04-06 17:36                       ` Arnaldo Carvalho de Melo
2021-04-06 17:48                     ` Yonghong Song
2021-04-06 18:03                       ` Arnaldo Carvalho de Melo
2021-04-06 18:04                         ` Arnaldo Carvalho de Melo
2021-04-06 18:31                           ` Nick Desaulniers
2021-04-06 18:17                         ` David Blaikie
2021-04-06 18:20                           ` Arnaldo Carvalho de Melo
2021-04-06 18:22                           ` Fāng-ruì Sòng
2021-04-06 17:09     ` Jiri Olsa
2021-04-02 13:27   ` Arnaldo Carvalho de Melo
2021-04-02 14:34     ` Yonghong Song [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=3f29403d-4942-e362-c98a-4e2d20a3db88@fb.com \
    --to=yhs@fb.com \
    --cc=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dblaikie@gmail.com \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=maskray@google.com \
    --cc=morbo@google.com \
    --cc=ndesaulniers@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).