Received: by 10.223.164.202 with SMTP id h10csp3672606wrb; Sat, 25 Nov 2017 14:12:25 -0800 (PST) X-Google-Smtp-Source: AGs4zMawpnPw6NUW+HvPNW9LWkKESkLTy7QdEoTmI0eFe/VjGs+lFV5k88q9WsV9u72Ytw329JPZ X-Received: by 10.99.107.7 with SMTP id g7mr31370302pgc.387.1511647945578; Sat, 25 Nov 2017 14:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511647945; cv=none; d=google.com; s=arc-20160816; b=EPdan0eAv7TWEKFVZyoOZhGzevSntrxy4O/Vl4aBtbDyLwu6s0aSnojAm8rbvCNnSP 6O61c+lg2ebh/2PCIiX7G9eg85SuTcILaMbhfDkP/MBqq6XWfXVtb8PMOQoqfzFrqNlx wb1F2LBcHOakpqh+ofY7wDPTiDmVB1pYnNlLbFbj9+noTwOy06dLe4zvuaB1lcZqDu7J KpII4/GI8TzDr2waidKqvhpDivrQ/MhQVY8jXFwhtc1y1BnitQLtC6zkKHDP+Kk56aPR 7diJ0IO37k7OjXmWxwgeipYUyf/xkurfbeCW4cYTlfNKwuk2Jnu6MpPCgiCUgplyIi7E ExDg== 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=e4aoqMEoSOGHE5U9J81oJMWBoMhqociy1+56/TFVbO0=; b=PqYQY+Q/9sGV1jamiFi+faLfhB8wJXJ9dG0aQFiDbsy+wCmySIKENtVLOcdjgYPVkn l1NHeDKcBqf2FN1vlI/LpOIuJN3UybNUihLyVnzGQSBowBdtOX79RIqu+mlJ+KqYpI9z w+oel28pTpotPYBSfjb2rdT+h8CHQGfvFhaR1FP/JSLmSx4kItSU/3L8tKk6cunzC0QP i/Hgi/+/ykYyyaTwsp8KZh6OeUhr91L0K+pUFCUOil/BNseA5nTwpcqVuiqFLASrJfKy ynH1Y0HpKep5H+/XzMJl/S/PvxW8khn9iPVMer3ouwRfVLTINcwRzPBlVl6/CiC3c5j2 J7sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=G98adSnj; 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 w63si20115199pgb.612.2017.11.25.14.12.12; Sat, 25 Nov 2017 14:12: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=G98adSnj; 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 S1751842AbdKYWLC (ORCPT + 81 others); Sat, 25 Nov 2017 17:11:02 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:40194 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762AbdKYWK7 (ORCPT ); Sat, 25 Nov 2017 17:10:59 -0500 Received: by mail-ot0-f195.google.com with SMTP id g104so21354254otg.7 for ; Sat, 25 Nov 2017 14:10:59 -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=e4aoqMEoSOGHE5U9J81oJMWBoMhqociy1+56/TFVbO0=; b=G98adSnjbu+TY5TuNQ77Xx2msZBvbtlkXsAEfHqAgMnA9cMv8D7yVhpTRQmi7OfjNC ROwlc5kG6feyGdEkpfXLQ/jLfc2wIHf9EPHTRHcaQI/0qmwGR5f+UxSNQH8b0lfedPQe odE9KG3Sv6oJrSs2zCECFu6J10pFQ4FSLnMUVyRSCQRGnscyYWHk5bl/ghjfgXmeigEm dYZfn6y83tTgcGDl4zNDfAY1O9bSGZIcYBj8250C33IsdGAJkkLpH82niw/BtKZJ1aYH YFOxRQ7mQGDvaJtjwFXp359NjLnyucFECrEud47VWrrpxS/P+NLaubOLQU74H2wy0kdd wNeA== 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=e4aoqMEoSOGHE5U9J81oJMWBoMhqociy1+56/TFVbO0=; b=JZiy+2si0ooDU4rud0Mq5rXuOOJmxKSOA9IfzSr3iEWsD+2Hb5GvdfXALlUl/YPsNm nyFLXCnpGbLSMR4BRCwcdHuiv9YVcHk8sEIyKOQRyE/9RDGz4ZY45l+Lo8GdR0+1dnEb QH81pU+jRW64FUskRMau9HpnIz51c9n0xtSo26lA/krV2vz5kKfgPMTRrGe3kJA4TawI JI0ho1c4DK82626dGJVl4EQsSSRBNrxWgQd3aUmxXYX8JvkzEivRDNQqwQ5dBdhGPvsV D9zNYD06T/ez8wwQVFVw8H7HSnwc9ZLpO3rOM0qZ2cp8cvhwmlbAuorVItj302i0tGPb qQ4g== X-Gm-Message-State: AJaThX4aOtZJLZWkN+6IVrPOaJ3IBumnOq3HTGnKI/fH8NAwz30AsYqt 7F3YhApxHuhC5yZT3ZO1VBWtcqP0y4A= X-Received: by 10.157.64.153 with SMTP id n25mr24632055ote.232.1511647858320; Sat, 25 Nov 2017 14:10:58 -0800 (PST) Received: from ?IPv6:2600:100e:b022:e56c:17a:a445:c8b1:5853? ([2600:100e:b022:e56c:17a:a445:c8b1:5853]) by smtp.gmail.com with ESMTPSA id j15sm10441051oiy.17.2017.11.25.14.10.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Nov 2017 14:10:56 -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 15:10:54 -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: References: <20171124172411.19476-1-mingo@kernel.org> <20171124172411.19476-43-mingo@kernel.org> <47186975-1DCB-4767-8C4C-0816931E3595@amacapital.net> 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 1:05 PM, Thomas Gleixner wrote: >=20 > On Sat, 25 Nov 2017, Andy Lutomirski wrote: >>>> On Nov 25, 2017, at 12:18 PM, Thomas Gleixner wrot= e: >>>> On Fri, 24 Nov 2017, Ingo Molnar wrote: >>>>=20 >>>> From: Dave Hansen >>>>=20 >>>> The KAISER CR3 switches are expensive for many reasons. Not all system= s >>>> 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, becau= se >>> 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 whe= n >>> 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 i= t. >>> 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 don= e >>> 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 sim= ple >>> boot time switch. We can use the global variable for now and optimize it= >>> later on. >>>=20 >>=20 >> Nah, let's do it right: use either X86_FEATURE_WHATEVER or a >> static_branch. We have nice asm support for both. >=20 > Agreed. >=20 >> Keep in mind that, for a static_branch, actually setting the thing needs >> to be deferred, but that's straightforward. >=20 > That's not an issue during boot. That would be an issue for a run time > switch. What I mean is: if you modify a static_branch too early, it blows up terribl= y.= From 1585069855137416978@xxx Sat Nov 25 20:06:50 +0000 2017 X-GM-THRID: 1584938674415532731 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread