Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1120056imu; Fri, 9 Nov 2018 11:14:54 -0800 (PST) X-Google-Smtp-Source: AJdET5fF6rzmOIuzcTA0v5xSJsZEnjFvt/BPAcJrHtabu7owT1k3zUrLQw0GGTpBOZlZMZhRg+i0 X-Received: by 2002:a63:5f41:: with SMTP id t62mr8589501pgb.76.1541790894570; Fri, 09 Nov 2018 11:14:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541790894; cv=none; d=google.com; s=arc-20160816; b=DZhIjTVL+ApaH+X+NJxLi06cvyUQYAGYKkRrdQmlJN9nQRZBl/5tMTBXJUvmgHCGbZ 7dLzs/3RZbeMn654JJOBcHTdYj4Gz7b8xZVGOiJhd+gak8cg//S741nwkdnKk7XNubTR bruCn2TCV5ea/x7+HaxYEEXz7DX/xoyebuD/hjdw2ZxYkaftfELtitrxhhw7qA1syB7K uC8QqOrNh0izR6yFalH6ufv2FlxtQ9Zn8/TnwpqlLd+Id/aOKsUPMZLRCfsJ6jQFkMrX tIfv5/ZYzZ2YGFoPaXuo8akuN94hgC1NtaT9e1xH9aoDsgnRixbmfWqBverdkm9jNVmV Wgow== 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=/RtZ3MIx7jsJHd6nyiuy5o2cZGKQ6Xp7R/TlgscXQZI=; b=nIINF9MccvfMHspJZy+vbIBnU1m6NiZFVqQAwXZP9baRLxBrNoJPfoQbQWDNVFs98w a5gVlpfE1hl1Nn8tqUXj10KF4FuJ/5wgvXplU6ycAwcAdTDkq5vqRo4HbmhKrU2CRyS4 Rib5NJvNSo8I1kvrY6W+YAobZ8rQf6y+unu6MvxvzYVWnfKdv39nt3Z01tdshoL9Y6Sz wVQkYGE8FWTqElXWKX3h5y/7WY/a8zn8ZuXAnNKLXORkO3NzieiUzhVoV3sBEgzo9Wwr e0G27HLLPmuRt3WYXbqtRmIYNnExlxUEa9NQ1aAWjz1BYJyFnuLveMs0m3wwzlgraTtj 61Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="c17H/Qa8"; 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 f62-v6si8746814plf.288.2018.11.09.11.14.35; Fri, 09 Nov 2018 11:14:54 -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="c17H/Qa8"; 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 S1728621AbeKJEyX (ORCPT + 99 others); Fri, 9 Nov 2018 23:54:23 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:50790 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbeKJEyX (ORCPT ); Fri, 9 Nov 2018 23:54:23 -0500 Received: by mail-it1-f193.google.com with SMTP id k206-v6so4546089ite.0 for ; Fri, 09 Nov 2018 11:12:27 -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=/RtZ3MIx7jsJHd6nyiuy5o2cZGKQ6Xp7R/TlgscXQZI=; b=c17H/Qa8xStIYpAdDTEbEXdpp3YxPj5e6IxZXeLNB2WRIIrqha18u5Fw9zgsWP+8ON wqfefFPnznPEyK6PwS+jQStOMduS17AHHWk9JpMP+/ZgrpCu3LtrUvyc6y6Tx/0hTD+L m6SOLlAwdRHwC26JZgrGsOLBBkDtWAPrWVEQQ= 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=/RtZ3MIx7jsJHd6nyiuy5o2cZGKQ6Xp7R/TlgscXQZI=; b=sjHpHhmJDvNPSoIQiNZx1n/f72Ta3f6yp1bwYAQ+3U41x4D8DK3FEfZmjacWt81w1S 3ZGQouceOlM7n8qpS6XBB1ZnAJKUx8hYtB9Ru3rdOrcMqX8okDoZGWAi1tuf8skavqqe bCdZE9cbJNWLAUaNfAKOSp5iueemjcL9MPeQHWsQwbj0J4vpm2kVaDazCQ9Ya5iOv5cS QpnJHHLG/xUP6u38RH/sffDYhMRgWBzI+A2nzeIgalPVtt1+drwEBUTLX9hGdZOdeMl2 DgHaB+Vh5jCYmkg1YAFZdmb76TprpRfPwttURjFTzL8YIC20EZRVuvSfIIwRrmBJbhMP XmUg== X-Gm-Message-State: AGRZ1gKfSBnt2AeS0st+LUnOrsJtkGQVD2ptQEyf44bi6oH+RR+iY0t+ Nc6IDGhIH73j+DsvgQPjpP5Cxj+gcJvIrIkYzKiEaw== X-Received: by 2002:a24:2190:: with SMTP id e138-v6mr3386590ita.71.1541790747413; Fri, 09 Nov 2018 11:12:27 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a6b:4f16:0:0:0:0:0 with HTTP; Fri, 9 Nov 2018 11:12:26 -0800 (PST) In-Reply-To: <20181109190320.tn3fpaegg5dkgvdb@treble> References: <3cf04e113d71c9f8e4be95fb84a510f085aa4afa.1541711457.git.jpoimboe@redhat.com> <20181109151028.faifw66enzye32gg@treble> <20181109173106.kbghzsdsu7oachl6@treble> <20181109174608.eahqh4fkyl3k2gvs@treble> <20181109190320.tn3fpaegg5dkgvdb@treble> From: Ard Biesheuvel Date: Fri, 9 Nov 2018 20:12:26 +0100 Message-ID: Subject: Re: [RFC PATCH 1/3] static_call: Add static call infrastructure To: Josh Poimboeuf 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 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 20:03, Josh Poimboeuf wrote: > 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? > Yes. > 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) > Indeed.