Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1221488imu; Fri, 9 Nov 2018 12:54:05 -0800 (PST) X-Google-Smtp-Source: AJdET5dK2+GVdkderGgSumKcTBGMAx5Sso68l96bEILPXbosxueGwT+0qMwErd3uaYGtepvsocY1 X-Received: by 2002:a63:451a:: with SMTP id s26mr8917568pga.150.1541796845433; Fri, 09 Nov 2018 12:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541796845; cv=none; d=google.com; s=arc-20160816; b=ql4hnaaxmT14iEDoTOvxeZSLOub4A8ALE4Q1mOcaWGBOjDE0zC6uEtawLOiaS9Cqix JZkdJUlikW5AiD+A5o8PtCKMgnRSsYJ/Ewe+ZM6QSqnjNEIffsqhXKbPlpoBy819Jc5P 8xBQBjU/c+0qb51kGbsRRsKJ6U3tDOiOP053F+oIpgwGf4l0cnv8Qukxr+96UBmN3OtA ydBG7MHCO+tvmZqtpfW4kl1FtOYXetGIKNukU9TAxGPxoilaymGfdcKVovuDqPzMXKbB FmCG76Ng5bxE/0WOuBkzETQHxXLp/h0tLi5f5ToqxndgulSKHi3l5HLc1FbWUu9CIq4z fY0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Wjzqdqykk6z553Fe0xP1a7AI2E2DCKEgihIyL5uH7N0=; b=YW3xWoTugy/Y2o5YRDIRayb/oVQgh9RuUQvgSxNpZQgSDg/z6JVw4XiTNSjZc8H9/e UVnP1o9pk6WrHKoC8z/zUHc5Z8qSE3+y7rCoCkq0JB94HlJnUiB48OtLxZDESGCE7GZC DPOqr1vs+F9KldvrFB9Wv18z9FVDc3J2lyLjjkSftuy1OzinGIefl6yr/+efnJ4apNc3 SiJAoCQLxbm2x3sPSK+fCBDKTAU5KjOi8piVb9lQSe2jQXb6FjSArA8u6JwYBudgOgNZ K+gO91dbW47HEOACrbqnKALbqB0G18hV3Rg0viPxKFCesf8ncs2vFkEpwkp8oP4CO+Un kshQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=gWO7mRnP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si7376633pgj.417.2018.11.09.12.53.50; Fri, 09 Nov 2018 12:54:05 -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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=gWO7mRnP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728863AbeKJGf3 (ORCPT + 99 others); Sat, 10 Nov 2018 01:35:29 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42023 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728302AbeKJGf2 (ORCPT ); Sat, 10 Nov 2018 01:35:28 -0500 Received: by mail-lj1-f196.google.com with SMTP id f3-v6so2720752ljk.9 for ; Fri, 09 Nov 2018 12:53:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Wjzqdqykk6z553Fe0xP1a7AI2E2DCKEgihIyL5uH7N0=; b=gWO7mRnPobtGLnWwItRFo8/OEmoDbpc51qy9OZIWzZzKSREAUaz+NOZMrHOlqrUSoX OIfktOClCJylxfdXkPg2ETzK4e9pTrv0IZHUWUVlN2tXcmfZlp3bnw1Cnb5pMmbXQ9O5 mT68raQIg5jYRK5EvqIi55zasQ6vQko9zzOvA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Wjzqdqykk6z553Fe0xP1a7AI2E2DCKEgihIyL5uH7N0=; b=dtb4JksG6XZqIHD0N2h8sLbvldlUyS6DLMWRVbM9LAHMO+wBjrj9rJZQtGlbO7N84C bjbyCe1e1ZamIKzRL/ReBziPvr+qkE8tKg5DciW1E19hZhrYrYm3q8BvnIko6wMmmEDv 2fwGc4SID2pUfBWVhiXTeHmnyMFQZY8an9z9nTHXVcWGrV+9hxvv0ZKB9TBrvWCNUKSJ aYebgfngWSVya05NSI4yhNKpbaQ4Ojv0h8/86dG+8HzOWluhyelmq1AsWNAWgN1kxGLE 7AOugaJtpGNK3fV0EZKUyOV2EqLB795Wh0l/4TV8FHEM7wRfEbph4sUyXZqEK28cdB6s uP0A== X-Gm-Message-State: AGRZ1gLcDvEtmWP4sUqOHnprtudbuBc//7elW5gWm3u2nlY8enuapr9/ MXZdo9NbjuimXwGOt/N2pX9JtQ== X-Received: by 2002:a2e:4745:: with SMTP id u66-v6mr6311995lja.37.1541796790185; Fri, 09 Nov 2018 12:53:10 -0800 (PST) Received: from [192.168.0.189] (dhcp-5-186-114-252.cgn.ip.fibianet.dk. [5.186.114.252]) by smtp.gmail.com with ESMTPSA id o72sm1699327lfg.33.2018.11.09.12.53.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Nov 2018 12:53:09 -0800 (PST) Subject: Re: [PATCH RFC 0/3] Static calls To: Andy Lutomirski , Ingo Molnar Cc: Josh Poimboeuf , LKML , X86 ML , Ard Biesheuvel , Steven Rostedt , Peter Zijlstra , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov References: <20181109072811.GB86700@gmail.com> From: Rasmus Villemoes Message-ID: <54b6c3b1-acf3-d591-cd2a-79eae4ff0ebb@rasmusvillemoes.dk> Date: Fri, 9 Nov 2018 21:53:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/11/2018 16.16, Andy Lutomirski wrote: > On Thu, Nov 8, 2018 at 11:28 PM Ingo Molnar wrote: >> >> >> All other usecases are bonus, but it would certainly be interesting to >> investigate the impact of using these APIs for tracing: that too is a >> feature enabled everywhere but utilized only by a small fraction of Linux >> users - so literally every single cycle or instruction saved or hot-path >> shortened is a major win. > > For tracing, we'd want static_call_set_to_nop() or something like that, right? > Hm. IIUC, when gcc sees static_call(key)(...), it has to generate code to put the right values in %rdi, %rsi etc.. Even if the function is void (*)(void), gcc would still need to shuffle things around (either spill and reload, or move %rdi to some callee saved register). So if the static_call is noop'ed out most of the time, that seems like a net loss? With an unlikely static_key, gcc can do all the parameter setup and reloading in an out-of-line chunk of code. static calls seems like a quite useful concept, but only/mostly if _some_ function needs to be called at that spot. Aside: there should be some compile-time check that static_call_set_to_nop can only be used if the return type is void. Rasmus