Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3988605ybg; Fri, 25 Oct 2019 11:44:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQfQqzwiRgynipOpRv6RwyH/rAoKh6Q9U8MSLCsQ5ut4npX1PlhMEtQqgbxVj+exakqBWM X-Received: by 2002:a50:cbc2:: with SMTP id l2mr5709379edi.304.1572029061897; Fri, 25 Oct 2019 11:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572029061; cv=none; d=google.com; s=arc-20160816; b=V5+1j1jqPIxyqwgmohtUU8Wbml/pbtaZzcqDYGhzMQopzgUDtqO3kTEQ9HBFdkk2OG FXzrprieT4xadgV3U2gGe760II9IrndMuU/TNFHR7+sgRDY0dGsxrmFVmTTcUHkweFgh I6S+BoU3YgWpg5uZ9qD9dKqwqg+5UzWvQB+7AJRQcAm+MwEJxAt9oxvrQZrtMzGBm7sp QaSNhMKflt3Dw3Vm04bdeHzxboIo4GZ9X9pLpyxM9ZhdAupdbfZQQa1U2o1hgu4XTobP AyyMNe6HX5OTRjPwzzOpDSuB56QD5WaabbwcvbPm0B2L7nGlFo2HEYzj3z75I3waTwKk xkcQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=hGQbFOEkQFyCy0U41zGhn7pQEikaBMfg60zJuN/yD6g=; b=gSV/jxr/63Ekv2ZXGzw5+P3INBuxFZNpIvVVwYBbhA9y3q24On802RwuGtq/dGFQfJ lzDQDVGIsrXQWmVYo9/bSsNdfRf3SXC0iL2vYctSoqPC706NxvEXuUzGMHAwJ8U6K5tm C7idJoujgGWUN1jGqxm6BW32V2E0G3NFFAt3uV3jn1fYQ2JZbxZXnCogOs1ODTHzN+Ds PSeY96eOPyJ7RdQB5uCO5QB1ZqW7bq8LQ3IRJLyMXpJMVYAwLo8q/GaSV9xSloME9Flv fH8HjHC1wa1uGndwXolYKtIrtsbQZzVfkQvEyyy+BCLuhhomxD6WCb18pj1TACcfVjVl Feow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NM5QxTW7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si1814874ejc.218.2019.10.25.11.43.49; Fri, 25 Oct 2019 11:44:21 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=NM5QxTW7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410063AbfJXROg (ORCPT + 99 others); Thu, 24 Oct 2019 13:14:36 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39069 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405901AbfJXROg (ORCPT ); Thu, 24 Oct 2019 13:14:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571937274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hGQbFOEkQFyCy0U41zGhn7pQEikaBMfg60zJuN/yD6g=; b=NM5QxTW7k8mCQGulRevRSDck/NKS5DUB6md7Gfd/gLrLjVq+QAu2MySRXT/ocCHwVpb5XP l42wSEMcyfD5FbpZ65KT51BgWaGhLhop7KIwhjUfbTPpedw3tjHN4XkZWHuV4iNHUDhT7S DtCbBb475dFqF99AEJj66sHg/GkaCiA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-rg3A0xWPPUS5FssTmyfhbw-1; Thu, 24 Oct 2019 13:14:32 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A008C800D49; Thu, 24 Oct 2019 17:14:31 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-89.pek2.redhat.com [10.72.12.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id AECCD10027BF; Thu, 24 Oct 2019 17:14:25 +0000 (UTC) From: Kairui Song To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Thomas Lendacky , Baoquan He , Dave Young , x86@kernel.org, Kairui Song Subject: [PATCH] x86/kdump: Print a notice if SME/SEV is active on crash reservation Date: Fri, 25 Oct 2019 01:14:17 +0800 Message-Id: <20191024171417.14175-1-kasong@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: rg3A0xWPPUS5FssTmyfhbw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SME/SEV requires SWIOTLB to be force enabled in both first kernel and kdump kernel, the detail is covered in following 3 commits: - commit c7753208a94c ("x86, swiotlb: Add memory encryption support") force enables SWIOTLB when SME is active, even if there is less than 4G of memory, to support DMA of devices that not support address with the encrypt bit. - commit aba2d9a6385a ("iommu/amd: Do not disable SWIOTLB if SME is active"= ) kernel keep SWIOTLB enabled even if there is an IOMMU, to support special devices that IOMMU can't handle. - commit d7b417fa08d1 ("x86/mm: Add DMA support for SEV memory encryption") force enables SWIOTLB when SEV is active unconditionally. Force enabling SWIOTLB in kdump kernel will make it easily run out of already scarce pre-reserved crashkernel memory. The crashkernel value is user specified, and kernel should respect the given value to make the behavior clear and controllable. And currently there is no way kernel could estimate the crashkernel value after all. So when SME/SEV is active, just print a notice to let the user know the situation and adjust the crashkernel value accordingly. Suppress the notice if high reservation is used, as high reservation will always reserve a dedicated low memory region which will cover the SWIOTLB. Signed-off-by: Kairui Song --- arch/x86/kernel/setup.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 77ea96b794bd..d5ceea03c0a3 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -594,6 +594,13 @@ static void __init reserve_crashkernel(void) =09=09return; =09} =20 +=09if (crash_base < (1ULL << 32) && mem_encrypt_active()) { +=09=09pr_notice("Memory encrytion is active, SWIOTLB is required to work,\= n" +=09=09=09 "%luMB of low crash memory will be consumed by it.\n" +=09=09=09 "Please ensure crashkernel value is large enough.\n", +=09=09=09 (ALIGN(swiotlb_size_or_default(), SZ_1M) >> 20)); +=09} + =09pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM= : %ldMB)\n", =09=09(unsigned long)(crash_size >> 20), =09=09(unsigned long)(crash_base >> 20), --=20 2.21.0