mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Uros Bizjak <ubizjak@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Nadav Amit <namit@vmware.com>, Andy Lutomirski <luto@kernel.org>,
	Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()
Date: Thu, 12 Oct 2023 14:30:38 -0700	[thread overview]
Message-ID: <20231012213038.pnq6eds53dbqxstj@treble> (raw)
In-Reply-To: <ZSg0D0bRlzXdqZRS@gmail.com>

On Thu, Oct 12, 2023 at 07:59:43PM +0200, Ingo Molnar wrote:
> 
> * Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> 
> > On Thu, Oct 12, 2023 at 08:19:14AM +0200, Ingo Molnar wrote:
> > > 
> > > * Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> > > 
> > > > Though, another problem is that .text has a crazy amount of padding
> > > > which makes it always the same size, due to the SRSO alias mitigation
> > > > alignment linker magic.  We should fix that somehow.
> > > 
> > > We could emit a non-aligned end-of-text symbol (we might have it already),
> > > and have a script or small .c program in scripts/ or tools/ that looks
> > > at vmlinux and displays a user-friendly and accurate list of text and
> > > data sizes in the kernel?
> > > 
> > > And since objtool is technically an 'object files tool', and it already
> > > looks at sections & symbols, it could also grow a:
> > > 
> > > 	objtool size <objfile>
> > > 
> > > command that does the sane thing ... I'd definitely start using that, instead of 'size'.
> > > 
> > > /me runs :-)
> > 
> > Yeah, that's actually not a bad idea.
> > 
> > I had been thinking a "simple" script would be fine, but I'm realizing
> > the scope of this thing could grow over time.  In which case a script is
> > less than ideal.  And objtool already has the ability to do this pretty
> > easily.
> 
> Yeah, and speed actually matters here: I have scripts that generate object 
> comparisons between commits, and every second of runtime counts - and a 
> script would be slower and more fragile for something like allmodconfig 
> builds or larger disto configs.

Ah, good to know.

> BTW., maybe the right objtool subcommand would be 'objtool sections', with 
> an 'objtool sections size' sub-sub-command. Because I think this discussion 
> shows that it would be good to have a bit of visibility into the sanity of 
> our sections setup, with 'objtool sections check' for example doing a 
> sanity check on whether there's anything extra in the text section that 
> shouldn't be there? Or so ...

What would be an example of something "extra"?  A sanity check might fit
better alongside the other checks already being done by the main objtool
"subcommand" which gets run by the kernel build.

BTW, I actually removed subcommands a while ago when I overhauled
objtool's interface to make it easier to combine options.  That said,
I'm not opposed to re-adding them if we can find a sane way to do so.

Here's the current interface:

 Usage: objtool <actions> [<options>] file.o

Actions:
    -h, --hacks[=<jump_label,noinstr,skylake>]
                          patch toolchain bugs/limitations
    -i, --ibt             validate and annotate IBT
    -l, --sls             validate straight-line-speculation mitigations
    -m, --mcount          annotate mcount/fentry calls for ftrace
    -n, --noinstr         validate noinstr rules
    -o, --orc             generate ORC metadata
    -r, --retpoline       validate and annotate retpoline usage
    -s, --stackval        validate frame pointer rules
    -t, --static-call     annotate static calls
    -u, --uaccess         validate uaccess rules for SMAP
        --cfi             annotate kernel control flow integrity (kCFI) function preambles
        --dump[=<orc>]    dump metadata
        --prefix <n>      generate prefix symbols
        --rethunk         validate and annotate rethunk usage
        --unret           validate entry unret placement

Options:
    -v, --verbose         verbose warnings
        --backtrace       unwind on error
        --backup          create .orig files before modification
        --dry-run         don't write modifications
        --link            object is a linked object
        --mnop            nop out mcount call sites
        --module          object is part of a kernel module
        --no-unreachable  skip 'unreachable instruction' warnings
        --sec-address     print section addresses in warnings
        --stats           print statistics


Note how all the actions can be easily combined in a single execution
instance.

If we re-added subcommands, most of the existing functionality would be
part of a single subcommand.  It used to be called "check", but it's no
longer a read-only operation so that's misleading.  I'll call it "run"
for now.

Right now my preference would be to leave the existing interface as-is,
and then graft optional subcommands on top.  If no subcommand is
specified then it would default to the "run" subcommand.  It's a little
funky, but it would work well for the common case, where ~99% of the
functionality lives.  And it doesn't break existing setups and
backports.

For example:

  # current interface (no changes)
  objtool --mcount --orc --retpoline --uaccess vmlinux.o

  # same, with optional explicit "run" subcommand
  objtool run --mcount --orc --retpoline --uaccess vmlinux.o

  # new "size" subcommand
  obtool size [options] vmlinux.o.before vmlinux.o.after

-- 
Josh

  reply	other threads:[~2023-10-12 21:30 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 16:42 Uros Bizjak
2023-10-10 17:32 ` Linus Torvalds
2023-10-10 18:22   ` Uros Bizjak
2023-10-10 18:25     ` Nadav Amit
2023-10-10 18:42       ` Linus Torvalds
2023-10-10 18:37     ` Linus Torvalds
2023-10-10 18:41       ` Uros Bizjak
2023-10-10 18:52         ` Linus Torvalds
2023-10-11  7:27           ` Uros Bizjak
2023-10-11  7:45             ` Uros Bizjak
2023-10-11 19:40               ` Linus Torvalds
2023-10-11 18:42           ` Uros Bizjak
2023-10-11 19:51             ` Linus Torvalds
2023-10-11 19:52               ` Linus Torvalds
2023-10-11 20:00               ` Uros Bizjak
2023-10-11 22:37               ` Ingo Molnar
2023-10-11 23:15                 ` H. Peter Anvin
2023-10-12  1:35                   ` Josh Poimboeuf
2023-10-12  6:19                     ` Ingo Molnar
2023-10-12 16:08                       ` Josh Poimboeuf
2023-10-12 17:59                         ` Ingo Molnar
2023-10-12 21:30                           ` Josh Poimboeuf [this message]
2023-10-13 10:52                             ` Ingo Molnar
2023-10-11  7:41       ` Nadav Amit
2023-10-11 19:37         ` Linus Torvalds
2023-10-11 21:32           ` Uros Bizjak
2023-10-11 21:54             ` Linus Torvalds
2023-10-12 15:19               ` Nadav Amit
2023-10-12 16:33                 ` Uros Bizjak
2023-10-12 16:55                   ` Uros Bizjak
2023-10-12 17:10                     ` Linus Torvalds
2023-10-12 17:47                       ` Linus Torvalds
2023-10-12 18:01                         ` Uros Bizjak
2023-10-13  9:38                           ` Uros Bizjak
2023-10-13 11:53                             ` Uros Bizjak
2023-10-13 16:38                               ` Linus Torvalds
2023-10-12 17:52                       ` Uros Bizjak
2023-11-20  9:39                       ` Use %a asm operand modifier to obtain %rip-relative addressing Uros Bizjak
2023-10-12 16:56                   ` [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() Linus Torvalds
2023-10-12 17:16                 ` Linus Torvalds
2023-10-12 19:32                   ` Nadav Amit
2023-10-12 19:40                     ` Linus Torvalds
2023-10-16 18:52                 ` Uros Bizjak
2023-10-16 19:24                   ` Linus Torvalds
2023-10-16 20:35                     ` Nadav Amit
2023-10-16 20:59                       ` Linus Torvalds
2023-10-16 23:02                       ` Linus Torvalds
2023-10-16 23:14                         ` Linus Torvalds
2023-10-17  7:23                         ` Nadav Amit
2023-10-17 19:00                           ` Linus Torvalds
2023-10-17 19:11                             ` Uros Bizjak
2023-10-17 21:05                               ` Uros Bizjak
2023-10-17 21:53                                 ` Linus Torvalds
2023-10-17 22:06                                   ` Nadav Amit
2023-10-17 22:29                                     ` Nadav Amit
2023-10-18  7:46                                   ` Uros Bizjak
2023-10-18  9:04                                     ` Uros Bizjak
2023-10-18 10:54                                       ` Nadav Amit
2023-10-18 12:14                                         ` Uros Bizjak
2023-10-18 13:15                                           ` Uros Bizjak
2023-10-18 14:46                                             ` Nadav Amit
2023-10-18 15:17                                               ` Uros Bizjak
2023-10-18 16:03                                                 ` Nadav Amit
2023-10-18 16:26                                                   ` Linus Torvalds
2023-10-18 17:23                                                     ` Uros Bizjak
2023-10-18 18:11                                                       ` Linus Torvalds
2023-10-18 18:08                                                     ` Uros Bizjak
2023-10-18 18:15                                                       ` Linus Torvalds
2023-10-18 18:26                                                         ` Uros Bizjak
2023-10-18 19:33                                                           ` Uros Bizjak
2023-10-18 20:17                                                             ` Nadav Amit
2023-10-18 20:22                                                             ` Linus Torvalds
2023-10-18 20:34                                                               ` Linus Torvalds
2023-10-18 20:51                                                                 ` Uros Bizjak
2023-10-18 21:09                                                                   ` Uros Bizjak
2023-10-18 21:10                                                                   ` Linus Torvalds
2023-10-18 21:40                                                                     ` Uros Bizjak
2023-10-18 22:40                                                                       ` Linus Torvalds
2023-10-18 23:06                                                                         ` Linus Torvalds
2023-10-19  7:04                                                                         ` Uros Bizjak
2023-10-19 16:59                                                                           ` Linus Torvalds
2023-10-19 17:21                                                                             ` Uros Bizjak
2023-10-19 18:06                                                                               ` Linus Torvalds
2023-10-19 18:16                                                                                 ` Uros Bizjak
2023-10-19 18:49                                                                                   ` Linus Torvalds
2023-10-19 19:07                                                                                     ` Linus Torvalds
2023-10-20  7:57                                                                                       ` Uros Bizjak
2023-10-19 21:04                                                                                   ` Linus Torvalds
2023-10-19 22:39                                                                                     ` Linus Torvalds
2023-10-20  8:08                                                                                       ` Uros Bizjak
2023-10-19  8:44                                                                         ` Peter Zijlstra
2023-10-19  8:54                                                                         ` Peter Zijlstra
2023-10-19 17:04                                                                           ` Linus Torvalds
2023-10-19 18:13                                                                             ` Peter Zijlstra
2023-10-19 18:22                                                                               ` Linus Torvalds
2023-10-19 18:37                                                                                 ` Uros Bizjak
2023-10-19  9:07                                                                         ` Peter Zijlstra
2023-10-19  9:23                                                                           ` Uros Bizjak
2023-10-18 20:42                                                               ` Uros Bizjak
2023-10-19 16:32                                                               ` Uros Bizjak
2023-10-19 17:08                                                                 ` Linus Torvalds
2023-10-18 18:29                                                       ` Nadav Amit
2023-10-18 16:12                                             ` Linus Torvalds
2023-10-18 17:07                                               ` Uros Bizjak
2023-10-18 18:01                                                 ` Linus Torvalds
2023-10-16 21:09                   ` Uros Bizjak

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=20231012213038.pnq6eds53dbqxstj@treble \
    --to=jpoimboe@kernel.org \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®