Received: by 10.223.185.116 with SMTP id b49csp2386673wrg; Thu, 15 Feb 2018 10:49:43 -0800 (PST) X-Google-Smtp-Source: AH8x224N08PnvogQYIexQh/a3ZKYDtTF7u0XG9MCo2KCZnDLzxXRTHXPcDqA27H7EJ+wiMxknWzw X-Received: by 2002:a17:902:3343:: with SMTP id a61-v6mr3368252plc.185.1518720583058; Thu, 15 Feb 2018 10:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518720583; cv=none; d=google.com; s=arc-20160816; b=bQOzU0jysQyAcUwBFA3g0wiyl9C+jDtuYVlPe/A9ceYM1/Ypss6GrzYncyMdj9gxxd Amn6p3eayrU4F2/tH6nJQ0Hv04fpO/vcclqJ8LIjXnkNm6HIrSfT7aZgi91DH1Kk0vFE c39EceCWmz1B9JfxC4A347TAUYTBVErVivwiHlBMtd6tFvamtjckQw5iDYwvs/i3KFSD YOu2ksHw4Z3xQ1+SVgb1cp+Ci9I8HBlu6TPLQh3G02WH3BaaAFbgMNrUNKxjKfWw+1YD wzq+rO0fg6StNuR/gHZENYHe3a1s0F7CCVksm0Iiyf8ncjvoIy0AwLGZkiuYqDn98IjF 5eMA== 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=/yp2oFhd71JzvkIPU7m4KO0qnr9+zXOaryvggGRsKEo=; b=xUBG2N1Rk+cUXSRuovGK2ugV68itM8Synmc4kNKCCnvreoucBr+PiDRiSI40/phwVa vTfmi55A52hJY5AsurH9VRoCmK9Awco8Dre/pjLpUBzskOEGsumYzMQuTot6bFpsg8OO wFJ1NLp9YVwX60cUtsTgV4NckRWPNQRb1LZb5DeDf7xw07VvoiJXFYykNOgYR8U7grqJ yowemALkShH2LGrgyW3A/8fSYkzQ7K2R4UGDouhOueCi7R9WcqHSsC81JaDY7Yil6wT5 3RQsy/h6L/bpjOk/vr/0QLsvaqZ8ezkChvh2DaUmDvfe1rKi4CjNEDGB8ZYmpvCSz/ff 7RNg== 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 b2-v6si5027513pll.483.2018.02.15.10.49.28; Thu, 15 Feb 2018 10:49:43 -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 S1166933AbeBOSsX (ORCPT + 99 others); Thu, 15 Feb 2018 13:48:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:49406 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162294AbeBOPWK (ORCPT ); Thu, 15 Feb 2018 10:22:10 -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 4BB98DF5; Thu, 15 Feb 2018 15:22:09 +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.4 012/108] powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti Date: Thu, 15 Feb 2018 16:16:09 +0100 Message-Id: <20180215151224.118610505@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@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.4-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 @@ -838,8 +838,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) { /* @@ -910,7 +931,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