Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp826127imu; Fri, 9 Nov 2018 06:46:12 -0800 (PST) X-Google-Smtp-Source: AJdET5eBbcHjKYH7YNklJBz9P+9iGh6RbJGsJgkek7Q6bIQe7V+EcAJ47gXM4HuUmxqvb12xf32T X-Received: by 2002:a63:f047:: with SMTP id s7mr7642035pgj.441.1541774772168; Fri, 09 Nov 2018 06:46:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541774772; cv=none; d=google.com; s=arc-20160816; b=GQLlK+H1HT38m+nPxhUlQV0wtZ7grCpVwMpfbijr9qEbfgrsIf5dvIm4YHLDp6zn4Y e7N7kQHR9teclCbWS4Ea0KOXWSNQz8ACUEBUzsAWAwmVTdNsC+tr/YOBflWftiPBE0KI h24ACo3Lid9cbZFHyhNKa4RK9HApsSgof4bEBCBHWJoc3oqyo4ozaPzi6CuyL9d9O3DT dm2BuS0dk9UB6S/f6C5cRgLeyiIIO3Dwb8xV6CKbe9mA2JB7191f7Z1ndPDy2coZm1Fi yBokTwzd/SuVBIT964rR6F5U/EE/ITYW5VoBO4l9vU117u9AHFDGVGH7syIFy21VFBmb xPLg== 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=cpfVUIqvKManlkVzFdNv66ceFnm4Ox/BpA9DLlwG3J8=; b=A0p8Lcb1qoLCb5JPPfYe/smdocrOANvoARqDK6Fa3htQYVDmMpORZpWtGDaldqgoN5 ox3meR/VBXVTUFlMGKiH0m5oHZ0+Dq1qWdq9zCel69e8rzWqJMedWUWZ/puPYvhSrT8a v9gaiVhJ5DTEeOswFKzv2tuR1feiYALHhzGRbiecVGsWX6/jHSUeWcyv8qqOeZzqcYUe 8qRVV77YNuBkWn2EWc8gFOrLBABkQcZVOZbWdrpMEfbduzYhnCGEZstnon5rBNQFmGkf MySoee3X7sQRhGwnh5f5yr4Z8PIrVHH2Wr4zd9Zrpeo6rL+cNnQ70+qB0DUJ/xzrwIn4 /CLw== 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 o12-v6si8518455pfh.9.2018.11.09.06.45.40; Fri, 09 Nov 2018 06:46: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 S1727998AbeKJAZ7 (ORCPT + 99 others); Fri, 9 Nov 2018 19:25:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38165 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbeKJAZ7 (ORCPT ); Fri, 9 Nov 2018 19:25:59 -0500 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 82100308FB90; Fri, 9 Nov 2018 14:45:05 +0000 (UTC) Received: from treble (ovpn-124-61.rdu2.redhat.com [10.10.124.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3591608C2; Fri, 9 Nov 2018 14:45:03 +0000 (UTC) Date: Fri, 9 Nov 2018 08:45:01 -0600 From: Josh Poimboeuf To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Ard Biesheuvel , 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: <20181109144501.aqhcv3vdjuqlp7pz@treble> References: <20181109072811.GB86700@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181109072811.GB86700@gmail.com> 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.43]); Fri, 09 Nov 2018 14:45:05 +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 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. 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). > > - Does this feature have much value without retpolines? If not, should > > we make it depend on retpolines somehow? > > Paravirt patching, as you mention in your later reply? > > > - Find some actual users of the interfaces (tracepoints? crypto?) > > I'd be very happy with a demonstrated paravirt optimization already - > i.e. seeing the before/after effect on the vmlinux with an x86 distro > config. > > All major Linux distributions enable CONFIG_PARAVIRT=y and > CONFIG_PARAVIRT_XXL=y on x86 at the moment, so optimizing it away as much > as possible in the 99.999% cases where it's not used is a primary > concern. For paravirt, I was thinking of it as more of a cleanup than an optimization. The paravirt patching code already replaces indirect branches with direct ones -- see paravirt_patch_default(). Though it *would* reduce the instruction footprint a bit, as the 7-byte indirect calls (later patched to 5-byte direct + 2-byte nop) would instead be 5-byte direct calls to begin with. > All other usecases are bonus, but it would certainly be interesting to > investigate the impact of using these APIs for tracing: that too is a > feature enabled everywhere but utilized only by a small fraction of Linux > users - so literally every single cycle or instruction saved or hot-path > shortened is a major win. With retpolines, and with tracepoints enabled, it's definitely a major win. Steve measured an 8.9% general slowdown on hackbench caused by retpolines. But with tracepoints disabled, I believe static jumps are used, which already minimizes the impact on hot paths. -- Josh