Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2851043imu; Thu, 29 Nov 2018 11:12:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/VONIrLFz3xVl8UQVOB52YPLFPLEPnaKT2dD6zEdcTa1jkmr87MutMF3EOVv9JEYEp0xDAQ X-Received: by 2002:a62:1043:: with SMTP id y64mr2646586pfi.78.1543518779838; Thu, 29 Nov 2018 11:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543518779; cv=none; d=google.com; s=arc-20160816; b=lNU5LRCxVmHef1jVQ3ImS6R6I4kfigizlVHRRezYcbo3SJQUPq8y57yOpQLZzVkoOK tSG+lWHmMhOB2c3Sj0ZStnjEe86x/thVVmTwPAySdiKwuQRF9/I8bbzLC4wR48cYQSmL p1FCJQ9ACeW2TEd5UWOY/n2DQJnbwMyL9OWBRP6WzD7DNB5cI217a4CDWC6vvmCUhKe4 VkTFagh87oA24nw4nsXd8D9hhOx7ihAInbs8CMVzMmwasEaVGQHxSVWRV31WO7PuRjfD R3cLnlooAwAO1fUl8ym3CETfcaPwkEiJdXRLWB9TWbAtq8S2U1niHpZ3XG3SglmSWxsw jnIQ== 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=WxTotULv5EqGMkW2xeKCdTtPj3sONi0p+WZ1ZNgSDTs=; b=gZceA3MqD75KR2aTxmbOSNI03dKZB5VN8oqTF90N6hJbGwJRNmIQYawYXdYzzUmkuL 9rOrNia2ITCy7FYFWYO+xcwS5WOx4qMrCsKQaWEBJrmd2OV6WFC6j75tHi9IcRV2JJ9p oevnfN0wLbRcPxzRxrkx6mMZ6E4PKCwb0uGuMDRQFY4Y6iZFy31bIc5V+pXjS7cy21Bh Bxs9n9apGIK/5H7QOIbNdzJwTFRGZeUI/f4xEAAcesntCCFad8QVVj8IyWppAZgm8hZ5 0m5rSfaEpAU5eQ5bAD7MpMtY2DpAaWkV4UGQqE0YtfXhn1WpLWu9MLpCAuEzKMxPFewz EB1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DJSfdFoT; 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 s125si3236239pfc.60.2018.11.29.11.12.44; Thu, 29 Nov 2018 11:12:59 -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=DJSfdFoT; 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 S1730286AbeK3ElZ (ORCPT + 99 others); Thu, 29 Nov 2018 23:41:25 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46852 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbeK3ElZ (ORCPT ); Thu, 29 Nov 2018 23:41:25 -0500 Received: by mail-lf1-f67.google.com with SMTP id f23so2047103lfc.13 for ; Thu, 29 Nov 2018 09:35:16 -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=WxTotULv5EqGMkW2xeKCdTtPj3sONi0p+WZ1ZNgSDTs=; b=DJSfdFoTUZqDJ51bHvWUKqyQRvhblc/lbU6czVs/zIALcktFBMxDjS44XfWQ2k9utJ qWWYTR96+QaUFDfpnjY2A56mjCmjToJhVNQwFJhVheiEf5iOjoeFPobFiGmCEqzda/W9 xkgjmvOZLykug/D3CXG2uYtXaErPHQNsLOosw= 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=WxTotULv5EqGMkW2xeKCdTtPj3sONi0p+WZ1ZNgSDTs=; b=ZLwyitclCScA/Xk1V0xgWYZkk4B1//neSAUUnnWgVXGm0OZeCj9MH0p7lE8xbHwNE2 zdOccp2EAJtXtkrwbUVvb0dtLzKS5rnxxGEw/W7xw8lwJc6zZ4xWfBYJt05qykCZ7iou FFpOMSNXsHhw2mSuzlqy8dyKN2V9cN+K/kI72az22t02ljuRI8TKt9zTWAFv7dNg7saa 8KBw7S4wm2S003n5SckjtH8mja5VNdab+yG3BuFOHnPuzlouf4ffgvqjnR+md3WROeu6 h3g6pl1mObZSrTmd9ECJRN0dPTNPv+K0HKGethWlFIuQJdjFBym0RFf7o6qovqSxCuPX dJtg== X-Gm-Message-State: AA+aEWaO11xaaB5IjnSoYNNDtLB1KRllLt1jhcvTmVtc1fvw2BbLzUWg pOj4WOQdQ2+x7I3NLYWsAgVadYew/dw= X-Received: by 2002:a19:5349:: with SMTP id h70mr1620074lfb.50.1543512915344; Thu, 29 Nov 2018 09:35:15 -0800 (PST) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com. [209.85.167.47]) by smtp.gmail.com with ESMTPSA id m77sm410107lfg.3.2018.11.29.09.35.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 09:35:15 -0800 (PST) Received: by mail-lf1-f47.google.com with SMTP id z13so2059840lfe.11 for ; Thu, 29 Nov 2018 09:35:14 -0800 (PST) X-Received: by 2002:a19:c014:: with SMTP id q20mr1532106lff.16.1543512605768; Thu, 29 Nov 2018 09:30:05 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <0A629D30-ADCF-4159-9443-E5727146F65F@amacapital.net> From: Linus Torvalds Date: Thu, 29 Nov 2018 09:29:49 -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: Andy Lutomirski 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-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 9:02 AM Andy Lutomirski wrote: > > > > - just restart the instruction (with the suggested "ptregs->rip --") > > > > - 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. > > I thought that too. I think it deadlocks. CPU A does text_poke_bp(). CPU B is waiting for a spinlock with IRQs off. CPU C holds the spinlock and hits the int3. The int3 never goes away because CPU A is waiting for CPU B to handle the sync_core IPI. > > Or do you think we can avoid the IPI while the int3 is there? 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. Yes, it does what he "text_poke" *will* do (so now the instruction gets rewritten _twice_), but who cares? It's idempotent. And no, I don't have code, just "maybe some handwaving like this" Linus