Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5171316imu; Tue, 8 Jan 2019 12:51:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN7c8nC2FZRBoaSRzNdrb86ovLFnZw5evWEsCXrijN6KiPQMpcufYpSBQZ5+WcSovrbJaeHC X-Received: by 2002:a62:81c1:: with SMTP id t184mr3344241pfd.40.1546980673473; Tue, 08 Jan 2019 12:51:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546980673; cv=none; d=google.com; s=arc-20160816; b=gz9l+M+gFLKvMsLbFGA+972o7BaUr7z/CBOHSHcwflT0Eqk4/JOl6/f4kjpPWs0U3H kUzcn8hcaSBH+uTiRlnB41vC1eFUSiY2DtcT+bTaRDs/CTCwX6zPNPN/s0pkaWAO9shp F9J4NWQkQmJcDdVO68zYx9KJdIzEoy0A9V/owIh+bucdWraUCu1mBz292QpeaQSpJ9GH XXW/J18BFayD0tEPxBEecItqRV03o1XeeU4JJBVHsTECin0q6y9SgnUnlTZooQQ0hCPY 8a6VC8F0bHK01wJOr9YhR1c43Y5gssfEuYAmb4nMYK0MXmvZA9gykcLVg+M/VA2kmXU8 fu5w== 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=ZjoZV6IPjVL8g6UaeWt8waJl3GwrN5iFIB5otsE0ekw=; b=hWoYspwnNsZRyriK8RkibYNlmFt+GvzlA53TX1g0ORkCTwGwRjujL78xvEIvPSes57 5liK23zWblNZ1InhvRdJJ8H2uXzmS5G4qd+FehPyQ5RSNnR1KO6i6SyZqRHhmp2C6g6j jLa/lnIhl7dWjBeKJd3zr2k4HcR9LdVROCelWKL5ABKZhN/0UuVzkTzMEPC7yaFOJTuQ fHzehpIMHCR+8jXKPwSobywo/hbtLCjdSMeV4U45IsK4pa7sxkB7BoXVI70921G2Qsdh 7tjFt0xRXTCKsX8pDDxTODkhHIyvox67rkZr9WI2coPukBFGobvfCapki6Tjvci+CsJN Vbvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RyGyPXZD; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si9269947pfe.63.2019.01.08.12.50.57; Tue, 08 Jan 2019 12:51:13 -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=@gmail.com header.s=20161025 header.b=RyGyPXZD; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729484AbfAHUry (ORCPT + 99 others); Tue, 8 Jan 2019 15:47:54 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37354 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728559AbfAHUrx (ORCPT ); Tue, 8 Jan 2019 15:47:53 -0500 Received: by mail-wr1-f66.google.com with SMTP id s12so5473418wrt.4 for ; Tue, 08 Jan 2019 12:47:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZjoZV6IPjVL8g6UaeWt8waJl3GwrN5iFIB5otsE0ekw=; b=RyGyPXZDTUUHqWv1OL3ssNdUUYkGpMpA+y3Qn/RJtiCVkswVi/whRkYlSYz3pMo+zM Mo1BvjMm+KPxdpeUSCyRzhkPsOD30KcYFESKzONpha0cXj2DY2Txmq0xA4m4l4kgn0p4 pxAIEMB7sq3RZqZUlu6AOP8cGMiMfnT4MWt9RX5JJD9bHXI+HaiWK+CQ8yy3KzfNsT/I xU+DatXtqqfCuNcf35ypa8zqOSRCCzOkDBk+foeHytcJV9kjSKr1ZOUqPZ7GXnis8/zD c5CW4xtUDLEZcVpdycws0fK9gmt061XQHdup9AJKVMgX40wodbmTA/Up0K3mBK2j+Q6+ +3MA== 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=ZjoZV6IPjVL8g6UaeWt8waJl3GwrN5iFIB5otsE0ekw=; b=XMDymeAPR8m2vFe0ZuqBUyyX1knmY3bALIBQNguUaIJdyEe+9XVlfk2JtX8ofdGxEB Hozo0rMxwP5V7IqLNxEQkiFwCi2A6qnrzFsik0iOzkTW1oKv70hbAn44Z/FC5EiXfi2g BPtlsammkkBkgvRtyc2YH9XTVPoT3tmiuTKHygFuWHmlhqM7//Ufk3YtWx8GOGRcDdLO hHeruCJvpoU7wsFkiUf/QbxdBOZCByrh4RJhld8cgIdlgtW5dTBGkHPGUkLt5kh/TYnH Khjo3injNAh3Fd7iS0ZLaQv5pTERdFmLI9g7SurNxb7iDNjvdREx6yw63Yk1l9ot7Bk/ eaWA== X-Gm-Message-State: AJcUukfSsqoMUtjFFuT3rVjI9dOIIz6eUPMWlF7SF5hHI6coIzyJTfC5 69Vg2m0MI8uGR9yYUUeB4YQ= X-Received: by 2002:adf:91c3:: with SMTP id 61mr2478656wri.324.1546980471531; Tue, 08 Jan 2019 12:47:51 -0800 (PST) Received: from [10.2.13.140] ([208.91.2.1]) by smtp.gmail.com with ESMTPSA id 133sm11271932wme.9.2019.01.08.12.47.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jan 2019 12:47:48 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [RFC v2 0/6] x86: dynamic indirect branch promotion From: Nadav Amit In-Reply-To: <20190108190104.GC1900@hirez.programming.kicks-ass.net> Date: Tue, 8 Jan 2019 12:47:42 -0800 Cc: Andi Kleen , Adrian Hunter , Ingo Molnar , Andy Lutomirski , Josh Poimboeuf , Edward Cree , "H . Peter Anvin" , Thomas Gleixner , LKML , X86 ML , Paolo Abeni , Borislav Petkov , David Woodhouse , Alexander Shishkin , songliubraving@fb.com Content-Transfer-Encoding: quoted-printable Message-Id: <7EB5F9ED-8743-4225-BE97-8D5C8D8E0F84@gmail.com> References: <20181231072112.21051-1-namit@vmware.com> <87zhshe66w.fsf@linux.intel.com> <20190107163227.GH14122@hirez.programming.kicks-ass.net> <20190108092559.GA6808@hirez.programming.kicks-ass.net> <306d38fb-7ce6-a3ec-a351-6c117559ebaa@intel.com> <20190108101058.GB6808@hirez.programming.kicks-ass.net> <20190108172721.GN6118@tassilo.jf.intel.com> <20190108190104.GC1900@hirez.programming.kicks-ass.net> To: Peter Zijlstra X-Mailer: Apple Mail (2.3445.102.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jan 8, 2019, at 11:01 AM, Peter Zijlstra = wrote: >=20 > On Tue, Jan 08, 2019 at 10:28:02AM -0800, Nadav Amit wrote: >> Is it really that important for debugging to get the instructions at = the >> time of execution? Wouldn=E2=80=99t it be easier to annotate the = instructions that >> might change? After all, it is not as if any instruction can change = to any >> other instruction. >=20 > I think PT has a bitstream encoding of branch-taken; to decode and > follow the actual code-flow you then need to have the actual and > accurate branch target from the code. If we go muck about with the = code > and change that, decoding gets somewhat 'tricky'. >=20 > Or something along those lines.. Thanks for the explanation (I now see it in the SDM and sources). Basically, the updates should not be done too frequently, and I can = expose an interface to suspend them (this will not affect correctness). I think this can be the easiest solution, which should not affect the workload execution too much. A general solution is more complicated, however, due to the racy nature = of cross-modifying code. There would need to be TSC recording of the time before the modifications start and after they are done. BTW: I am not sure that static-keys are much better. Their change also affects the control flow, and they do affect the control flow.