Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2750236imu; Thu, 29 Nov 2018 09:37:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/UTsilVA9E7QS/+GjJfLvt9gQpUSz8QMLZtRihf53eApOrJBV70DefnpzFmlBXsieXIvogr X-Received: by 2002:a62:2606:: with SMTP id m6mr2210876pfm.133.1543513031343; Thu, 29 Nov 2018 09:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543513031; cv=none; d=google.com; s=arc-20160816; b=gc1JkeeVdxDLdskG3C+HoAKkbbFXQBY0V5SEayDsijtWbsLLf7TQR7gI50N8ag+cUt ZjnBSVldAZndF+eBa7m6IMahydeaRVdusvvwUjtD/ZGGHqTmGi0LNj2+Jn/Ffyfeqo4k D5cNAFQ4eaxft057rbXNFCpAB6l3qmn4muZ+hU6OXu7u3C8OG+iQIFj3rUmSEAqQwjAO N0AmVajo3NkcUr/z1YRPnYuV0a8+pp+7rdPo5AnJ8HwjTfNJqY5aCQUU+0C10mwXSgIo 3A6dYhCpsmi0YIEAnKVGtuwg51HdY2AgwclpTZnXM9AGt+5BsxBDrM8wDEiENCXMQOLO aNtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=J8yQOQHMXyz3r7W2eapoGqGcd3xONi9q4UZZucXm28w=; b=n3wNoRmMPL7dJ3mbXGyzuXmJJLpVPiE+NuzuLMDmgEUlUjdQsCoNDieVPCjHQQgQUP d2Ca2nxw4x6etu0qQZKy5hwFL84IxxUL1n99dpsayaqC9ekpKC3BsFPbwTyl7k2ibp2q RLDV+tyJrS4yL3sH38gfJS2sWUZEDMKoj/R1tzK0HhlsVHAg/t80jbDeym5DR5qXz9wk 6CdQo0XEgJE6DkI8ZOYX6CcwplacWRyALWh2hSmXr1oE0Xif+uJf938GeC9ZHacll3bO NH67Aq0EZMyTLoEakKIolRcqw+07Z/eqm9qzviDFvtg04AbuKdcF5uUOjoKdBUpufMF9 Jekg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=RKtWMSx4; 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 33si1941081pls.408.2018.11.29.09.36.47; Thu, 29 Nov 2018 09:37:11 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=RKtWMSx4; 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 S1730596AbeK3Elx (ORCPT + 99 others); Thu, 29 Nov 2018 23:41:53 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45930 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730479AbeK3Elx (ORCPT ); Thu, 29 Nov 2018 23:41:53 -0500 Received: by mail-pg1-f193.google.com with SMTP id y4so1220352pgc.12 for ; Thu, 29 Nov 2018 09:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=J8yQOQHMXyz3r7W2eapoGqGcd3xONi9q4UZZucXm28w=; b=RKtWMSx42uyNQ43UFYORQ7GjvTUW+a+W5GUyO2dv/sdE65kYzq4zA5eZ1oKCDCEE5b ZfRgWdVjw1aBHF7jIWoA0QrHk7i2AG6GF8yH8Cbnl6g/a87vpOhcg062wlbXJvtal2iK 8pR4mX1/DVvyfHwzHCuzC0Rq0izeCgi5usUH0+0XY8MNuXFoTtVuddE1QSP1C5QYbiWd 7sLucaKdG9dTSe8EE3PqI+IiGblLMR73LorntsiemMERy78Ph4dNWFKLe+yfH+KFtLC/ vtxAoL7a+DLvfetnV6jnUkw+hqcvyfK7mat58rfdpfBhPnr3hXfBag/PRXlbgGRZpdfD wazQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=J8yQOQHMXyz3r7W2eapoGqGcd3xONi9q4UZZucXm28w=; b=dD6Aa3w3kCL1XoOoWm9i5Bjz/eHRMAurHo7vmQ7AdIot4j7L8VjCsu/YifHuJlGAyT cQgRar/ir2KMvOGhvJZuCA5mhC0h9M2dqNOQ3OLk2CwYrqBA0jtWOH32ydRq74bUSqML ZMFo4MFQiMTjkPcuj8Hl9RQRYTHG1lNonrWq8JVBkTJ+GGxP7oEm6mW6hahOP/gWKyw4 k73FmvuXDfERtwV+xcXok2JIIZGSSK6pmH+EItfFnpTzJeutPZAux/1t0VQBCn+rVawz vhFn/kz7aBawIdaB2UIOLhHEYAOvNAV4AwWFTAx9eCRrHM3ckmbKvbf0rg9VMTilWpAR 2ogQ== X-Gm-Message-State: AA+aEWZe8dM1Vn5YzlGTQYH8V2th0mkXrB8Fse5HqQlOgLNHbvqmt3eG +PC2jmnnAyr7c9wHy1pag0PruQ== X-Received: by 2002:a62:9fd9:: with SMTP id v86mr2236576pfk.191.1543512944380; Thu, 29 Nov 2018 09:35:44 -0800 (PST) Received: from ?IPv6:2600:1010:b054:ff26:3849:a65d:14d0:f668? ([2600:1010:b054:ff26:3849:a65d:14d0:f668]) by smtp.gmail.com with ESMTPSA id v76sm4708855pfj.145.2018.11.29.09.35.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 09:35:43 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 From: Andy Lutomirski X-Mailer: iPhone Mail (16B92) In-Reply-To: Date: Thu, 29 Nov 2018 09:35:42 -0800 Cc: Josh Poimboeuf , Peter Zijlstra , Andrew Lutomirski , the arch/x86 maintainers , Linux List Kernel Mailing , Ard Biesheuvel , Steven Rostedt , 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-Transfer-Encoding: quoted-printable Message-Id: References: <20181126160217.GR2113@hirez.programming.kicks-ass.net> <20181126171036.chcbmb35ygpxziub@treble> <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> To: Linus Torvalds Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 29, 2018, at 9:29 AM, Linus Torvalds wrote: >=20 > On Thu, Nov 29, 2018 at 9:02 AM Andy Lutomirski wrot= e: >>>=20 >>> - just restart the instruction (with the suggested "ptregs->rip --") >>>=20 >>> - to avoid any "oh, we're not making progress" issues, just fix the >>> instruction yourself to be the right call, by looking it up in the >>> "what needs to be fixed" tables. >>=20 >> I thought that too. I think it deadlocks. CPU A does text_poke_bp(). CP= U B is waiting for a spinlock with IRQs off. CPU C holds the spinlock and h= its the int3. The int3 never goes away because CPU A is waiting for CPU B t= o handle the sync_core IPI. >>=20 >> Or do you think we can avoid the IPI while the int3 is there? >=20 > I'm handwaving and thinking that CPU C that hits the int3 can just fix > up the instruction directly in its own caches, and return. >=20 > Yes, it does what he "text_poke" *will* do (so now the instruction > gets rewritten _twice_), but who cares? It's idempotent. >=20 >=20 But it=E2=80=99s out of order. I=E2=80=99m not concerned about the final IPI= =E2=80=94 I=E2=80=99m concerned about the IPI after the int3 write and befo= re the int3 is removed again. If one CPU replaces 0xcc with 0xe8, another CP= U could observe that before the last couple bytes of the call target are wri= tten and observed by all CPUs.=