Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3690462imu; Sun, 11 Nov 2018 21:35:37 -0800 (PST) X-Google-Smtp-Source: AJdET5egdd9XHpgx9cz8iX6JnRP5qYW31+DcUDIQBBPNfkixubzyYhQQprVTwu1xEOWASWrKI4gx X-Received: by 2002:a63:5224:: with SMTP id g36-v6mr16542657pgb.253.1542000937630; Sun, 11 Nov 2018 21:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542000937; cv=none; d=google.com; s=arc-20160816; b=FINerQzmPwmkRBY9d5053CwDFnhs4M/UTtQnfohngFs3WUOtq/8TFJp9w75HUfDJTQ vhFbBPzeGJQzASgzrXc/xzLmloaI2/8ebl9pCugl+YlDFm0QgZ7jxxFNelUJOnix7X6T 2SPnKiM8ropJz8Rsx3r9NM9cGn8wyrWQ6Nkp+0XWSp/iZGcnGB95PC8e/FszlQBqcsxb EiLD8fpvBW8k4WgNahxQa1629tqHok6rEPxowOBDaLZKBvgBKjJ4Qaqe0fFngXotyT3A NsE1mdERkaDHLsNs+eEyV1/23HNVNgGTpuR85Y38nxBkvy/HoVTAPAZ6QgM0r4a8QoQn gbJw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=Migovenh0yZF6HZ+o6imZkWfqc3clMfyjAzLW4OQZqY=; b=dJVEXM+ds+8mpOHTjfh5/3phZyIUGJRixnv1ShrcQzSUdEYVDoYQaI+MxO5uzcC4DT omrbatC9SPlxZnafqhAQZokJZIwkaSo5qV6kj1hOkGYPEYrSjPXMpMO4wd3+HIsfNsm/ /Na59eoupdPxSagU0KaVTbMJZh2H/KWb4QI90ZLtbyHuSYfz30uRtTT++H12JHpa17B/ KhGPEHz5yWYaNSIwlFCYibkWrU8k3tSj1p80pE2EHKGpMEF/3PNOjl5c75m89BCQvtgj y2STMH3PG0tk0PJ/UAPILTfetGlYu1vk9OfyowoKdZpFLjJQbIWx0conFdk0JiRx56QE bYOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=al0LhlCg; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si1606782pll.428.2018.11.11.21.35.23; Sun, 11 Nov 2018 21:35:37 -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=@kernel.org header.s=default header.b=al0LhlCg; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731178AbeKLP0e (ORCPT + 99 others); Mon, 12 Nov 2018 10:26:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:55454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730979AbeKLP0e (ORCPT ); Mon, 12 Nov 2018 10:26:34 -0500 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0183F223CE for ; Mon, 12 Nov 2018 05:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542000897; bh=edNjwfl6DjLQ/ViI74m6jOCSqKOuP8oJ5IqQwsPa6M0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=al0LhlCgl1kuOpq7IXGQP6hfJWae2IQs/bv8jpeai6s5oZfHghSDcUafkeuX/R55a cQXwkcRizI6+Imu/Hm/kuq2vHxg8vIIkp+j9QPy68OiqpbnjnVJAH17ca+f1noYKHv ubjZuCiKRlDuWQ/qshqz5mR7MlN6WtLRIVKASf2U= Received: by mail-wm1-f48.google.com with SMTP id w7-v6so7146388wmc.1 for ; Sun, 11 Nov 2018 21:34:56 -0800 (PST) X-Gm-Message-State: AGRZ1gJoS/bPlHzO8F5SOn69EqmLPOMuu716XfmFzvDooQFe1aKZ1tJl VmBkqM+lKwjfG8laSLJYjNXzJcT9/RTJQs9lmOX8QA== X-Received: by 2002:a1c:410a:: with SMTP id o10-v6mr6561587wma.19.1542000895301; Sun, 11 Nov 2018 21:34:55 -0800 (PST) MIME-Version: 1.0 References: <20181109072811.GB86700@gmail.com> <20181109144501.aqhcv3vdjuqlp7pz@treble> <20181112050241.GB28219@gmail.com> In-Reply-To: <20181112050241.GB28219@gmail.com> From: Andy Lutomirski Date: Sun, 11 Nov 2018 21:34:42 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/3] Static calls To: Ingo Molnar Cc: Josh Poimboeuf , LKML , X86 ML , Ard Biesheuvel , Andrew Lutomirski , Steven Rostedt , Peter Zijlstra , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Juergen Gross 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 Sun, Nov 11, 2018 at 9:02 PM 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. > > > > 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? > > I really think that hard reliance on GCC plugins is foolish - but maybe > Clang's plugin infrastructure is a guarantee that it remains a sane and > usable interface. > > > > 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. > > Yes. It would be a huge cleanup IMO -- the existing PVOP call stuff is really quite ugly IMO. Also, the existing stuff tries to emulate the semantics of passing parameters of unknown types using asm constraints, and I just don't believe that GCC does what we want it to do. In general, passing the *value* of a pointer to asm doesn't seem to convince gcc that the pointed-to value is used by the asm, and this makes me nervous. See commit 715bd9d12f84d8f5cc8ad21d888f9bc304a8eb0b as an example of this. In a similar vein, the existing PVOP calls have a "memory" clobber, and that's not free.