Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4656037imu; Mon, 12 Nov 2018 14:54:44 -0800 (PST) X-Google-Smtp-Source: AJdET5cZsvyH/N177g9KojG4Egxo7IXCm6uFAV/IkRp017/qCSslVhOW7w6rBn0ZgCON8V3x/bxV X-Received: by 2002:a63:c503:: with SMTP id f3mr2416496pgd.431.1542063284698; Mon, 12 Nov 2018 14:54:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542063284; cv=none; d=google.com; s=arc-20160816; b=lUt4Iz4dfNj4Mcfgy589NwMAJppqce69PPVuluuRYu/D4ddKg81nWQAiiknCEko0Rn Zz90z1i99N7fD6V4G6HowzS36oLoxjnFOBsIblmihqPThEEyACTvz5XNkaeAc9m61Z0v +487Pp2oRF9jEcYn0SX6fXjs7xz4csSG9r+V6QFa4Ax4WW37zjxfxHGUWgRDcqtXj8gN ZpSeMkFHnX+dUge0nxyLZlvTvXKtpSrhUmoqBL5BCPcB1YslqQ3tzN7rVAvGwo0ZhJwI v3QRc1e4IxMvJsawJjKOwg0z4j8CsfPtSRCa7K/dAhTvPoicu3lbRtH3MV+U41EJdkNv WL8g== 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=kSp4Qe/TRDBSS6yVfVXzEAan1pCs52hmHe5NpCkrfLo=; b=Kh++1AJCjGmSFKVEaT7d5bt5EpbRsVVjXLdIBlegiwyls+VQGa2T2eKGyWaarxyjbG dv0JwE2j1dXkSJmJF3pDsea26w0jhWg54wCUy15uvGvKZUmeqQUDuowVfy7OOVZhBtUk pcyJJBkYYcwnVAZhVIiu2wtAeS3+2oWOVwlOqISmpx7PNcSti06UT2cxrm3yTNWyRm1A /mX9qEkFIANFXK3k/I+sfQvE48zc7Sv56HYWcjo5VhbgdC2wYPanMUJkm/ES/5s15167 MkH1GWKPIIgeinuJ1PiCx4PAIthaGyTwRM3JdChtP/Yuf3UjwY97moTBLmEvMrkLEJsJ zfiQ== 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 z2si18079676pgs.267.2018.11.12.14.54.28; Mon, 12 Nov 2018 14:54:44 -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 S1730182AbeKMIrZ (ORCPT + 99 others); Tue, 13 Nov 2018 03:47:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49716 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbeKMIrY (ORCPT ); Tue, 13 Nov 2018 03:47:24 -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 8D3EF4E90D; Mon, 12 Nov 2018 22:52:09 +0000 (UTC) Received: from treble (ovpn-121-1.rdu2.redhat.com [10.10.121.1]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F258119743; Mon, 12 Nov 2018 22:52:06 +0000 (UTC) Date: Mon, 12 Nov 2018 16:52:04 -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 , Juergen Gross Subject: Re: [PATCH RFC 0/3] Static calls Message-ID: <20181112225204.45q6qw3ezcb3s3r5@treble> References: <20181109072811.GB86700@gmail.com> <20181109144501.aqhcv3vdjuqlp7pz@treble> <20181112050241.GB28219@gmail.com> <20181112053055.hdcv5x7md47ehunv@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.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.38]); Mon, 12 Nov 2018 22:52:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 10:39:52AM +0100, Ard Biesheuvel wrote: > On Mon, 12 Nov 2018 at 06:31, Josh Poimboeuf wrote: > > > > On Mon, Nov 12, 2018 at 06:02:41AM +0100, Ingo Molnar wrote: > > > > > > * Josh Poimboeuf wrote: > > > > > > > On Fri, Nov 09, 2018 at 08:28:11AM +0100, Ingo Molnar wrote: > > > > > > - 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. > > > > > > > > The benefit of a plugin is that we'd only need two of them: GCC and > > > > Clang. And presumably, they'd share a lot of code. > > > > > > Having looked into this, I don't think they will share any code at > all, to be honest. Perhaps some macros and string templates, that's > all. Oh well. That should still be easier to maintain than objtool across all arches at this point. > > > > The prospect of porting objtool to all architectures is going to be much > > > > more of a daunting task (though we are at least already considering it > > > > for some arches). > > > > > > Which architectures would benefit from ORC support the most? > > > > According to my (limited and potentially flawed) knowledge, I think > > arm64 would benefit the most performance-wise, whereas powerpc and s390 > > gains would be quite a bit less. > > > > What would arm64 gain from ORC and/or objtool? Other than live patching, the biggest benefit would be an across-the-board performance improvement from disabling frame pointers. It would be interesting to see some arm64 performance numbers there, for a kernel compiled with -fomit-frame-pointer. For more details (and benefits of) ORC see Documentation/x86/orc-unwinder.txt. Objtool has also come in handy for other cases, like ensuring retpolines are used everywhere. Over time, I would like to move some objtool functionality to compiler plugins, such that it would be easier to port it to other arches. > > We may have to port objtool to arm64 anyway, for live patching. > > Is this about the reliable stack traces, i.e., the ability to detect > non-leaf functions that don't create stack frames? I think we should > be able to manage this without objtool on arm64 tbh. Hm? How else would you ensure all functions honor CONFIG_FRAME_POINTER, and continue to do so indefinitely? > > But > > that will be a lot more work than it took for Ard to write a GCC plugin. > > > > > I really think that hard reliance on GCC plugins is foolish > > > > Funny, I feel the same way about hard reliance on objtool :-) > > > > I tend to agree here. I think objtool is a necessary evil (as are > compiler plugins, for that matter) which I hope does not spread to > other architectures. I agree that it's a necessary evil, but it may be necessary on arm64 for live patching. > But the main difference is that the GCC plugin is only ~50 lines (for > this particular use case, and minus another 50 lines of boilerplate), > whereas objtool (AIUI) duplicates lots and lots of functionality of > the compiler, assembler and/or linker, to mangle relocations, create > new sections etc etc. Porting this to other architectures is going to > be a major maintenance effort, especially when I think of, e.g., > 32-bit ARM with its Thumb2 quirks and other idiosyncrasies that are > currently hidden in the toolchain. Other architectures should be first > class citizens if objtool gains support for them, which means that the > x86 people that own it currently are on the hook for testing their > changes against architectures they are not familiar with. Sounds like we could use you as a co-maintainer then :-) BTW, AFAIK, there are no plans to support live patching for 32-bit ARM. -- Josh