Received: by 10.223.176.5 with SMTP id f5csp726323wra; Fri, 9 Feb 2018 06:17:35 -0800 (PST) X-Google-Smtp-Source: AH8x224kqTpWzVzihTIF6JH0uyHWP+RIR4L6lqzFIDNBskUNhe1eCOUyOFh3kCLvyYQgtCWIPqQy X-Received: by 10.99.95.193 with SMTP id t184mr2428862pgb.296.1518185855503; Fri, 09 Feb 2018 06:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185855; cv=none; d=google.com; s=arc-20160816; b=ZdoBvEfKqj+02bJjJN92RQWraB5YtQT1H7FiPW1R3Q+rxW7NtPg5/asu9GpAguauH9 gPI0cEcbgA9D2aLU1InbUv06aYzpqh2Vcz1I2UgrDt+hJy1AsIaxazSOHFDJllCe9xAP qzv9tL5CuN4NpwhYaZ7tyEg8IQnLQ1hpHF+OsMUxzhSHwd/RW2yILJPg8+awped00WhP QjDPjI2mQ54V844xzIEShQD6KOEpBno4I6IMttPMx+56samXvGH148Y+wVSb4wfuOF1g 1+iZa7djVr9ls2pihqu6Veq7j58E7GlT6dZjlzL3bZ74wl9XHygnMSGQgey09oUxOKKv u+mQ== 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=dgOcxZ/xF0932qN/9a7bsIrZ0IuFwdZEO6jRpU3vxQg=; b=0C836kmJo8K3z1JhhqUbxGCwHvcXifZIl2YMM+mure2c7HrKbViB6xNLQOW+7F5S5Y gyh4d4sIoFo4vVZgY13Mb83rHzbAxH1I6lnxchcJ3Va3bzvX5T2wobfROepc+Qtom77J zIgiIzbNeqXFG/jsOWqs2XSog+RwDQnRZBq51S+tVyijJKvVloiz6hGEsnwgCv1OJno9 5hYvb++hWozPs9FqwYIgKVf3rt5HA2T+TUgsLkx6qDIjutS2qKQaD5Ts7afXtiy2G3fy E8sFufb8F0vRu0dnSJO2FPHgBmjDN5R4Qx+9SnTK9hcqQKyo82MjldSo1ETh1v//iFrk twBw== 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 61-v6si1608734plz.417.2018.02.09.06.17.21; Fri, 09 Feb 2018 06:17:35 -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 S1752776AbeBIOQ3 (ORCPT + 99 others); Fri, 9 Feb 2018 09:16:29 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48298 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752275AbeBINkv (ORCPT ); Fri, 9 Feb 2018 08:40:51 -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 2D6601058; Fri, 9 Feb 2018 13:40:51 +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.9 07/92] powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti Date: Fri, 9 Feb 2018 14:38:36 +0100 Message-Id: <20180209133931.821957082@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@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.9-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 @@ -682,8 +682,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) { /* @@ -754,7 +775,8 @@ 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 */ #endif