Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2853000imu; Thu, 29 Nov 2018 11:14:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/VjPGSD2YZ4OCqitvf7IcDGIpQ4zEHC7w1ufvDJ4eMxCda19IZoPuj/IBfEBo8a4IhjAyO2 X-Received: by 2002:a62:670f:: with SMTP id b15mr2593475pfc.212.1543518893302; Thu, 29 Nov 2018 11:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543518893; cv=none; d=google.com; s=arc-20160816; b=QJbbYm2wRT3CtkV/rsYo4VVFWNuqvnQ6DK5vsf67Q4TYgjL2QTSZ6KFGuVIF+z9VYN pVSECMFMyt55Pdl82894c40yKRzkaMf6Kt4yuPAutB9DlpZooYcBLUymkwYJxR8V4xJl JB6CQW2PEoahJHBWdgtLPozkorkf/jEeZAyhlUkzwegRPUNo6rqfF0MEjuggXJDLKbOz 2kokyxhEvCxY9KFfFKJ60tq+WxqRodKLX49rCf7JfrKjxeOrBhjm9e/wOlCiRYacvFK3 5cU2tFLUNLsQ8Co2Idx1117lfKiSzGL4/fc0xviGDm7+whJZKzK/9xoo/2hO+2h9fEEu 6kTA== 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=NBWFkIxDsPq1qtxRxbLfMV5v1xYHC7X+aspjSMdvUZA=; b=J/JDCnaQ74370W7PgxxQAJUeq8q7OZ3IYeuFV0NVDMH3IxkPQzt9hNt94kV3x2oKN0 Z+Gf67Wgp4lWX8OUjG2iqSwCOsBnY43zXRCqDQF0/rDXLbUDd+obiBlmsT1FGApTM7PD 5+ovf2Qxvrj+/+HoYmVcmL2yzlUDk0pSyFnGVK1ocZ1Gj8/4s3cKa4IMhXpOw4OpEjI0 He9P3vfmuUsn9xgcvv/IEgnKkog3eQHofaOPPi28XLGta5IQeaAIgqDobRaQ0F5Mr6js 5SJ4jLcJ732ZBcd+HXQFw5ChyCOwo/qcFiFQPqqw1tTPU5tyf9mypFVpUVoAPU+WkEzx drqw== 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 35si2756507pgn.278.2018.11.29.11.14.38; Thu, 29 Nov 2018 11:14:53 -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 S1726554AbeK3GSm (ORCPT + 99 others); Fri, 30 Nov 2018 01:18:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:56940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbeK3GSj (ORCPT ); Fri, 30 Nov 2018 01:18:39 -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 5415521104; Thu, 29 Nov 2018 19:12:11 +0000 (UTC) Date: Thu, 29 Nov 2018 14:12:09 -0500 From: Steven Rostedt To: Linus Torvalds Cc: Andy Lutomirski , 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: <20181129141209.41c49869@gandalf.local.home> In-Reply-To: References: <20181126160217.GR2113@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> <20181129125857.75c55b96@gandalf.local.home> <20181129134725.6d86ade6@gandalf.local.home> 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=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 Thu, 29 Nov 2018 11:08:26 -0800 Linus Torvalds wrote: > On Thu, Nov 29, 2018 at 10:58 AM Linus Torvalds > wrote: > > > > In contrast, if the call was wrapped in an inline asm, we'd *know* the > > compiler couldn't turn a "call wrapper(%rip)" into anything else. > > Actually, I think I have a better model - if the caller is done with inline asm. > > What you can do then is basically add a single-byte prefix to the > "call" instruction that does nothing (say, cs override), and then > replace *that* with a 'int3' instruction. > > Boom. Done. > > Now, the "int3" handler can just update the instruction in-place, but > leave the "int3" in place, and then return to the next instruction > byte (which is just the normal branch instruction without the prefix > byte). > > The cross-CPU case continues to work, because the 'int3' remains in > place until after the IPI. > > But that would require that we'd mark those call instruction with > In my original proof of concept, I tried to to implement the callers with asm, but then the way to handle parameters became a nightmare. The goal of this (for me) was to replace the tracepoint indirect calls with static calls, and tracepoints can have any number of parameters to pass. I ended up needing the compiler to help me with the passing of parameters. -- Steve