Received: by 10.223.176.46 with SMTP id f43csp2674131wra; Mon, 22 Jan 2018 01:20:39 -0800 (PST) X-Google-Smtp-Source: AH8x227MX0oZ1ViEj+l+mzq1HaOgzn8mA1URvEz/x68ZrqtlVf1Uk1Vq0TgZ+kmmO3JaQBkJUCyT X-Received: by 2002:a17:902:221:: with SMTP id 30-v6mr3137144plc.134.1516612839530; Mon, 22 Jan 2018 01:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516612839; cv=none; d=google.com; s=arc-20160816; b=rj0l5u1xOBzZjtEt7dIOHVXCSQQlqgwjtrBatY6jNycgx3+BcK7wvcm2mrf2YaK/9S 5CEnUJkMwWkIh9DOkfLSJfOi+EsPmOD/KxScSV9qGIN4zz5RTuG6/jdHkn7/IABt/c0s BO06HeL9wiL4AdNe7kQ9jEC90Yxi2dQulDz0XC+8r8muylohnTFE5bhx3vIabccIX6n3 wIUZHfO9eAQalYnEryI1yLK7x2EJkCUvVGLxWTqeaLepDX+QkCNHQ4Jhxbrv7cwIQnn5 mtUMJkZCvtC2Sc2FYDlNFbYYc252RLrRTfI5ae7Tx0OApckPIXUv6lQ9tbayanEWw2qt /PdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KklTxPe+34Q8zU1WG+nhujXtEZ8hF+CacSuvUQ5NPlM=; b=cD2e6IjSfhIG8gmSShdhLZt2jDyi6/O0H3OAh3gorHDyzM2w/HZdPeD/jL1SYVSJz6 VqYu+YCoc/6+6b2eiZZku4DaiKYtz8Oa4SfI0HsAFlQ/03LZLVTOEd+Qh6JUz8jWig2p /zbXnd1j8Wg23+dbjd4Jh2VSeslYofY6a5XwcvVepe++5Ik3a03DNTH8agWlMgIXwdgY Qz+X2Gw1GWg9KEGZJAV33Ghnc2GkyF+WHURfSphTqNlyoY0Y1T3hHdxOw6/YNry/++U4 HP1S2wpyPNSwVPopXFV6CG9KrKOqa8Ie1x/O/kKEH6Zo6osZDva7uopmenvOismmyBUS H08g== ARC-Authentication-Results: i=1; mx.google.com; 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 y11-v6si3213764plg.702.2018.01.22.01.20.24; Mon, 22 Jan 2018 01:20:39 -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; 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 S1752005AbeAVJT1 (ORCPT + 99 others); Mon, 22 Jan 2018 04:19:27 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:32988 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333AbeAVIue (ORCPT ); Mon, 22 Jan 2018 03:50:34 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EB5D9D08; Mon, 22 Jan 2018 08:50:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman Subject: [PATCH 4.14 13/89] powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti Date: Mon, 22 Jan 2018 09:44:53 +0100 Message-Id: <20180122083956.007677661@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083954.683903493@linuxfoundation.org> References: <20180122083954.683903493@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman commit bc9c9304a45480797e13a8e1df96ffcf44fb62fe upstream. Because there may be some performance overhead of the RFI flush, add kernel command line options to disable it. We add a sensibly named 'no_rfi_flush' option, but we also hijack the x86 option 'nopti'. The RFI flush is not the same as KPTI, but if we see 'nopti' we can guess that the user is trying to avoid any overhead of Meltdown mitigations, and it means we don't have to educate every one about a different command line option. Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/setup_64.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -788,8 +788,29 @@ early_initcall(disable_hardlockup_detect #ifdef CONFIG_PPC_BOOK3S_64 static enum l1d_flush_type enabled_flush_types; static void *l1d_flush_fallback_area; +static bool no_rfi_flush; bool rfi_flush; +static int __init handle_no_rfi_flush(char *p) +{ + pr_info("rfi-flush: disabled on command line."); + no_rfi_flush = true; + return 0; +} +early_param("no_rfi_flush", handle_no_rfi_flush); + +/* + * The RFI flush is not KPTI, but because users will see doco that says to use + * nopti we hijack that option here to also disable the RFI flush. + */ +static int __init handle_no_pti(char *p) +{ + pr_info("rfi-flush: disabling due to 'nopti' on command line.\n"); + handle_no_rfi_flush(NULL); + return 0; +} +early_param("nopti", handle_no_pti); + static void do_nothing(void *unused) { /* @@ -860,6 +881,7 @@ void __init setup_rfi_flush(enum l1d_flu enabled_flush_types = types; - rfi_flush_enable(enable); + if (!no_rfi_flush) + rfi_flush_enable(enable); } #endif /* CONFIG_PPC_BOOK3S_64 */