Received: by 10.223.164.202 with SMTP id h10csp3583545wrb; Sat, 25 Nov 2017 11:55:25 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ3nnE52uinNSEwcpg4l0400iAzlcgMNDkWIg4lgkGMNH1cm5cTC2+Yo5aMeCNynGv5FOWy X-Received: by 10.84.245.22 with SMTP id i22mr5820910pll.123.1511639725826; Sat, 25 Nov 2017 11:55:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511639725; cv=none; d=google.com; s=arc-20160816; b=JB/QJ7QqIVU5WFoRXEa+imeR4uBghCmpcUoCTj6jpOcUrcVD/1VIUIVOwSPUC4/gxD p2A0j+4crz5EQi6j3KMsInNwsKBJi9qrB1E3VgilR3vABasbv/q/SMlDXrIMaPswma6x Ea/Ds3y2ya/oiSYEG6Be9eSU5W6cfU/w3ObwG0z1+S4g/O2cSDQP7UozMfNphDTUTm65 2RT+krZTJwY1orDT+ZCyw6D0a/nJAwEBok4ex+LwioOPKDJbQQSvBuI2AN3oBwigNhjF T3fSZeyRK1KITGajGcyw+IZ+ziR7vGdaI5a8oDPldw73pTru7o7yfdq75l1yLGtD6d7Q hI1g== 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:arc-authentication-results; bh=VqBrXox+gX1sgfQBX/WPJHpo4prscNmORLHPOOm0H7g=; b=Vnis34YbQINHhxNwDdBqrWsvrNERUIQeQTdfBI5mM99flvzq5UVpK9yFmhds53xfZQ y4dZJSF7oB5sv4U/yRR35LbuzntmFQXWjB6trcGdol3cnjp8ziPlIstnEJoZonpkbrTj X2Et7I4DJq5jwFKMyNw3vhwjdkDhpIB/e97jAjfMVXjzyw1oSgC8Hsy+f5EOzivg+YeC C2PCnKFhCjBDpNTWWxvO9LA1FeBvqAlYHPeISkObJuryNdxULVXrgiqR+ON36MF6U2S9 emJFW8I6SYN6Xaku4WvwQGYYaQOlksOrHXyNzaE7MLVjYKfSW4EZ05kiIvRjHzqTR1o5 WPrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=dY2V+MfV; 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 f13si1735829pgu.779.2017.11.25.11.55.04; Sat, 25 Nov 2017 11:55:25 -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=dY2V+MfV; 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 S1751569AbdKYTyC (ORCPT + 81 others); Sat, 25 Nov 2017 14:54:02 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:39068 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbdKYTyA (ORCPT ); Sat, 25 Nov 2017 14:54:00 -0500 Received: by mail-oi0-f67.google.com with SMTP id r190so16995883oie.6 for ; Sat, 25 Nov 2017 11:54:00 -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=VqBrXox+gX1sgfQBX/WPJHpo4prscNmORLHPOOm0H7g=; b=dY2V+MfVGOQLaY5wxSAT5fXyz5BvCPgz5d/2Usg+4JYTF8zv0K4zkLLQgaU7Q5j+wv cV/Lo0HgBJKzjlLG7k1uMjVYQ6dLNlecrS+6NhrhIasucboZUTiNNdKxFLd7hLD9FHIm X2vyAJAV2ZPYySEFo9znL3K30Lo/+b+978fwSFKAbbiYcxy0+/l1YadtU23itKM97k75 otLmjv6ARQg3boS/a9ci2UtJMlO6BFCE6f7LpS2bWPZ5xG9U7U+mvxFsKnXzu1Pjya3Q Ql7lGwMvOdtjFHECA3680PucXOhKOaM/nbUs7R+6jKzJdx0iWSFuPeiHYtDOJcOpWQxb aQFA== 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=VqBrXox+gX1sgfQBX/WPJHpo4prscNmORLHPOOm0H7g=; b=WfYNC8BBSJhnIYONaRyZywmBanfCx5oLE8ZUKLhAxu6kmJNAIwP+FOoQ44xaAphz48 ddSskx7xNa3Hfkznh4CeJwmW+AXT/hV7Rdn0fyFHWTWZeYUkdr8FtBpzbBNEE5JYK/uo DjBpSlP+LUz7hcNuuxT+zlclYNcU6/lXrMDzV89SL0JpdLJKtiVDM9N5+TPZv0r6b0dd B2pS7+cbtE8n4XZiwSSYIbZkE/rmXRmX4Xw+AppsuDXTaq6QEAKDNe75k6bsraG7hM33 RKe60xycUB4MijOvwGg/3MjY+UEWuZwe7Q3pgxDAtOPM0HrFPJboyrHm6cIYrajPW8Be oE/w== X-Gm-Message-State: AJaThX4cCrXyL2z/ewh7Mou03KapHGPfj1Toc6j2bxRYPb4gNHHArUJY +4/DpKQzKcSAZw0UZYvrxR70cIp/3vc= X-Received: by 10.202.84.21 with SMTP id i21mr12507567oib.263.1511639639864; Sat, 25 Nov 2017 11:53:59 -0800 (PST) Received: from [10.255.71.61] (77.sub-97-43-194.myvzw.com. [97.43.194.77]) by smtp.gmail.com with ESMTPSA id u71sm10571831ota.55.2017.11.25.11.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Nov 2017 11:53:58 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 42/43] x86/mm/kaiser: Allow KAISER to be enabled/disabled at runtime From: Andy Lutomirski X-Mailer: iPhone Mail (15B150) In-Reply-To: Date: Sat, 25 Nov 2017 12:53:55 -0700 Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Dave Hansen , "H . Peter Anvin" , Peter Zijlstra , Borislav Petkov , Linus Torvalds Content-Transfer-Encoding: quoted-printable Message-Id: <47186975-1DCB-4767-8C4C-0816931E3595@amacapital.net> References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-43-mingo@kernel.org> To: Thomas Gleixner Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 25, 2017, at 12:18 PM, Thomas Gleixner wrote: >=20 >> On Fri, 24 Nov 2017, Ingo Molnar wrote: >>=20 >> From: Dave Hansen >>=20 >> The KAISER CR3 switches are expensive for many reasons. Not all systems >> benefit from the protection provided by KAISER. Some of them can not >> pay the high performance cost. >>=20 >> This patch adds a debugfs file. To disable KAISER, you do: >>=20 >> echo 0 > /sys/kernel/debug/x86/kaiser-enabled >>=20 >> and to re-enable it, you can: >>=20 >> echo 1 > /sys/kernel/debug/x86/kaiser-enabled >>=20 >> This is a *minimal* implementation. There are certainly plenty of >> optimizations that can be done on top of this by using ALTERNATIVES >> among other things. >=20 > It's not only minimal. It's naive and broken. That thing explodes when > toggled in the wrong moment. I did not even attempt to debug that, because= > I think the approach is wrong. >=20 > If you really want to make it runtime switchable, then: >=20 > - the shadow tables need to be updated unconditionally. I did not check > whether thats done right now, but explosions are simpler to achieve when= > switching it back on. Though switching it off crashes as well. >=20 > - you need to make sure that no task is in user space or on the way to it.= > The much I hate stop_machine(), that's probably the right tool. > Once everything is in stomp_machine() the switch can be flipped. >=20 > - the poisoning/unpoisoning of the kernel tables does not need to be done > from stop_machine(). That can be done from regular context with a TIF > flag, so you can make sure that every task is up to date before > returning to user space. Though that needs a lot of thought. >=20 > For now I really want to see that removed entirely and replaced by a simpl= e > boot time switch. We can use the global variable for now and optimize it > later on. >=20 Nah, let's do it right: use either X86_FEATURE_WHATEVER or a static_branch. = We have nice asm support for both. Keep in mind that, for a static_branch, actually setting the thing needs to b= e deferred, but that's straightforward.= From 1585066839718786160@xxx Sat Nov 25 19:18:54 +0000 2017 X-GM-THRID: 1584938674415532731 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread