From: David Laight <david.laight.linux@gmail.com>
To: Alexandre Chartre <alexandre.chartre@oracle.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
jpoimboe@kernel.org, peterz@infradead.org
Subject: Re: [PATCH v4 00/28] objtool: Function validation tracing
Date: Thu, 13 Nov 2025 19:55:53 +0000 [thread overview]
Message-ID: <20251113195553.34bc309c@pumpkin> (raw)
In-Reply-To: <20251113164917.2563486-1-alexandre.chartre@oracle.com>
On Thu, 13 Nov 2025 17:48:49 +0100
Alexandre Chartre <alexandre.chartre@oracle.com> wrote:
> Hi,
>
> These patches change objtool to disassemble code with libopcodes instead
> of running objdump. You will find below:
>
> - Changes: list of changes made in this version
> - Overview: overview of the changes
> - Notes: description of some particular behavior
> - Examples: output examples
...
> Example 3 (--disas option): Alternatives with multiple instructions
> -------------------------------------------------------------------
> Alternatives with multiple instructions are displayed side-by-side, with
> an header describing the alternative. The code in the first column is the
> default code of the alternative.
>
>
> $ ./tools/objtool/objtool --disas=__switch_to_asm --link vmlinux.o
> __switch_to_asm:
> 82c0: __switch_to_asm+0x0 push %rbp
> 82c1: __switch_to_asm+0x1 push %rbx
> 82c2: __switch_to_asm+0x2 push %r12
> 82c4: __switch_to_asm+0x4 push %r13
> 82c6: __switch_to_asm+0x6 push %r14
> 82c8: __switch_to_asm+0x8 push %r15
> 82ca: __switch_to_asm+0xa mov %rsp,0x1670(%rdi)
> 82d1: __switch_to_asm+0x11 mov 0x1670(%rsi),%rsp
> 82d8: __switch_to_asm+0x18 mov 0xad8(%rsi),%rbx
> 82df: __switch_to_asm+0x1f mov %rbx,%gs:0x0(%rip) # 0x82e7 <__stack_chk_guard>
> 82e7: __switch_to_asm+0x27 | <alternative.82e7> | !X86_FEATURE_ALWAYS | X86_FEATURE_RSB_CTXSW
> 82e7: __switch_to_asm+0x27 | jmp 0x8312 <__switch_to_asm+0x52> | NOP1 | mov $0x10,%r12
> 82e8: __switch_to_asm+0x28 | | NOP1 |
> 82e9: __switch_to_asm+0x29 | NOP1 | callq 0x82ef <__switch_to_asm+0x2f> |
> 82ea: __switch_to_asm+0x2a | NOP1 | |
> 82eb: __switch_to_asm+0x2b | NOP1 | |
> 82ec: __switch_to_asm+0x2c | NOP1 | |
> 82ed: __switch_to_asm+0x2d | NOP1 | |
> 82ee: __switch_to_asm+0x2e | NOP1 | int3 | callq 0x82f4 <__switch_to_asm+0x34>
> 82ef: __switch_to_asm+0x2f | NOP1 | add $0x8,%rsp |
> 82f0: __switch_to_asm+0x30 | NOP1 | |
> 82f1: __switch_to_asm+0x31 | NOP1 | |
> 82f2: __switch_to_asm+0x32 | NOP1 | |
> 82f3: __switch_to_asm+0x33 | NOP1 | lfence | int3
> 82f4: __switch_to_asm+0x34 | NOP1 | | callq 0x82fa <__switch_to_asm+0x3a>
> 82f5: __switch_to_asm+0x35 | NOP1 | |
> 82f6: __switch_to_asm+0x36 | NOP1 | |
> 82f7: __switch_to_asm+0x37 | NOP1 | |
> 82f8: __switch_to_asm+0x38 | NOP1 | |
> 82f9: __switch_to_asm+0x39 | NOP1 | | int3
> 82fa: __switch_to_asm+0x3a | NOP1 | | add $0x10,%rsp
> 82fb: __switch_to_asm+0x3b | NOP1 | |
> 82fc: __switch_to_asm+0x3c | NOP1 | |
> 82fd: __switch_to_asm+0x3d | NOP1 | |
> 82fe: __switch_to_asm+0x3e | NOP1 | | dec %r12
> 82ff: __switch_to_asm+0x3f | NOP1 | |
> 8300: __switch_to_asm+0x40 | NOP1 | |
> 8301: __switch_to_asm+0x41 | NOP1 | | jne 0x82ee <__switch_to_asm+0x2e>
> 8302: __switch_to_asm+0x42 | NOP1 | |
> 8303: __switch_to_asm+0x43 | NOP1 | | lfence
> 8304: __switch_to_asm+0x44 | NOP1 | |
> 8305: __switch_to_asm+0x45 | NOP1 | |
> 8306: __switch_to_asm+0x46 | NOP1 | | movq $0xffffffffffffffff,%gs:0x0(%rip) # 0x20b <__x86_call_depth>
> 8307: __switch_to_asm+0x47 | NOP1 | |
> 8308: __switch_to_asm+0x48 | NOP1 | |
> 8309: __switch_to_asm+0x49 | NOP1 | |
> 830a: __switch_to_asm+0x4a | NOP1 | |
> 830b: __switch_to_asm+0x4b | NOP1 | |
> 830c: __switch_to_asm+0x4c | NOP1 | |
> 830d: __switch_to_asm+0x4d | NOP1 | |
> 830e: __switch_to_asm+0x4e | NOP1 | |
> 830f: __switch_to_asm+0x4f | NOP1 | |
> 8310: __switch_to_asm+0x50 | NOP1 | |
> 8311: __switch_to_asm+0x51 | NOP1 | |
> 8312: __switch_to_asm+0x52 pop %r15
> 8314: __switch_to_asm+0x54 pop %r14
> 8316: __switch_to_asm+0x56 pop %r13
> 8318: __switch_to_asm+0x58 pop %r12
> 831a: __switch_to_asm+0x5a pop %rbx
> 831b: __switch_to_asm+0x5b pop %rbp
> 831c: __switch_to_asm+0x5c jmpq 0x8321 <__switch_to>
That might be rather easier to read if the alternatives followed each other.
Not all of us want to use a very wide window to look at object files.
(I didn't see any other example like that either.)
Similarly in Ex 5:
332d4: early_ioremap_pmd+0x4 callq *0x0(%rip) # 0x332da <pv_ops+0x150> | mov %cr3,%rax (!X86_FEATURE_XENPV) | callq xen_read_cr3 (+X86_FEATURE_ALWAYS) # <alternative.332d4>
might be more readable flipped to something like:
332d4: early_ioremap_pmd+0x4 callq *0x0(%rip) # 0x332da <pv_ops+0x150>
!X86_FEATURE_XENPV: mov %cr3,%rax
+X86_FEATURE_ALWAYS: callq xen_read_cr3
David
next prev parent reply other threads:[~2025-11-13 19:55 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 16:48 [PATCH v4 00/28] objtool: Function validation tracing Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 01/28] objtool: Move disassembly functions to a separated file Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 02/28] objtool: Create disassembly context Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 03/28] objtool: Disassemble code with libopcodes instead of running objdump Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 04/28] tool build: Remove annoying newline in build output Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 05/28] objtool: Print symbol during disassembly Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 06/28] objtool: Store instruction disassembly result Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 07/28] objtool: Disassemble instruction on warning or backtrace Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 08/28] objtool: Extract code to validate instruction from the validate branch loop Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 09/28] objtool: Record symbol name max length Alexandre Chartre
2025-11-13 16:48 ` [PATCH v4 10/28] objtool: Add option to trace function validation Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 11/28] objtool: Trace instruction state changes during " Alexandre Chartre
2025-11-14 21:21 ` Josh Poimboeuf
2025-11-17 7:33 ` Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 12/28] objtool: Improve register reporting " Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 13/28] objtool: Identify the different types of alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 14/28] objtool: Improve tracing of alternative instructions Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 15/28] objtool: Do not validate IBT for .return_sites and .call_sites Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 16/28] objtool: Add the --disas=<function-pattern> action Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 17/28] objtool: Print headers for alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 18/28] objtool: Disassemble group alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 19/28] objtool: Print addresses with alternative instructions Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 20/28] objtool: Disassemble exception table alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 21/28] objtool: Disassemble jump " Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 22/28] objtool: Fix address references in alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 23/28] objtool: Provide access to feature and flags of group alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 24/28] objtool: Function to get the name of a CPU feature Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 25/28] objtool: Improve naming of group alternatives Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 26/28] objtool: Get the destination name of a PV call Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 27/28] objtool: Improve the disassembly of the pv_ops call Alexandre Chartre
2025-11-15 1:34 ` kernel test robot
2025-11-17 7:37 ` Alexandre Chartre
2025-11-13 16:49 ` [PATCH v4 28/28] objtool: Print single line for alternatives with one instruction Alexandre Chartre
2025-11-13 19:55 ` David Laight [this message]
2025-11-14 8:53 ` [PATCH v4 00/28] objtool: Function validation tracing Alexandre Chartre
2025-11-14 1:48 ` Josh Poimboeuf
2025-11-14 9:56 ` Alexandre Chartre
2025-11-14 21:34 ` Josh Poimboeuf
2025-11-17 7:50 ` Alexandre Chartre
2025-11-17 9:42 ` David Laight
2025-11-17 9:47 ` Alexandre Chartre
2025-11-17 12:37 ` David Laight
2025-11-17 13:11 ` Alexandre Chartre
2025-11-17 22:09 ` David Laight
2025-11-17 22:38 ` Josh Poimboeuf
2025-11-18 9:58 ` David Laight
2025-11-18 7:19 ` Alexandre Chartre
2025-11-18 9:12 ` Peter Zijlstra
2025-11-18 11:39 ` Alexandre Chartre
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=20251113195553.34bc309c@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=alexandre.chartre@oracle.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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