From: Ingo Molnar <mingo@kernel.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Andy Lutomirski <luto@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Jason Baron <jbaron@akamai.com>, Jiri Kosina <jkosina@suse.cz>,
David Laight <David.Laight@ACULAB.COM>,
Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH RFC 0/3] Static calls
Date: Fri, 9 Nov 2018 08:50:08 +0100 [thread overview]
Message-ID: <20181109075008.GA80302@gmail.com> (raw)
In-Reply-To: <20181109072811.GB86700@gmail.com>
* Ingo Molnar <mingo@kernel.org> wrote:
> > - Does this feature have much value without retpolines? If not, should
> > we make it depend on retpolines somehow?
>
> Paravirt patching, as you mention in your later reply?
BTW., to look for candidates of this API, I'd suggest looking at the
function call frequency of my (almost-)distro kernel vmlinux:
$ objdump -d vmlinux | grep -w callq | cut -f3- | sort | uniq -c | sort -n | tail -100
which gives:
502 callq ffffffff8157d050 <nla_put>
522 callq ffffffff81aaf420 <down_write>
536 callq ffffffff81547e60 <_copy_to_user>
615 callq ffffffff81a97700 <snprintf>
624 callq *0xffffffff82648428
624 callq ffffffff810cc810 <__might_sleep>
625 callq ffffffff81a93b90 <strcmp>
649 callq ffffffff81547dd0 <_copy_from_user>
651 callq ffffffff811ba930 <trace_seq_printf>
654 callq ffffffff8170b6f0 <_dev_warn>
691 callq ffffffff81a93790 <strlen>
693 callq ffffffff81a88dc0 <cpumask_next>
709 callq *0xffffffff82648438
723 callq ffffffff811bdbd0 <trace_hardirqs_on>
735 callq ffffffff810feac0 <up_write>
750 callq ffffffff8163e9f0 <acpi_ut_status_exit>
768 callq *0xffffffff82648430
814 callq ffffffff81ab2710 <_raw_spin_lock_irq>
841 callq ffffffff81a9e680 <__memcpy>
863 callq ffffffff812ae3d0 <__kmalloc>
899 callq ffffffff8126ac80 <__might_fault>
912 callq ffffffff81ab2970 <_raw_spin_unlock_irq>
939 callq ffffffff81aaaf10 <_cond_resched>
966 callq ffffffff811bda00 <trace_hardirqs_off>
1069 callq ffffffff81126f50 <rcu_read_lock_sched_held>
1078 callq ffffffff81097760 <__warn_printk>
1081 callq ffffffff8157b140 <__dynamic_dev_dbg>
1351 callq ffffffff8170b630 <_dev_err>
1365 callq ffffffff811050c0 <lock_is_held_type>
1373 callq ffffffff81a977f0 <sprintf>
1390 callq ffffffff8157b090 <__dynamic_pr_debug>
1453 callq ffffffff8155c650 <__list_add_valid>
1501 callq ffffffff812ad6f0 <kmem_cache_alloc_trace>
1509 callq ffffffff8155c6c0 <__list_del_entry_valid>
1513 callq ffffffff81310ce0 <seq_printf>
1571 callq ffffffff81ab2780 <_raw_spin_lock_irqsave>
1624 callq ffffffff81ab29b0 <_raw_spin_unlock_irqrestore>
1661 callq ffffffff81126fd0 <rcu_read_lock_held>
1986 callq ffffffff81104940 <lock_acquire>
2050 callq ffffffff811c5110 <trace_define_field>
2133 callq ffffffff81102c70 <lock_release>
2507 callq ffffffff81ab2560 <_raw_spin_lock>
2676 callq ffffffff81aadc40 <mutex_lock_nested>
3056 callq ffffffff81ab2900 <_raw_spin_unlock>
3294 callq ffffffff81aac610 <mutex_unlock>
3628 callq ffffffff81129100 <rcu_is_watching>
4462 callq ffffffff812ac2c0 <kfree>
6454 callq ffffffff8111a51e <printk>
6676 callq ffffffff81101420 <lockdep_rcu_suspicious>
7328 callq ffffffff81e014b0 <__x86_indirect_thunk_rax>
7598 callq ffffffff81126f30 <debug_lockdep_rcu_enabled>
9065 callq ffffffff810979f0 <__stack_chk_fail>
The most prominent callers which are already function call pointers today
are:
$ objdump -d vmlinux | grep -w callq | grep \* | cut -f3- | sort | uniq -c | sort -n | tail -10
109 callq *0xffffffff82648530
134 callq *0xffffffff82648568
154 callq *0xffffffff826483d0
260 callq *0xffffffff826483d8
297 callq *0xffffffff826483e0
345 callq *0xffffffff82648440
345 callq *0xffffffff82648558
624 callq *0xffffffff82648428
709 callq *0xffffffff82648438
768 callq *0xffffffff82648430
That's all pv_ops->*() method calls:
ffffffff82648300 D pv_ops
ffffffff826485d0 D pv_info
Optimizing those thousands of function pointer calls would already be a
nice improvement.
But retpolines:
7328 callq ffffffff81e014b0 <__x86_indirect_thunk_rax>
ffffffff81e014b0 <__x86_indirect_thunk_rax>:
ffffffff81e014b0: ff e0 jmpq *%rax
... are even more prominent, and turned on in every distro as well,
obviously.
Thanks,
Ingo
next prev parent reply other threads:[~2018-11-09 7:50 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 21:15 [PATCH RFC 0/3] Static calls Josh Poimboeuf
2018-11-08 21:15 ` [RFC PATCH 1/3] static_call: Add static call infrastructure Josh Poimboeuf
2018-11-09 9:51 ` Ard Biesheuvel
2018-11-09 14:55 ` Josh Poimboeuf
2018-11-09 13:39 ` Ard Biesheuvel
2018-11-09 15:10 ` Josh Poimboeuf
2018-11-09 15:14 ` Ard Biesheuvel
2018-11-09 17:25 ` Ard Biesheuvel
2018-11-09 17:31 ` Josh Poimboeuf
2018-11-09 17:33 ` Ard Biesheuvel
2018-11-09 17:46 ` Josh Poimboeuf
2018-11-09 17:52 ` Ard Biesheuvel
2018-11-09 17:53 ` Ard Biesheuvel
2018-11-09 19:03 ` Josh Poimboeuf
2018-11-09 19:12 ` Ard Biesheuvel
2018-11-09 17:33 ` Josh Poimboeuf
2018-11-09 18:33 ` Steven Rostedt
2018-11-09 19:35 ` Josh Poimboeuf
2018-11-09 19:57 ` Steven Rostedt
2018-11-09 20:34 ` Josh Poimboeuf
2018-11-10 5:10 ` Steven Rostedt
2018-11-10 11:58 ` Ard Biesheuvel
2018-11-10 13:09 ` Steven Rostedt
2018-11-12 3:07 ` Josh Poimboeuf
2018-11-12 4:39 ` Ard Biesheuvel
2018-11-12 4:56 ` Josh Poimboeuf
2018-11-12 5:02 ` Ard Biesheuvel
2018-11-10 11:56 ` Ard Biesheuvel
2018-11-08 21:15 ` [RFC PATCH 2/3] x86/static_call: Add x86 unoptimized static call implementation Josh Poimboeuf
2018-11-08 21:15 ` [RFC PATCH 3/3] x86/static_call: Add optimized static call implementation for 64-bit Josh Poimboeuf
2018-11-08 21:24 ` [PATCH RFC 0/3] Static calls Josh Poimboeuf
2018-11-09 7:28 ` Ingo Molnar
2018-11-09 7:50 ` Ingo Molnar [this message]
2018-11-09 13:50 ` Ard Biesheuvel
2018-11-09 15:20 ` Josh Poimboeuf
2018-11-10 23:20 ` Peter Zijlstra
2018-11-11 13:42 ` Ard Biesheuvel
2018-11-11 14:25 ` Peter Zijlstra
2018-11-09 14:45 ` Josh Poimboeuf
2018-11-12 5:02 ` Ingo Molnar
2018-11-12 5:30 ` Josh Poimboeuf
2018-11-12 9:39 ` Ard Biesheuvel
2018-11-12 22:52 ` Josh Poimboeuf
2018-11-12 17:03 ` Steven Rostedt
2018-11-12 22:56 ` Josh Poimboeuf
2018-11-12 5:34 ` Andy Lutomirski
2018-11-09 15:16 ` Andy Lutomirski
2018-11-09 15:21 ` Josh Poimboeuf
2018-11-09 16:41 ` Josh Poimboeuf
2018-11-09 18:42 ` Steven Rostedt
2018-11-09 19:05 ` Andy Lutomirski
2018-11-09 19:37 ` Steven Rostedt
2018-11-09 19:44 ` Josh Poimboeuf
2018-11-09 19:59 ` Steven Rostedt
2018-11-09 20:36 ` Josh Poimboeuf
2018-11-10 15:13 ` Masami Hiramatsu
2018-11-09 20:53 ` Rasmus Villemoes
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=20181109075008.GA80302@gmail.com \
--to=mingo@kernel.org \
--cc=David.Laight@ACULAB.COM \
--cc=a.p.zijlstra@chello.nl \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=jbaron@akamai.com \
--cc=jkosina@suse.cz \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--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