Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1108942imu; Fri, 9 Nov 2018 11:04:13 -0800 (PST) X-Google-Smtp-Source: AJdET5caSjJfsGpKC/VInMBkJGHwLolKDh261nk20qtf/MeAoR+CA4imlXnHvyZfI0jZqzNCtITV X-Received: by 2002:a62:1745:: with SMTP id 66-v6mr10100851pfx.236.1541790252949; Fri, 09 Nov 2018 11:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541790252; cv=none; d=google.com; s=arc-20160816; b=f5K7ZnO5pcZaPkK8beHfrIytG+l8zLXpqM2FR/EFqxqtnPAjWCDXo35iNn6EYARSV3 XfxUX3IugaFtg58Y6j81YphJdIFc9rSLa2bxP81OBSdqKCU2OfJUKCRmI6eJrYPtezg7 6lN5jJtiZEfJ3qgnjdv5I/Swb/4xJxoWvl7NQMZCxc1Tdu78sk3QPmH0G0J92pBhv/2a /yB+oCnfThD5N/aNAjlROMGv/yaNCu/ISi5NxAMQnegcm/fS00eqgLVaHEnhqnplYu+H lJWxjjogJGX9pRVbI0bR+qoSqgk3RYA3NTID63+c5Xjb/xlLVVJD3YJGFtF+yc5Buv3P tVDw== 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=jMOz3cNTBU/M1GDoiLUpNvLp+zQmskUTz59T9oIJj1k=; b=gOGrpt9WztIfYQqC7E87QEMIYrPd7r7XAfIPeqeFm4vBPRRlGqEDTTYIQ/Itwh+HdU oYQTGB+T4uUC48Yyw0Fjf6Wtzu6kfocL/99VsGbWJyYWJJ6+tosvHE3IylWo63P5vZWP WpfeKnn8PjKUAWgB0TcaFnyZTt1wNsXek8MWMRl1bYtpG8mHEzvBNE9ex/hRIQm4Guws ZfkQ8Qhnp+421dzWPVePc/ghztYAT5bz9JPF+s0jyd2Ku1uRqMQWSj0Fy5XaBEGaOEx/ fPc9xEFCMLVt7g6EuW0b4sq9iWdqMtsg8jUMZc/xDhBPGXebKbS5Y5vMJe0FASu9V4H/ UypQ== 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 h6-v6si9538426plk.373.2018.11.09.11.03.53; Fri, 09 Nov 2018 11:04:12 -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 S1728754AbeKJEpR (ORCPT + 99 others); Fri, 9 Nov 2018 23:45:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34538 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728682AbeKJEpQ (ORCPT ); Fri, 9 Nov 2018 23:45:16 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A3C958E31; Fri, 9 Nov 2018 19:03:23 +0000 (UTC) Received: from treble (ovpn-124-61.rdu2.redhat.com [10.10.124.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CBE9600CD; Fri, 9 Nov 2018 19:03:22 +0000 (UTC) Date: Fri, 9 Nov 2018 13:03:20 -0600 From: Josh Poimboeuf To: Ard Biesheuvel Cc: Linux Kernel Mailing List , the arch/x86 maintainers , Andy Lutomirski , Steven Rostedt , 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: <20181109190320.tn3fpaegg5dkgvdb@treble> References: <3cf04e113d71c9f8e4be95fb84a510f085aa4afa.1541711457.git.jpoimboe@redhat.com> <20181109151028.faifw66enzye32gg@treble> <20181109173106.kbghzsdsu7oachl6@treble> <20181109174608.eahqh4fkyl3k2gvs@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 09 Nov 2018 19:03:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 09, 2018 at 06:53:21PM +0100, Ard Biesheuvel wrote: > > It's a bit fiddly since inline and out-of-line both use > > arch_static_call_transform(), but what I need to do is basically: > > > > - for out-of-line, the trampoline needs to be patched into a > > movn/movk/movk/br sequence if the target is too far > > - for inline, the trampoline itself needs to be patched from > > adrp/ldr/br (which does a load and a indirect branch) to > > movn/movk/movk/br (which uses immediates), and the call sites need to > > be patched into calls to the veneer if the target is out of range. > > > > So arch_static_call_transform() needs to know where the trampoline is > > for this use case, so could we perhaps add a 'void *orig' in the key > > struct that keeps track of the original value of 'addr' ? > > ... and pass it to arch_static_call_transform Ok. So in both cases, you need both the call site address and the tramp address, right? We could add a 'tramp' pointer to the key struct -- I assume that's what you mean? And also change void arch_static_call_transform(unsigned long insn, void *dest) to void arch_static_call_transform(void *call_site, void *tramp, void *dest) -- Josh