Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1598296imm; Sat, 6 Oct 2018 06:39:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV62nuZrFPQwerSJ7lybtI4eI+IYNKdyNy1k/M5wtizKnDjnJItXmOmR91lB4VcBK2NFghP0Z X-Received: by 2002:a17:902:2f41:: with SMTP id s59-v6mr15923765plb.240.1538833171747; Sat, 06 Oct 2018 06:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538833171; cv=none; d=google.com; s=arc-20160816; b=LngG7B3Ok5d9g8b6EHATd0WqPGN8Eot4+SISmX5EBiErlXG9M9tprdRfnjy8+prH/9 L2DQr/wtjjk6dwmVdwIrK9J00W07TfkM7hycHKYZpMRbVlumtn29PkJcMO60o0cjkzrA t9tmJ3bk0RA6eMjy/hTR1F2uSjT/od9Z/B3p+1GMwz9xfHVdUFmePuyLMegtBoBii+ZI abp633X7QWP2UhzQMLENrbBGetDSgtmuRCswNaIArl4QPU4XUDBsF5nuLzC5jDJRxVXx 3p3Y0hk8luHHlIi0uJWxcLAIyCuZOuMQXeDwvwnrBJWDPhM4Zb9aEivD3KMjKjsP1kPJ WgWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=+67b10EAX+uTn1dJCtKiiOggivyg2cUAZKVayC8xs/I=; b=wYzZGG5U1LkLw2/2DChdVH5stF+4JCwNzXCQY5eEPM1xGVZ/MTEhL2TkSyhy1Y6ehg mPiWgYLEUpk/1r/QGUEHjeStJqN8sHUMO3ODCgXtV+dHrTZUhDoU04d3Y6rhg7PbgmMZ UIYZJiDIIoXTujiHeTwyeCNWr9MvjgGDJVmgpFlySf/Dxz0DnjjEa3H8yjgGiKaG2SDy 2poQLfwuLP/0KdpW5/cNn48GbOwOlD87rTaJdxrK7Ue+jG4540hXARCgfsxss+XKA9xU VGx0voT8K0emLekgXrBi5dYQerQ/cXeNPKjdF3g11AQYiX3Bz2n8jfn/2zj6LjnDiGDE 9qkw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d24-v6si12610288pgk.315.2018.10.06.06.39.13; Sat, 06 Oct 2018 06:39:31 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727870AbeJFUmb (ORCPT + 99 others); Sat, 6 Oct 2018 16:42:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:32776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbeJFUma (ORCPT ); Sat, 6 Oct 2018 16:42:30 -0400 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75FE821473; Sat, 6 Oct 2018 13:39:07 +0000 (UTC) Date: Sat, 6 Oct 2018 09:39:05 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Masami Hiramatsu , Mathieu Desnoyers , Matthew Helsley , "Rafael J . Wysocki" , David Woodhouse , Paolo Bonzini , Josh Poimboeuf , Jason Baron , Jiri Kosina , ard.biesheuvel@linaro.org, Andy Lutomirski Subject: Re: [POC][RFC][PATCH 1/2] jump_function: Addition of new feature "jump_function" Message-ID: <20181006093905.46276505@vmware.local.home> In-Reply-To: <20181006121211.GA5663@hirez.programming.kicks-ass.net> References: <20181006015110.653946300@goodmis.org> <20181006015720.634688468@goodmis.org> <20181006121211.GA5663@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 6 Oct 2018 14:12:11 +0200 Peter Zijlstra wrote: > On Fri, Oct 05, 2018 at 09:51:11PM -0400, Steven Rostedt wrote: > > +#define arch_dynfunc_trampoline(name, def) \ > > + asm volatile ( \ > > + ".globl dynfunc_" #name "; \n\t" \ > > + "dynfunc_" #name ": \n\t" \ > > + "jmp " #def " \n\t" \ > > + ".balign 8 \n \t" \ > > + : : : "memory" ) > > Bah, what is it with you people and trampolines. Why can't we, just like > jump_label, patch the call directly? > > The whole call+jmp thing is silly, don't do that. It just wrecks I$ and > is slower for no real reason afaict. My first attempt was to do just that. But to add a label at the call site required handling all the parameters too. See my branch: ftrace/jump_function-v1 for how ugly it got (and it didn't work). > > Steve, also see: > > https://lkml.kernel.org/r/20181005081333.15018-1-ard.biesheuvel@linaro.org Interesting. I don't have time to look at it at the moment to see what was done, but will do so in the near future. Remember, this was a proof of concept and even with the trampolines, it showed a great level of improvement. One thought was to do a "recordmcount.c" type of action to find where the calls were and patch them directly at boot up. I tried to keep the API the same where this could actually be done as an improvement later. Perhaps a gcc plugin might work too. I'll have to see what Ard did to handle the function parameters. -- Steve