All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Kris Van Hees <kris.van.hees@oracle.com>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-modules@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	Nick Alcock <nick.alcock@oracle.com>,
	Alan Maguire <alan.maguire@oracle.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Jiri Olsa <olsajiri@gmail.com>,
	Elena Zannoni <elena.zannoni@oracle.com>
Subject: Re: [PATCH v5 3/4] scripts: add verifier script for builtin module range data
Date: Wed, 14 Aug 2024 15:59:58 -0400	[thread overview]
Message-ID: <Zr0MvswCE3VJBKhp@oracle.com> (raw)
In-Reply-To: <20240814151945.122da7b6@gandalf.local.home>

On Wed, Aug 14, 2024 at 03:19:45PM -0400, Steven Rostedt wrote:
> 
> Hmm, does this handle my concern from the last patch. That is, if the
> previous script is broken by some change, this will catch it?
> If so, should there be a way to run this always? As it looks to be only
> used for manual tests.

It is meant to address detecting things going wrong, yes.  I hesitate to make
this validation be something that is always executed because I wouldn't want
to disrupt people's kernel builds with failure that are not critical to the
operation of the kernel itself.  I could make it a config option so it can
nbe enabled for those who might want to, e.g. for release building?

Does that make sense?

> On Mon, 15 Jul 2024 23:10:44 -0400
> Kris Van Hees <kris.van.hees@oracle.com> wrote:
> 
> > The modules.builtin.ranges offset range data for builtin modules is
> > generated at compile time based on the list of built-in modules and
> > the vmlinux.map and vmlinux.o.map linker maps.  This data can be used
> 						^^
> As my daughter keeps reminding me, nobody uses double spaces after a period
> anymore ;-)

I am old-fashion :)

> > to determine whether a symbol at a particular address belongs to
> > module code that was configured to be compiled into the kernel proper
> > as a built-in module (rather than as a standalone module).
> > 
> > This patch adds a script that uses the generated modules.builtin.ranges
> > data to annotate the symbols in the System.map with module names if
> > their address falls within a range that belongs to one or mre built-in
> 							   "more" ?

Oops, yes, thanks.

> > modules.
> > 
> > It then processes the vmlinux.map (and if needed, vmlinux.o.map) to
> > verify the annotation:
> > 
> >   - For each top-level section:
> >      - For each object in the section:
> >         - Determine whether the object is part of a built-in module
> >           (using modules.builtin and the .*.cmd file used to compile
> >            the object as suggested in [0])
> >         - For each symbol in that object, verify that the built-in
> >           module association (or lack thereof) matches the annotation
> >           given to the symbol.
> > 
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
> > Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> 
> After running this, I do get a lot of messages:
> 
> uncore_pmu_event_start in intel_uncore (should NOT be)
> uncore_pcibus_to_dieid in intel_uncore (should NOT be)
> uncore_die_to_segment in intel_uncore (should NOT be)
> uncore_device_to_die in intel_uncore (should NOT be)
> __find_pci2phy_map in intel_uncore (should NOT be)
> uncore_event_show in intel_uncore (should NOT be)
> uncore_pmu_to_box in intel_uncore (should NOT be)
> uncore_msr_read_counter in intel_uncore (should NOT be)
> uncore_mmio_exit_box in intel_uncore (should NOT be)
> uncore_mmio_read_counter in intel_uncore (should NOT be)
> uncore_get_constraint in intel_uncore (should NOT be)
> uncore_put_constraint in intel_uncore (should NOT be)
> uncore_shared_reg_config in intel_uncore (should NOT be)
> uncore_perf_event_update in intel_uncore (should NOT be)
> uncore_pmu_event_read in intel_uncore (should NOT be)
> uncore_pmu_event_stop in intel_uncore (should NOT be)
> uncore_pmu_event_add in intel_uncore (should NOT be)
> [..]
> usb_debug_root in usb_common (should NOT be)
> usb_hcds_loaded in usbcore (should NOT be)
> iTCO_vendorsupport in iTCO_vendor_support (should NOT be)
> snd_ecards_limit in snd (should NOT be)
> snd_major in snd (should NOT be)
> snd_oss_root in snd (should NOT be)
> snd_seq_root in snd (should NOT be)
> ip6_min_hopcount in ipv6 (should NOT be)
> ip6_ra_chain in ipv6 (should NOT be)
> raw_v6_hashinfo in ipv6 (should NOT be)
> Verification of /work/build/nobackup/debiantesting-x86-64/modules.builtin.ranges:
>   Correct matches:   24962 (75% of total)
>     Module matches:      0 (0% of matches)
>   Mismatches:         8262 (24% of total)
>   Missing:               0 (0% of total)
> 
> 
> What does this mean?

