Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2832441imu; Thu, 29 Nov 2018 10:56:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/VSa5+OkVNdy2nGGBEDEuobfsZwniOPdrVxZL+sclu0Ws94PrctyRWFmpo/wDozmk3Hw3WG X-Received: by 2002:a63:8742:: with SMTP id i63mr2193290pge.298.1543517810678; Thu, 29 Nov 2018 10:56:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543517810; cv=none; d=google.com; s=arc-20160816; b=TNnvMXUsdHpDgsBwAa3vpWHtpth0nX9QIXIffwBf02/6vAiMzhwFmyaoDR9wfpTXYO Oe0aV+0ahzrbMBdT5LooAJXAV7BOG7vxCkC2GvIzJ1y6MObTRX2cfUYVAI0VXCyIqFdR Ew+ybcONUQoBXD4Pi2a505hnCH0oGmtVNnf7qY5wjbsFT8kEBfapW/AiN1YndyC3+fR5 4QeKMeloYWP2djozcSpx+PR+YkmMLxQAZEYwucWJqvyxEQHwnpbk8DMDP8U0Lbz5vDXf cCKZo9dZBsCR1+y3gq62UY26PCS8xACv66N6hCphdMcei636f4vj8e2GkdWKRicoNIzq Ofng== 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=2zSBCMZ31D0q6m7BAnFvq5MH38pcP4DzuM5L3GPd0z0=; b=U3zxJA0qfrpiOiMnqwubpi3TXeKIM9SZEy4zechmG+Ygu3HpN/ufg0a0iBIDFb8an3 YvbMmpB4ZbErwatoWpCwxEEpg+u+qV2O6trhL5JOxVCfIUfQStc8a12l9h0wpZYVgzrj LAoWW6ftj6n7Y9KgwzSI6NXKyHBdny3SDoZisueqNCNmC1kjFwW9F1p3LW/lMoED5wvT E9MPootdpTLUN1Caf8MxzGyz543x9muhmXOndrZnxOCkYuyMePWVTOtMJ9O7SCnbi9Ct LKiDJByB0xuuhepwHD4hYv6MMHiqsnpm7/cVKjFPSHdX33fyS+6qqg/AZiXIMugOzdzM trNA== 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 w9si2615132pgg.72.2018.11.29.10.56.35; Thu, 29 Nov 2018 10:56:50 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726648AbeK3GCD convert rfc822-to-8bit (ORCPT + 99 others); Fri, 30 Nov 2018 01:02:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:53712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbeK3GCD (ORCPT ); Fri, 30 Nov 2018 01:02:03 -0500 Received: from gandalf.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 4AE362082F; Thu, 29 Nov 2018 18:55:38 +0000 (UTC) Date: Thu, 29 Nov 2018 13:55:36 -0500 From: Steven Rostedt To: Andy Lutomirski Cc: Linus Torvalds , Josh Poimboeuf , Peter Zijlstra , Andrew Lutomirski , the arch/x86 maintainers , Linux List Kernel Mailing , Ard Biesheuvel , Ingo Molnar , Thomas Gleixner , mhiramat@kernel.org, jbaron@akamai.com, Jiri Kosina , David.Laight@aculab.com, bp@alien8.de, julia@ni.com, jeyu@kernel.org, Peter Anvin Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 Message-ID: <20181129135536.7d8abe61@gandalf.local.home> In-Reply-To: <60A06EF9-C301-4705-A32C-5E77E2D9DA9C@amacapital.net> References: <20181126160217.GR2113@hirez.programming.kicks-ass.net> <20181126175624.bruqfbkngbucpvxr@treble> <20181126200801.GW2113@hirez.programming.kicks-ass.net> <20181126212628.4apztfazichxnt7r@treble> <20181127084330.GX2113@hirez.programming.kicks-ass.net> <20181129094210.GC2131@hirez.programming.kicks-ass.net> <20181129143853.GO2131@hirez.programming.kicks-ass.net> <20181129163342.tp5wlfcyiazwwyoh@treble> <0A629D30-ADCF-4159-9443-E5727146F65F@amacapital.net> <20181129121307.12393c57@gandalf.local.home> <20181129124404.2fe55dd0@gandalf.local.home> <60A06EF9-C301-4705-A32C-5E77E2D9DA9C@amacapital.net> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Nov 2018 10:00:48 -0800 Andy Lutomirski wrote: > > > > Of course, another option is to just say "we don't do the inline case, > > then", and only ever do a call to a stub that does a "jmp" > > instruction. > > That’s not a terrible idea. It was the implementation of my first proof of concept that kicked off this entire idea, where others (Peter and Josh) thought it was better to modify the calls themselves. It does improve things. Just a reminder of the benchmarks of enabling all tracepoints (which use indirect jumps) and running hackbench: No RETPOLINES: 1.4503 +- 0.0148 seconds time elapsed ( +- 1.02% ) baseline RETPOLINES: 1.5120 +- 0.0133 seconds time elapsed ( +- 0.88% ) Added direct calls for trace_events: 1.5239 +- 0.0139 seconds time elapsed ( +- 0.91% ) With static calls: 1.5282 +- 0.0135 seconds time elapsed ( +- 0.88% ) With static call trampolines: 1.48328 +- 0.00515 seconds time elapsed ( +- 0.35% ) Full static calls: 1.47364 +- 0.00706 seconds time elapsed ( +- 0.48% ) Adding Retpolines caused a 1.5120 / 1.4503 = 1.0425 ( 4.25% ) slowdown Trampolines made it into 1.48328 / 1.4503 = 1.0227 ( 2.27% ) slowdown The above is the stub with the jmp case. With full static calls 1.47364 / 1.4503 = 1.0160 ( 1.6% ) slowdown Modifying the calls themselves does have an improvement (and this is much greater of an improvement when I had debugging enabled). Perhaps it's not worth the effort, but again, we do have control of what uses this. It's not a total free-for-all. Full results here: http://lkml.kernel.org/r/20181126155405.72b4f718@gandalf.local.home Although since lore.kernel.org seems to be having issues: https://marc.info/?l=linux-kernel&m=154326714710686 -- Steve