Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp868540imu; Fri, 9 Nov 2018 07:23:03 -0800 (PST) X-Google-Smtp-Source: AJdET5dkWnkbddlriS8Xb12yO0+tSbytzgrQ14MbIQgBdTmw3Vwe9+rfN4XpqcXzn5QN24L7gfEV X-Received: by 2002:a63:fe48:: with SMTP id x8mr7957830pgj.261.1541776983401; Fri, 09 Nov 2018 07:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541776983; cv=none; d=google.com; s=arc-20160816; b=pQqonsNLXpa8VvheWWwBO+/0ssqcXMaEfNoZSs5vPqvIMTd+sdtGJGwFW5SLz3Buyl FIBej+UrbkraLMDSfFDYJ0bmzfIBxleHrsJHPXj5rZgscqAr06X/nuo7JgwNXEt+33Rc XOxgfbpQGtxuv1MSB1N7LjsTHHVXQh+mi+NzEkwrz3bfv+7c/rTQej8MqETIEzqKeSx6 O0RWxwYWkGOLhD6kCX4vw5K4898Q5T1Tec7jWUzJkIcN0Lx/d/6msi87l7/ezNeCFE41 PtupQ4kfaWHueRuMVotlTE4wTZOhDqtsEX9WgdqfD9+uAIDYcozumhRuMYL3tFB1YEhM /d7g== 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=1khhuo1HolyUMlOdJ32WKgZIBKRPHXOsffv+iSakoxs=; b=fZqURC4jQduoa0H4dSsQlEh5m/ecuMpjmfxbBtJRJUOi2mHrK9Sh+/BFVP8x+CI7mj 3b7l0SLj4iByHtciP0lCD0uF2/Sip3zDQHtPdk7CuvmeMMw7R+rad0tZfQ4CnJ6QqMuJ hACZ3bnVuYqISiRvWLARP4ZdZknaDGuPsKQvS7qhj9l0EFnJVolCLV4OQUCFiyPzQxCr l4XYJp1waGkOggD4It/8yJ4VlSS3k/P03LDhZtz2ZjXRaP2RHhcCbUKOL06yLIa0pA3N RUqKpvTH6rAA/VPh+RTbzpnvWPE9iirLiq5wexLjlQHB68tAPE4/o3TcoERbg9ffFYSW BPKg== 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 u128-v6si9048500pfc.145.2018.11.09.07.22.11; Fri, 09 Nov 2018 07:23:03 -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 S1728190AbeKJBBT (ORCPT + 99 others); Fri, 9 Nov 2018 20:01:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45226 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727800AbeKJBBS (ORCPT ); Fri, 9 Nov 2018 20:01:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8EC930841DE; Fri, 9 Nov 2018 15:20:17 +0000 (UTC) Received: from treble (ovpn-124-61.rdu2.redhat.com [10.10.124.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B97225D9CA; Fri, 9 Nov 2018 15:20:15 +0000 (UTC) Date: Fri, 9 Nov 2018 09:20:08 -0600 From: Josh Poimboeuf To: Ard Biesheuvel Cc: Ingo Molnar , Linux Kernel Mailing List , the arch/x86 maintainers , Andy Lutomirski , Steven Rostedt , Peter Zijlstra , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov Subject: Re: [PATCH RFC 0/3] Static calls Message-ID: <20181109152008.3z63vouyddtbeocu@treble> References: <20181109072811.GB86700@gmail.com> 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 09 Nov 2018 15:20:18 +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 02:50:27PM +0100, Ard Biesheuvel wrote: > On 9 November 2018 at 08:28, Ingo Molnar wrote: > > > > * Josh Poimboeuf wrote: > > > >> These patches are related to two similar patch sets from Ard and Steve: > >> > >> - https://lkml.kernel.org/r/20181005081333.15018-1-ard.biesheuvel@linaro.org > >> - https://lkml.kernel.org/r/20181006015110.653946300@goodmis.org > >> > >> The code is also heavily inspired by the jump label code, as some of the > >> concepts are very similar. > >> > >> There are three separate implementations, depending on what the arch > >> supports: > >> > >> 1) CONFIG_HAVE_STATIC_CALL_OPTIMIZED: patched call sites - requires > >> objtool and a small amount of arch code > >> > >> 2) CONFIG_HAVE_STATIC_CALL_UNOPTIMIZED: patched trampolines - requires > >> a small amount of arch code > >> > >> 3) If no arch support, fall back to regular function pointers > >> > >> > >> TODO: > >> > >> - I'm not sure about the objtool approach. Objtool is (currently) > >> x86-64 only, which means we have to use the "unoptimized" version > >> everywhere else. I may experiment with a GCC plugin instead. > > > > I'd prefer the objtool approach. It's a pretty reliable first-principles > > approach while GCC plugin would have to be replicated for Clang and any > > other compilers, etc. > > > > I implemented the GCC plugin approach here for arm64 > > https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=static-calls > > That implements both the unoptimized and the optimized versions. Nice! That was fast :-) > I do take your point about GCC and other compilers, but on arm64 we > don't have a lot of choice. > > As far as I can tell, the GCC plugin is generic (i.e., it does not > rely on any ARM specific passes, but obviously, this requires a *lot* > of testing and validation to be taken seriously. Yeah. I haven't had a chance to try your plugin on x86 yet, but in theory it should be arch-independent. -- Josh