Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp447557imu; Thu, 8 Nov 2018 23:51:31 -0800 (PST) X-Google-Smtp-Source: AJdET5fqa/pu57Vu+W6rCBk/OC9jw4QFdzmbCim34E2O9xhMuLMs+XM11xJWCgFGYAtR4Ug5saF4 X-Received: by 2002:a17:902:6686:: with SMTP id e6-v6mr7801105plk.173.1541749891812; Thu, 08 Nov 2018 23:51:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541749891; cv=none; d=google.com; s=arc-20160816; b=rDiQyWEmALzN0k+gCiHw7nZ4qaxcSuJ/33KfHdYBnXqq01vRMo+I4DU/Ssny+FwoCS 1hm1vpsXcKxj07rBbZD6LjEaPD5Xook5QgK7Hst+EZJIPcebXMk9YT3CmfcFXngtgFcL 88QJrD/RgMHBzB2LDlt3Nvon7fnKUquZLHLluFr20HiwSdRwVZjcUpFTdzr2usxwzZ7X 4NadAcOgm7GZPAdhUeU5ixfB1JIjpRgZ0VrTQ/L/jAyO/aocCBub/niG1ecIk1IQXj50 xzqh5Knc/5mJ29qqbC4TQl+twLzfSkw0DE5PgDrdSfgBb3ZGm2oQGpYDpPcpvQfKlF1d QZPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZUHX1+rp5kaju6rV5UcvjXo+abHHVcV7SRvKzxKKBpg=; b=sOosnhgiZe2H0SfjAgEjmNC9c0pmcOVWvyw04G10qHTvxu3rNnmzLpnPVk8mvrYfXG ecH9k1Ge7+cFV2xekxgZMQVJ/uuCp/9kQNW2qfjNzNZXf5t9+Zhu31Bl4LXo5l7rON67 xl1f+EhiVLdmt37NQu9n9mQY9Tj8AwMI+vYYUw4fVf8vXywiqqV+jXoyGH1XvDrAS+vp YsejCMWKGL1fkDPh29SUAxNrQVy9zcTlQh0KAR3HRgGzTdlkhY6YdF5Ihez4N5eFvAfD LX4jNxcAbp0Vj0COqKN6c9wdNI37oTUk4FeNieIkvoqczvAE7cbBE4Nb+ADYqXYOH5xV i+OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=BRE3e+cg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si5754474pgh.496.2018.11.08.23.51.16; Thu, 08 Nov 2018 23:51:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=BRE3e+cg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728377AbeKIR3g (ORCPT + 99 others); Fri, 9 Nov 2018 12:29:36 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34469 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727789AbeKIR3f (ORCPT ); Fri, 9 Nov 2018 12:29:35 -0500 Received: by mail-wr1-f65.google.com with SMTP id j26-v6so843361wre.1 for ; Thu, 08 Nov 2018 23:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZUHX1+rp5kaju6rV5UcvjXo+abHHVcV7SRvKzxKKBpg=; b=BRE3e+cgM4YcrvTx9s7248PEfO1TbDHRtir9Kk/3kdnRS7cJdZ49wBegutLIvcU7Sl PBcqPw0hChnkyTewUYYJiqGCUWu52RSZHF9t2vm1awgkmWlJZpjfcaLtt0CVdw7XaAbk N/iRkkAlWnInx0v7JSzyC6c8HBC6DvElYQJXl/erpQN8AyAyMh8bfoaaMW9tXwp5bG3n FeN9fEO3MZcCeClHMJFODLEJMx8aN2ogYt+las75lkNVTBDa6egAJvJDHo0k7wHZisqv XosiYXwiKYNf/Ps8b4WZu1kaOen9us9FW8O5aNf4TgXYAra1XlsZMT6yqwTOufS0hMAY 5bqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=ZUHX1+rp5kaju6rV5UcvjXo+abHHVcV7SRvKzxKKBpg=; b=Fv5Rt8A1o83Odqzd3L0HonVfZsD0EruF6A4WfxLBef0dldsWtm9tcyT4QsesImFbwy 0dxxyf4faGF97HKT52315MuJpGdetCJQqTxlypodNUwSLpqDlz1mWg8omN46SqMBJ862 38W8/EoLf55Ji5COMRWkTQnB71/MHRpf6zkNoGFh9B4IAAdiQieLibDKr9OZfi8uAWY2 1cSN9IKIJDrp44lVmqXED0jpi+D+FBOoOlM8Ka16mIGgksbJYNwR2JKK7BGfMMupuunV 3oV5eavRgmvI8K48w65GP6gXzwfo/2V9MZ1oJneZVSZg/Irx0ZY0kKicfcH2GfAJPT5N 9K4A== X-Gm-Message-State: AGRZ1gJL33I0ReZRb07aRkI3ovqH7roXPs6G5UblrX37Dbtop3fnoV97 xTlPc40V+puIyvbg1JJRASY= X-Received: by 2002:adf:b1db:: with SMTP id r27-v6mr6912349wra.95.1541749811865; Thu, 08 Nov 2018 23:50:11 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id r188-v6sm782926wmg.19.2018.11.08.23.50.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 23:50:11 -0800 (PST) Date: Fri, 9 Nov 2018 08:50:08 +0100 From: Ingo Molnar To: Josh Poimboeuf Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Peter Zijlstra , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Peter Zijlstra Subject: Re: [PATCH RFC 0/3] Static calls Message-ID: <20181109075008.GA80302@gmail.com> References: <20181109072811.GB86700@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181109072811.GB86700@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar 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 522 callq ffffffff81aaf420 536 callq ffffffff81547e60 <_copy_to_user> 615 callq ffffffff81a97700 624 callq *0xffffffff82648428 624 callq ffffffff810cc810 <__might_sleep> 625 callq ffffffff81a93b90 649 callq ffffffff81547dd0 <_copy_from_user> 651 callq ffffffff811ba930 654 callq ffffffff8170b6f0 <_dev_warn> 691 callq ffffffff81a93790 693 callq ffffffff81a88dc0 709 callq *0xffffffff82648438 723 callq ffffffff811bdbd0 735 callq ffffffff810feac0 750 callq ffffffff8163e9f0 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 1069 callq ffffffff81126f50 1078 callq ffffffff81097760 <__warn_printk> 1081 callq ffffffff8157b140 <__dynamic_dev_dbg> 1351 callq ffffffff8170b630 <_dev_err> 1365 callq ffffffff811050c0 1373 callq ffffffff81a977f0 1390 callq ffffffff8157b090 <__dynamic_pr_debug> 1453 callq ffffffff8155c650 <__list_add_valid> 1501 callq ffffffff812ad6f0 1509 callq ffffffff8155c6c0 <__list_del_entry_valid> 1513 callq ffffffff81310ce0 1571 callq ffffffff81ab2780 <_raw_spin_lock_irqsave> 1624 callq ffffffff81ab29b0 <_raw_spin_unlock_irqrestore> 1661 callq ffffffff81126fd0 1986 callq ffffffff81104940 2050 callq ffffffff811c5110 2133 callq ffffffff81102c70 2507 callq ffffffff81ab2560 <_raw_spin_lock> 2676 callq ffffffff81aadc40 3056 callq ffffffff81ab2900 <_raw_spin_unlock> 3294 callq ffffffff81aac610 3628 callq ffffffff81129100 4462 callq ffffffff812ac2c0 6454 callq ffffffff8111a51e 6676 callq ffffffff81101420 7328 callq ffffffff81e014b0 <__x86_indirect_thunk_rax> 7598 callq ffffffff81126f30 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