Hm, this is certainly why the validation script exists.  I am surprised, though
not entirely because kernel changes toward the 6.10 branching and such came
after I create this version.  Would you be willing to send me a copy of your
.config for this kernel build so I can investigate?  This output is typical
of a case where the script was not able to determine offse ranges correctly.

	Kris

> > ---
> > 
> > Notes:
> >     Changes since v4:
> >      - New patch in the series
> > 
> >  scripts/verify_builtin_ranges.awk | 348 ++++++++++++++++++++++++++++++
> >  1 file changed, 348 insertions(+)
> >  create mode 100755 scripts/verify_builtin_ranges.awk
> > 
> > diff --git a/scripts/verify_builtin_ranges.awk b/scripts/verify_builtin_ranges.awk
> > new file mode 100755
> > index 000000000000..a2475a38ba50
> > --- /dev/null
> > +++ b/scripts/verify_builtin_ranges.awk
> > @@ -0,0 +1,348 @@
> > +#!/usr/bin/gawk -f
> > +# SPDX-License-Identifier: GPL-2.0
> > +# verify_builtin_ranges.awk: Verify address range data for builtin modules
> > +# Written by Kris Van Hees <kris.van.hees@oracle.com>
> > +#
> > +# Usage: verify_builtin_ranges.awk modules.builtin.ranges System.map \
> > +#				   modules.builtin vmlinux.map vmlinux.o.map
> > +#
> > +
> > +# Return the module name(s) (if any) associated with the given object.
> > +#
> > +# If we have seen this object before, return information from the cache.
> > +# Otherwise, retrieve it from the corresponding .cmd file.
> > +#

  reply	other threads:[~2024-08-14 20:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16  3:10 [PATCH v5 0/4] Generate address range data for built-in modules Kris Van Hees
2024-07-16  3:10 ` [PATCH v5 1/4] kbuild: add mod(name,file)_flags to assembler flags for module objects Kris Van Hees
2024-08-14 17:17   ` Steven Rostedt
2024-08-14 19:42     ` Kris Van Hees
2024-07-16  3:10 ` [PATCH v5 2/4] kbuild, kconfig: generate offset range data for builtin modules Kris Van Hees
2024-08-14 19:04   ` Steven Rostedt
2024-08-14 19:52     ` Kris Van Hees
2024-07-16  3:10 ` [PATCH v5 3/4] scripts: add verifier script for builtin module range data Kris Van Hees
2024-08-14 19:19   ` Steven Rostedt
2024-08-14 19:59     ` Kris Van Hees [this message]
2024-08-14 20:16       ` Steven Rostedt
2024-08-15  1:02         ` Kris Van Hees
2024-07-16  3:10 ` [PATCH v5 4/4] module: add install target for modules.builtin.ranges Kris Van Hees
2024-08-14 16:45 ` [PATCH v5 0/4] Generate address range data for built-in modules 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=Zr0MvswCE3VJBKhp@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=alan.maguire@oracle.com \
    --cc=elena.zannoni@oracle.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nick.alcock@oracle.com \
    --cc=olsajiri@gmail.com \
    --cc=rostedt@goodmis.org \
    /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.