Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3601518imu; Sun, 11 Nov 2018 19:08:05 -0800 (PST) X-Google-Smtp-Source: AJdET5ckiQzq2ms20JV6+433idscILAohBmBAUng9lJsh9Q/tiRROHWa9ET2/Ia85+Uaxcp9Hnwm X-Received: by 2002:a17:902:144:: with SMTP id 62-v6mr17828860plb.142.1541992085128; Sun, 11 Nov 2018 19:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541992085; cv=none; d=google.com; s=arc-20160816; b=qb9/K7fDsirNLC0uE9DZXpl8Nc29pyPNImmEz4Z8ZdYYsHZEuPNBcEAPv9OZKhsDtA JkwIZSY1QRkKgfpy94X321VAs8k4tzlJJ4oc0b8fikgy9DAtKl0p4jhob0uJL4nYthvR dF6QZBG8JNSayLK6YfCqxxP6Vu2nvyXLjqA9MlL+fuyDwDOGadMyRysS4gFtDkEVn2oq tqzNIh92xV9tnTSLdEdNmUpTGUsyv3shHm7DYLh1bdQtbaKLOdnWVyxrzeCGBBY+uqmU xHsaXVaqnzXJnBG1J68uYZtBa3u60/aGMH8efZKdGGtZFhIaWsxTDT0hoxXr+gOY4RZQ HugQ== 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; bh=tumf6B3KOPpW1jQph3WZAIt4kzXaeWz8/SpDksePWWM=; b=lvexAcDUxt9g9PEi4oXYj4PbJmpIcp4Goggm0AOgTA+nvUfig1CiezQkEy2W/RgdCn mXMLdC341OtIc1Xm4RhUHnSdvrSi8rKrKUtlTTz2VY/IEcictOcLflX3MgWjZuWZNw08 zqpQzhOVR1TjZCH6H7QzqvY75XR14lPMhA4/VEPUVXXK0sOpN/DlxQAnk8BFlxsu11xz jfn3knliHrLNy6dptKsLeYhpoqDR+SKQBRZ8SzKacZcdNIvOftucyvp2+9PPXntLgfYx 7L4eRmJ9ghRzIa+fbOejl3ljX1+lyNdyKK6ZbdXaJBgv/GOMLU6sYq0wKTtwh92T/uNW IeEw== ARC-Authentication-Results: i=1; mx.google.com; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z188-v6si13851123pgb.75.2018.11.11.19.07.49; Sun, 11 Nov 2018 19:08: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; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730262AbeKLM6e (ORCPT + 99 others); Mon, 12 Nov 2018 07:58:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35634 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729882AbeKLM6e (ORCPT ); Mon, 12 Nov 2018 07:58:34 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D7763082E4D; Mon, 12 Nov 2018 03:07:27 +0000 (UTC) Received: from treble (ovpn-121-1.rdu2.redhat.com [10.10.121.1]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7D801974D; Mon, 12 Nov 2018 03:07:24 +0000 (UTC) Date: Sun, 11 Nov 2018 21:07:22 -0600 From: Josh Poimboeuf To: Steven Rostedt Cc: Ard Biesheuvel , 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 Subject: Re: [RFC PATCH 1/3] static_call: Add static call infrastructure Message-ID: <20181112030722.da5cxslvlmdgttsw@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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181110080917.29af5d66@vmware.local.home> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 12 Nov 2018 03:07:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 applied the following change and it compiled fine: > > diff --git a/include/linux/static_call.h b/include/linux/static_call.h > index 90b580b95303..5f8a0f0e77be 100644 > --- a/include/linux/static_call.h > +++ b/include/linux/static_call.h > @@ -108,8 +108,6 @@ extern void arch_static_call_poison_tramp(unsigned long insn); > #define DECLARE_STATIC_CALL(key, func) \ > extern struct static_call_key key; \ > extern typeof(func) STATIC_CALL_TRAMP(key); \ > - /* Preserve the ELF symbol so objtool can access it: */ \ > - __ADDRESSABLE(key) > > #define DEFINE_STATIC_CALL(key, _func) \ > DECLARE_STATIC_CALL(key, _func); \ > @@ -117,7 +115,9 @@ extern void arch_static_call_poison_tramp(unsigned long insn); > .func = _func, \ > .site_mods = LIST_HEAD_INIT(key.site_mods), \ > }; \ > - ARCH_STATIC_CALL_TEMPORARY_TRAMP(key) > + ARCH_STATIC_CALL_TEMPORARY_TRAMP(key); \ > + /* Preserve the ELF symbol so objtool can access it: */ \ > + __ADDRESSABLE(key) > > #define static_call(key, args...) STATIC_CALL_TRAMP(key)(args) Adding __ADDRESSABLE to the DEFINE macro doesn't do any good. By definition, the key is defined in the .o file, so the symbol already exists. The issue you're seeing is really an issue with the __ADDRESSABLE macro not creating unique symbol names. This should fix it: diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 06396c1cf127..4bb73fd918b5 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -282,7 +282,7 @@ unsigned long read_word_at_a_time(const void *addr) */ #define __ADDRESSABLE(sym) \ static void * __section(".discard.addressable") __used \ - __PASTE(__addressable_##sym, __LINE__) = (void *)&sym; + __UNIQUE_ID(__addressable_##sym) = (void *)&sym; /** * offset_to_ptr - convert a relative memory offset to an absolute pointer