Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3538495imu; Mon, 7 Jan 2019 05:17:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wcq5JYMiCls1ngQjBhgxfYID/uQaDgKDvuKRav3/gzz9+wFUqjLqchS6lfqsW8TeBf4Coj X-Received: by 2002:a62:7e13:: with SMTP id z19mr62912700pfc.94.1546867071245; Mon, 07 Jan 2019 05:17:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546867071; cv=none; d=google.com; s=arc-20160816; b=HvyPdAQ0M46ZYfIBFdANoVNEh/avd3tEkTpSxk50Y6lhUMLbfr8Nmnd2uqiFL3YVvV DgQE0Reip2+WEveNkOLIUpstU2jHfRHv5NXp7M6/YH3nYByMh7TlEw7BTJykRIw9Utmy icV7FtV6DhMdriWzzAm/Ne0ea+sNo9qz/O1U2hOs5BG+vkUpS1BN8c7PRQgIXQ8Wkf2m n6FUtFq83zq6fQjqxjAVIu4hcT2O6t95EkSfOAyMqNLJI4appU6HrJpUgEtVH32kihe7 r9UTONX3vYyzAVKP5H5Q3CxiJOowHsvK3vsebSJ0/Uk02sSo15YtxSkj3MuSzZwcdj77 i9UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+0NY9z0Athibxgsc2iHZxQvFp2NnVJj3VXmlRLIbCkQ=; b=fnNY0Z3bgLYmCvxFI64ksp+7MD9QcuJ2lbYlGyXmQMcTiO/gP0zUbLcx/UKW/YOFO5 xlK9Tn5M48bFv0uFH1Eoydzk2sRvLHAQ+kwOwcoPSgjMHytH7NwHMBRbfCu4TYv9MWS4 kYFDXoE6b8SWpbCmTFD038UUC0Hf95CaLx0p0Q7b+1XIK/vlnQMFTdv4GMoQzQVyMrGV cAWmZl4m4Tyq2smMaCGthVgxfpl0jMnntOwxayrGqrLZcCk5HG0U1bsH30lgomY6718h 9VEIP5V/rZNnuqvv7IiEb2RL2PsVrzAKl+JtgrC5WuNE3komM9q43Zeqik2ZoTdIYauZ DAtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BasQu3Az; 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 k5si13313317plt.111.2019.01.07.05.17.36; Mon, 07 Jan 2019 05:17:51 -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=@kernel.org header.s=default header.b=BasQu3Az; 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 S1730758AbfAGNCM (ORCPT + 99 others); Mon, 7 Jan 2019 08:02:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:49572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730706AbfAGNCK (ORCPT ); Mon, 7 Jan 2019 08:02:10 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAC9F2089F; Mon, 7 Jan 2019 13:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866129; bh=EmqQ4vRfQ6tMeE8dh6l3I1dm6OxkGv13KyRQ2xGBaMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BasQu3AzVIHUdgFLpvwCvwKzp80C9Rrea1Vtj4MOAxE03gqlv/TA0tB6qne5Xx79i lNFg4DrT8thTP2WCOp2vxO6I2u9y8MXLoRMCwyTQw2sBlGkmhjQbhJE4prNkzH6tXF yXnMojmzDu40nem7H0U+hjdGsNZFezSID5OfGAVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Hocko , Thomas Gleixner , Pavel Tatashin , Andi Kleen , Jiri Kosina , Linus Torvalds , Dave Hansen , Borislav Petkov , linux-mm@kvack.org Subject: [PATCH 4.14 056/101] x86/speculation/l1tf: Drop the swap storage limit restriction when l1tf=off Date: Mon, 7 Jan 2019 13:32:44 +0100 Message-Id: <20190107105335.988297254@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Michal Hocko commit 5b5e4d623ec8a34689df98e42d038a3b594d2ff9 upstream. Swap storage is restricted to max_swapfile_size (~16TB on x86_64) whenever the system is deemed affected by L1TF vulnerability. Even though the limit is quite high for most deployments it seems to be too restrictive for deployments which are willing to live with the mitigation disabled. We have a customer to deploy 8x 6,4TB PCIe/NVMe SSD swap devices which is clearly out of the limit. Drop the swap restriction when l1tf=off is specified. It also doesn't make much sense to warn about too much memory for the l1tf mitigation when it is forcefully disabled by the administrator. [ tglx: Folded the documentation delta change ] Fixes: 377eeaa8e11f ("x86/speculation/l1tf: Limit swap file size to MAX_PA/2") Signed-off-by: Michal Hocko Signed-off-by: Thomas Gleixner Reviewed-by: Pavel Tatashin Reviewed-by: Andi Kleen Acked-by: Jiri Kosina Cc: Linus Torvalds Cc: Dave Hansen Cc: Andi Kleen Cc: Borislav Petkov Cc: Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181113184910.26697-1-mhocko@kernel.org Signed-off-by: Greg Kroah-Hartman --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ Documentation/admin-guide/l1tf.rst | 6 +++++- arch/x86/kernel/cpu/bugs.c | 3 ++- arch/x86/mm/init.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1965,6 +1965,9 @@ off Disables hypervisor mitigations and doesn't emit any warnings. + It also drops the swap size and available + RAM limit restriction on both hypervisor and + bare metal. Default is 'flush'. --- a/Documentation/admin-guide/l1tf.rst +++ b/Documentation/admin-guide/l1tf.rst @@ -405,6 +405,9 @@ time with the option "l1tf=". The valid off Disables hypervisor mitigations and doesn't emit any warnings. + It also drops the swap size and available RAM limit restrictions + on both hypervisor and bare metal. + ============ ============================================================= The default is 'flush'. For details about L1D flushing see :ref:`l1d_flush`. @@ -576,7 +579,8 @@ Default mitigations The kernel default mitigations for vulnerable processors are: - PTE inversion to protect against malicious user space. This is done - unconditionally and cannot be controlled. + unconditionally and cannot be controlled. The swap storage is limited + to ~16TB. - L1D conditional flushing on VMENTER when EPT is enabled for a guest. --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -999,7 +999,8 @@ static void __init l1tf_select_mitigatio #endif half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT; - if (e820__mapped_any(half_pa, ULLONG_MAX - half_pa, E820_TYPE_RAM)) { + if (l1tf_mitigation != L1TF_MITIGATION_OFF && + e820__mapped_any(half_pa, ULLONG_MAX - half_pa, E820_TYPE_RAM)) { pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n"); pr_info("You may make it effective by booting the kernel with mem=%llu parameter.\n", half_pa); --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -890,7 +890,7 @@ unsigned long max_swapfile_size(void) pages = generic_max_swapfile_size(); - if (boot_cpu_has_bug(X86_BUG_L1TF)) { + if (boot_cpu_has_bug(X86_BUG_L1TF) && l1tf_mitigation != L1TF_MITIGATION_OFF) { /* Limit the swap file size to MAX_PA/2 for L1TF workaround */ unsigned long long l1tf_limit = l1tf_pfn_limit(); /*