Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3669464imu; Sun, 11 Nov 2018 21:03:11 -0800 (PST) X-Google-Smtp-Source: AJdET5epTKMwxEQOfGpH1p+WO37/FNORARAtZtPCgfkB5zJKiXvENQAKQhxEY4vnsqvpjSnydxBs X-Received: by 2002:a62:83c2:: with SMTP id h185-v6mr18530013pfe.187.1541998991482; Sun, 11 Nov 2018 21:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541998991; cv=none; d=google.com; s=arc-20160816; b=q/VncEqmzWd4/5ODw9EJecW4NTuZWnqiP4Y0mzfhfoz4OaEFvDaY2pTLfCGCQLKEeB rBCBH11ZJrsi4DCs0yTFB0sW9qSjFrRiunkhM80hHCp74X5ABsbory7XvRVkt9KCzVgW sp+PVWzNPXobygsZ+ExCsDMavjLOi5IJHeADrQxDDxCrN/LjgNPNeMjSLB6Uhaa/e+U+ CKRMOk29MFOibvBWVHwVGK4vU0n7adIiLcbiXawNJgFZva1jwhSeedVfky2l1ZIgppm+ jLdiLaGJPKiIqFy8n4Aufpnb3mJ9x/XTNg/6HYxAz+IFU/R7ErGXUDEwOMCPWfTrXdaY IX3g== 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=HinaT8KymDNWwd0EK9K+PO9iDLejU4LJurjBuIuseZE=; b=rcvnbKE1fpF8IVOhmSg6/vVAjMVQ2GN5cB/MQXiAKWl3oC8M6102M5RDYMt49k+Csz 1fG7VuWi7fIJcWj+fJJjhRjcKySkLPROsAv0ZKym4INHlFSFTBQKVr20foH6hXPEl7NO XIWcemgFx6ELD2XLkg+4BuF6bqu/bCrXvgfL/RL7mWDnpQpaPOCE/kI3HeAKltprcZRP PbPgp67faXvSYoMj11nPQL9oLZTfHiiZ1EJcM0ZENBc2609PpC2lrMXMxou3HJmKhkqJ iHCHBWE9zuPQZIZnWoeapmj7PP8bWzREQmZ1qtwpDEApqSw7Cn4Q/dMQVaQK8QNm1TRT sp4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3X13xXM; 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 n7-v6si16298512plp.43.2018.11.11.21.02.55; Sun, 11 Nov 2018 21:03:11 -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=P3X13xXM; 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 S1730729AbeKLOyE (ORCPT + 99 others); Mon, 12 Nov 2018 09:54:04 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:34934 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727297AbeKLOyE (ORCPT ); Mon, 12 Nov 2018 09:54:04 -0500 Received: by mail-it1-f193.google.com with SMTP id v11so11502302itj.0 for ; Sun, 11 Nov 2018 21:02: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=HinaT8KymDNWwd0EK9K+PO9iDLejU4LJurjBuIuseZE=; b=P3X13xXMfE2zkpBpifh56bJXn2mIz7ARItOppRy0m5lH7M+nlca/qmX6UaxvfX/xxV 29pMMy3AK0Ar/xIxWfaUcZoDcCY2hIPdm6oZog/lXSrXCYxsnPoyL8YuherYowYE0PQM reHli8L9EFhJYn4G7w/wRBN7lPBcfYXDebMbU= 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=HinaT8KymDNWwd0EK9K+PO9iDLejU4LJurjBuIuseZE=; b=f0Kbbf3vek8rqtz0ZPxEw73pMjPfcfKtF4U5/ZWtb20/yuvPEkpsxnSS6LOtZlmxeb 2cfUayc4x1zjYOJzo22bb8eRsSgoWx50cQ0Qg/jbkL76YzSJehbIAqypWhcAGMC79tM/ 84RVhHr4gXaxe/9i0PT8Xr+7La6HB6GPDhAVTFaOASpl1ubpCC5BCCsFNs9qj6ulFCGr AIYoTGKwk6aoOXgetF4P1d/ng/Dl2wdheYwqsO/ToOkgUoNlZaj/zFCJZbwQ9ZvFbSYp F2P1dXzSkuzVxoanjabROO2ew6ad9T8H0GbYZ1vEmMBhnfyLU9V11hV8marI6iItY3Gm LGoA== X-Gm-Message-State: AGRZ1gLiTP9nP2I1/fAv0D2FsJGuIyocpRabVg3xZ/x9Qnzn6SxhoO0x CA2BdvrjlpLrpCUs7kBiM56xn1NWONhWyJxg800aPw== X-Received: by 2002:a24:2190:: with SMTP id e138-v6mr10915336ita.71.1541998953821; Sun, 11 Nov 2018 21:02:33 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a6b:4f16:0:0:0:0:0 with HTTP; Sun, 11 Nov 2018 21:02:33 -0800 (PST) In-Reply-To: <20181112045629.3gwex4ekeglfas64@treble> References: <3cf04e113d71c9f8e4be95fb84a510f085aa4afa.1541711457.git.jpoimboe@redhat.com> <20181109133337.63487e3a@gandalf.local.home> <20181109193505.5p5iddrtgpk2cpb4@treble> <20181109145746.0037da3f@gandalf.local.home> <20181109203459.wbftlkxcvfnwo2bm@treble> <20181110001023.57f27312@vmware.local.home> <20181110080917.29af5d66@vmware.local.home> <20181112030722.da5cxslvlmdgttsw@treble> <20181112045629.3gwex4ekeglfas64@treble> From: Ard Biesheuvel Date: Mon, 12 Nov 2018 06:02: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 12 November 2018 at 05:56, Josh Poimboeuf wrote: > On Mon, Nov 12, 2018 at 05:39:38AM +0100, Ard Biesheuvel wrote: >> On 12 November 2018 at 04:07, Josh Poimboeuf wrote: >> > On Sat, Nov 10, 2018 at 08:09:17AM -0500, Steven Rostedt wrote: >> >> On Sat, 10 Nov 2018 12:58:08 +0100 >> >> Ard Biesheuvel wrote: >> >> >> >> >> >> > > The complaint is on: >> >> > > >> >> > > DEFINE_STATIC_CALL(__tp_func_##name, __tracepoint_iter_##name); >> >> > > >> >> > > And the previous definition is on: >> >> > > >> >> > > DECLARE_STATIC_CALL(__tp_func_##name, __tracepoint_iter_##name); \ >> >> > > >> >> > >> >> > Does the DECLARE really need the __ADDRESSABLE? Its purpose is to >> >> > ensure that symbols with static linkage are not optimized away, but >> >> > since the reference is from a header file, the symbol should have >> >> > external linkage anyway. >> > >> > Yes, DECLARE needs the __ADDRESSABLE. In the case where DECLARE >> > is used, but DEFINE is not, GCC strips the symbol. >> > >> >> I assume DECLARE() is intended for use in header files, and DEFINE() >> for source files, no? > > Right. > >> Doesn't that mean that whatever symbol __ADDRESSABLE() refers to >> should have external linkage, in which case it it addressable anyway? >> Or are we talking about some LTO / --gc-sections use case here? > > If the key is declared, but not used, GCC doesn't put the key's ELF > symbol in the binary's symbol table. That makes objtool's life harder, > because if the file has a call site, then objtool has to add the key > symbol to the symbol table, so that it can create a relocation (in the > call site table) which references the symbol. > Ah, right. So this is specific to objtool rather than a generic issue. Should we perhaps wrap __ADDRESSABLE() into something else that resolves to a NOP unless on X86, and give it a clear name?