From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4E64C43441 for ; Wed, 10 Oct 2018 18:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 872972087A for ; Wed, 10 Oct 2018 18:17:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 872972087A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbeJKBlI (ORCPT ); Wed, 10 Oct 2018 21:41:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53276 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbeJKBlI (ORCPT ); Wed, 10 Oct 2018 21:41:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3774F88E50; Wed, 10 Oct 2018 18:17:50 +0000 (UTC) Received: from treble (ovpn-124-83.rdu2.redhat.com [10.10.124.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A992488880; Wed, 10 Oct 2018 18:17:43 +0000 (UTC) Date: Wed, 10 Oct 2018 13:17:41 -0500 From: Josh Poimboeuf To: Andy Lutomirski Cc: Steven Rostedt , Peter Zijlstra , LKML , Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Masami Hiramatsu , Mathieu Desnoyers , Matthew Helsley , "Rafael J. Wysocki" , David Woodhouse , Paolo Bonzini , Jason Baron , Jiri Kosina , Ard Biesheuvel , Andrew Lutomirski Subject: Re: [POC][RFC][PATCH 1/2] jump_function: Addition of new feature "jump_function" Message-ID: <20181010181741.lc4l7kjvcmoxrw5b@treble> References: <20181006093905.46276505@vmware.local.home> <20181008072134.GB5663@hirez.programming.kicks-ass.net> <20181008155757.GC5663@hirez.programming.kicks-ass.net> <20181009021710.qwt5hpntyeps44h3@treble> <20181008235750.59da83ae@gandalf.local.home> <20181010175237.e7m3sldcu2maoqcq@treble> <20181010181605.arsyjxwdztztrjih@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181010181605.arsyjxwdztztrjih@treble> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 10 Oct 2018 18:17:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 10, 2018 at 01:16:05PM -0500, Josh Poimboeuf wrote: > On Wed, Oct 10, 2018 at 11:03:43AM -0700, Andy Lutomirski wrote: > > > +#define DECLARE_STATIC_CALL(tramp, func) \ > > > + extern typeof(func) tramp; \ > > > + static void __used __section(.discard.static_call_tramps) \ > > > + *__static_call_tramp_##tramp = tramp > > > + > > > > Confused. What's the __static_call_tramp_##tramp variable for? And > > why is a DECLARE_ macro defining a variable? > > This is the magic needed for objtool to find all the call sites. > > The variable itself isn't needed, but the .discard.static_call_tramps > entry is. Objtool reads that section to find out which function call > sites are targeted to a static call trampoline. To clarify: objtool reads that section to find out which functions are really static call trampolines. Then it annotates all the instructions which call/jmp to those trampolines. Those annotations are then read by the kernel. -- Josh