Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1894524imu; Sat, 10 Nov 2018 03:57:15 -0800 (PST) X-Google-Smtp-Source: AJdET5fo37y7Zzj2eyriuQhok4uCZ/ZvKwoIn/xY/jdbjEJWbbvZb/rU7yhq9yQ2NqtkQXBdMLqJ X-Received: by 2002:a65:51c6:: with SMTP id i6-v6mr10644125pgq.227.1541851035212; Sat, 10 Nov 2018 03:57:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541851035; cv=none; d=google.com; s=arc-20160816; b=gpix9AMExemv+JKbNUAqy0Tqck2COcUF0Wy13saKZMAuf1m/4HAaFcAAwsD5s9mvvX 1HZpfyL9dWwiStwzzquCzGaKCwaMr8eBSZuCRjLc9IuSMnEVbhzoB6IZ7P7xKBv4pVOo cxN3fwi/ViAIoHKJtG/uCPAqui9eV9iZNUnNxPagVhKyuMvao+9ohkAk6jb/p5XNgFOm fUdrKc0Nb4HSP5lJKVGQSPeD4IW/BMOJlP/SVvT2Tu0++1IXnpTQYayfqyYn25IryhUh WK457RrZ1NhyKGXV3Tn5O4Ni47fE22rtdgsk8aBHmMJCa+Po4G+EI9RYbeZ9beX52rEg ivEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=7SaUmRtTl9bZ2cU9Pmc4hM+LKKnfHM4Uw6+uYvfmdmA=; b=C7NXXg70Z2YF9M6FiD4fcAR8HM5irl5n8ACtFVbFbgJKWV6ZBltAQ04lK8dHyf4RSY OLjF5ozoZ1HA/ZZyrNJdM8UUglXbq2Bnrp+SyBfXHjKEVxgqOYI8WciKxisqAQQZWlWK J2XihcqKk4nLAd+lSxoDccBeOwUTWWBACEi1TLrTqN6R+IA67PZOJHD0iumb3s/YnIqV ULqosOP4EfxU2CtVbvu592wBC2wO2+O69WlUdMDlkT+8Wa92WH0wFPGnkKaseEbCr87o 6KQnNXMJdt1Kdfj0rHTN2E++sv/aH8DqggnxDUUdYnNjZYIUVx4u+2dtNndYiko4iu0m Ac8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LG1QN4MS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k83-v6si11436979pfj.115.2018.11.10.03.56.57; Sat, 10 Nov 2018 03:57:15 -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=@linaro.org header.s=google header.b=LG1QN4MS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729034AbeKJVlV (ORCPT + 99 others); Sat, 10 Nov 2018 16:41:21 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:38982 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728959AbeKJVlV (ORCPT ); Sat, 10 Nov 2018 16:41:21 -0500 Received: by mail-it1-f193.google.com with SMTP id m15so7187765itl.4 for ; Sat, 10 Nov 2018 03:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7SaUmRtTl9bZ2cU9Pmc4hM+LKKnfHM4Uw6+uYvfmdmA=; b=LG1QN4MSXUHSY4hHSthogoE/y0JIAY4wTpSkoiRoxHWgyoSDDkyxRjnsPTu7pLG14t epLML84mppHkik+XQOqKBn7X9Lpa/ADzqw8Lq273aqR8oHa0ox7D2xmEtrBQWriyi/Pm kI0QaWjaDpHaCVM69pr0FLqPkhjjcQBFAM+Eo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7SaUmRtTl9bZ2cU9Pmc4hM+LKKnfHM4Uw6+uYvfmdmA=; b=GCFAMGAJS6+XgXhgcecKnP3UGc/fWaEQX7VFQ3uLECGaZYihwIU0zxAiWuKdAfExan lRM57lD5DY2EdMKclv5Ua2TqnvkhnBVYy1uNkQo8nY4gxlPZCpjjdcdXgiGYV7EyTR0r rxe3Fmv4oMBU9rGlMpQwVryvwFKb+EzHyaTbI8I5chzURNAgoiuXXZBDnO14b75vL61n w2djV1biJ4w3EJ0xXi3nnfUexTw6tt1Q2PXKFArMibBNLt3iUZyyIJogkPNcshrn/ruK w3ooEpgAQUvConC6QAHT8oo0guMYmtRUfduv0PDZejkjcOIGp98z7HDTCqmvdl99HiEo xXKg== X-Gm-Message-State: AGRZ1gIsLevQU/pHIOGp5W/xrRcGRuxeEK9RrKIAdc4M2/zrqlGENNbA rpo+LSDEzHKM8N6zjBUsAiiZrbUbVA7dxobDd5LJ2yGl X-Received: by 2002:a24:8347:: with SMTP id d68-v6mr5924827ite.158.1541850994202; Sat, 10 Nov 2018 03:56:34 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a6b:4f16:0:0:0:0:0 with HTTP; Sat, 10 Nov 2018 03:56:33 -0800 (PST) In-Reply-To: <20181109203459.wbftlkxcvfnwo2bm@treble> References: <3cf04e113d71c9f8e4be95fb84a510f085aa4afa.1541711457.git.jpoimboe@redhat.com> <20181109133337.63487e3a@gandalf.local.home> <20181109193505.5p5iddrtgpk2cpb4@treble> <20181109145746.0037da3f@gandalf.local.home> <20181109203459.wbftlkxcvfnwo2bm@treble> From: Ard Biesheuvel Date: Sat, 10 Nov 2018 12:56:33 +0100 Message-ID: Subject: Re: [RFC PATCH 1/3] static_call: Add static call infrastructure To: Josh Poimboeuf Cc: Steven Rostedt , Linux Kernel Mailing List , "the arch/x86 maintainers" , Andy Lutomirski , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9 November 2018 at 21:34, Josh Poimboeuf wrote: > On Fri, Nov 09, 2018 at 02:57:46PM -0500, Steven Rostedt wrote: >> On Fri, 9 Nov 2018 13:35:05 -0600 >> Josh Poimboeuf wrote: >> .. >> > > So what's the reason for skipping init calls? >> > >> > This is the runtime changing code (static_call_update). Presumably the >> > init sections no longer exist and we shouldn't write to any (former) >> > call sites there. >> > >> > That's probably a dangerous assumption though... If >> > static_call_update() were called early, some init code might not get >> > patched and then call into the wrong function. >> > >> > I'm thinking we should just disallow static call sites in init sections. >> > I can't think of a good reason why they would be needed in init code. >> > We can WARN when detecting them during boot / module init. >> > >> >> What I would do is to allow init (like ftrace now does). I have >> ftrace_free_init_mem() that removes all the mcount references for init >> calls from its list. You could add a static_call_free_init() to >> kernel_init() in init/main.c too. > > That makes sense for ftrace, but I don't see much point in allowing it > for static calls. Maybe we could just add support for it later if it > turns out to be useful. > I don't see how you can prevent that. Some arch may use a static call in its version of some library code which could be used anywhere, including in .init code.