Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2853481imu; Thu, 29 Nov 2018 11:15:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJF0olPXUW3gmU5ttPkTKbaIyzFv32JK9DTpwow/KC6kIvD7dCuRdrod7G7m+6CEbO64MG X-Received: by 2002:a63:b30f:: with SMTP id i15mr2299611pgf.240.1543518924627; Thu, 29 Nov 2018 11:15:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543518924; cv=none; d=google.com; s=arc-20160816; b=viQTdQs+0yOxArvWCZCVB7DSy6VOd4sGZ0aFMdvrb9n+5k0YoL25BBo0pNbtMNWf+5 kIdWWhGnX5vEpwgRZYD/2czTT/7wAMJwbX00+mSaMapL0gMTljy2ArtBj0q/Y/PGzS2O XLXEhqeOLEYEwyMpBiEfQsLlplnq2DbMiK3HrG/+KvdKrh1Ltet/ig81IFsz9cRfu4IU m36cjjhfsk8r9jYNofRR+UHJ9VPyJbAvJklvQYf+TgD0Oe4QxZzVzgxIXemIG4VymeNF sccGcpuAdqT/H9RiSAmAUTHZhAtDPzx/1cc5RzynoOD2cai8aAPsKEUm+Q4h3ePo0y8b NcVg== 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=yOBoqJsbC6rZIGgx43iMudgOimKg4TSC64zHL9m5/w0=; b=ikG4gM7lgW6SYHzu2IH39NeC2vSttt4pSjQtd3xtKDxGrWL3AwEKseWoyZne75qRvd jcfV1YdvxKr8gsg/q5kMhlj20k+OsTQTGk+G8Lkq2rdFSzSHLVPZ0NPSg/prFjQbVc8I OVCHTN4J17YWJPq9ML/q7679oGJSPgQH6KTguz31A0KHVlMzxwoYTMX45XN8oYoKppdv 19ujtN4SscQcpCl14bfbdxBH4h9zWDd+tsHt1JU+vPUlafsd4X5lD8EDidAUnk3501bL x3z57hSXKumtJ8drwb4R8dPAQqrk/YxT/sVDPht/eGx8KSXq7/G1Z0o3CNW9UoeMfcOr 4QTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hkX5PiyI; 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 3si2948792plo.217.2018.11.29.11.15.10; Thu, 29 Nov 2018 11:15:24 -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=@linux-foundation.org header.s=google header.b=hkX5PiyI; 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 S1726369AbeK3GPM (ORCPT + 99 others); Fri, 30 Nov 2018 01:15:12 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36372 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbeK3GPM (ORCPT ); Fri, 30 Nov 2018 01:15:12 -0500 Received: by mail-lf1-f68.google.com with SMTP id a16so2297576lfg.3 for ; Thu, 29 Nov 2018 11:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yOBoqJsbC6rZIGgx43iMudgOimKg4TSC64zHL9m5/w0=; b=hkX5PiyILjnUC9xqynqpfSu2GZszYMXNB/zzKbj/n6SHguhGukB6afj+800wXK0333 hJ3eLRO0ZHNeRUhXOoexShhrFU3H/m5/xm/R7k4UcCr5Xfc919YPLTieSmikzxBQ8L2l vna/jqu1dRoA7lozVYMWzy212HBpU0GYD0sro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yOBoqJsbC6rZIGgx43iMudgOimKg4TSC64zHL9m5/w0=; b=eRQBtSS2/+nbz6aiQRkf5NX1r7EPybncJZAU4Ge/5A8wm9RR7SZzge/LZduFdthAhL qoxDF9GkepsPqp9jj38xdgShJtExpbRiIsSq4GmwjDxj9yFN9xGVqjPxXn51ra2TITcx Bz0ZONESTTqhtsuC3qN3/Me1JHKIEmvcPc8ihgfShX2kYiAdycTp2GGrVPQKjeF0IXyp HDWGCM/PjkaYLJO7ziLRFoC1Aii7efp4SFZiHS42Sly5FzKDxaeA+Fb7DrNhN7Xnj2jk RU1QffHQb1vW6Q6QWN8lqEfmbnGPuudfzX356wi6A9zVQMsFdmPGDNGQB/cIliZ2CX3s JHiA== X-Gm-Message-State: AA+aEWaWiJRNi0H3mLsgHDhxFz1gNo2VC3vrPsqFUK/umQPLIVM05gxe jcT8bBS7KGdX0VuJlsk/FoeSq3XAshc= X-Received: by 2002:a19:980f:: with SMTP id a15mr1945861lfe.103.1543518524711; Thu, 29 Nov 2018 11:08:44 -0800 (PST) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com. [209.85.167.51]) by smtp.gmail.com with ESMTPSA id x204sm438668lfa.5.2018.11.29.11.08.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 11:08:43 -0800 (PST) Received: by mail-lf1-f51.google.com with SMTP id b20so2270613lfa.12 for ; Thu, 29 Nov 2018 11:08:43 -0800 (PST) X-Received: by 2002:a19:c014:: with SMTP id q20mr1724391lff.16.1543518522629; Thu, 29 Nov 2018 11:08:42 -0800 (PST) MIME-Version: 1.0 References: <20181126160217.GR2113@hirez.programming.kicks-ass.net> <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> <20181129125857.75c55b96@gandalf.local.home> <20181129134725.6d86ade6@gandalf.local.home> In-Reply-To: From: Linus Torvalds Date: Thu, 29 Nov 2018 11:08:26 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 To: Steven Rostedt 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 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 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 Linus