Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1054653yba; Sat, 20 Apr 2019 20:58:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLaxr1hkPkXGSWcGshqgafhx4OozIiS54amJWdUtpoA2E36jzZVZZ0v5t2kN5LW6625PQB X-Received: by 2002:aa7:87c5:: with SMTP id i5mr13195329pfo.20.1555819093002; Sat, 20 Apr 2019 20:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555819092; cv=none; d=google.com; s=arc-20160816; b=Ic2D/Z8O7cwJ4zwKEl1n+/5oDYupzf3T9JFR9inrbuLFYU+4oW8gJK4B7QFBKA5Qrm aN3MSF6sOXD7jH3oRnlK+fmgGlfV4zluxr0gmPDQc5b+y8KfxazP0nuhWXmhNiyAyuza 2tCMW9+hUPh21Fm5U+3RHaAqZUEP0/wFIeFw6zyf+V5AQkJpFL/JuyE3zy56vgXBCriv +G9EazBlM+46AoL1T2pJHrYWB0JFVuHNWn00DOtW4nL+V9TOnsmAY1IscDIGut+LkkJk ly4+MjG9tyHhDzF5LkEIxTVArxlYjl0b9pJQijs3PxRLMnoWCzaxIFI5ztJ09gtYyac/ MD+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:to:from :date:user-agent:message-id; bh=2t+FK3uZDNs4cWj9PxLkSTGEU8Ly0E7LsuvQjRuhxlE=; b=W0IRDj6FV7Is/1cocyTSOgU7cm0ABQVJsxclHUXkiZAYt+tw1AcfeoFSBXHc0vO9AR 6bRdjDLOdKgq1e3i5+riFZUicstVuXoQjnA5l9xwrrPyasUCCPOj0yFhLWqQhGPiM0bb FGS0PKgbxqo4CfPPfS3hljo4hfup3S3GNh44gxRrbbh5Yy5Xbxhtq7CO6ZKanlCfh21M KfsTFO77U/fQTlD3JaT3bDKBnKCPPjZSyFRtlPuQ1pPz6rl19266o6Cxp4fhIcgRtuRy sJts1Gu5UcGprSiwS//jlKu0t50+8NhSaAFFPHemTtBNuLBCJ+AgsMJ1y71BO7VByvyE g+HQ== 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; dmarc=fail (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 i1si8955477pgb.322.2019.04.20.20.57.57; Sat, 20 Apr 2019 20:58:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726542AbfDUDz4 (ORCPT + 99 others); Sat, 20 Apr 2019 23:55:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfDUDzz (ORCPT ); Sat, 20 Apr 2019 23:55:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3918C37EEF; Sun, 21 Apr 2019 03:55:55 +0000 (UTC) Received: from localhost (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B6E15D9C9; Sun, 21 Apr 2019 03:55:53 +0000 (UTC) X-Mailbox-Line: From dyoung@redhat.com Sun Apr 21 11:53:03 2019 Message-ID: <20190421035303.669870129@redhat.com> User-Agent: quilt/0.66 Date: Sun, 21 Apr 2019 11:51:00 +0800 From: Dave Young To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, vgoyal@redhat.com, bhe@redhat.com, piliu@redhat.com, Yinghai Lu , Eric Biederman Subject: [PATCH 2/2] X86/kdump: fall back to reserve high crashkernel memory References: <20190421035058.943630505@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 21 Apr 2019 03:55:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org crashkernel=xM tries to reserve crashkernel memory under 4G, which is enough for usual cases. But this could fail sometimes, for example one tries to reserve a big chunk like 2G, it is possible to fail. So let the crashkernel=xM just fall back to use high memory in case it fails to find a suitable low range. Do not set the ,high as default because it allocs extra low memory for DMA buffers and swiotlb, this is not always necessary for all machines. Typically like crashkernel=128M usually work with low reservation under 4G, so still keep <4G as default. Signed-off-by: Dave Young --- Documentation/admin-guide/kernel-parameters.txt | 7 +++++-- arch/x86/kernel/setup.c | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) --- linux-x86.orig/arch/x86/kernel/setup.c +++ linux-x86/arch/x86/kernel/setup.c @@ -541,21 +541,27 @@ static void __init reserve_crashkernel(v } /* 0 means: find the address automatically */ - if (crash_base <= 0) { + if (!crash_base) { /* * Set CRASH_ADDR_LOW_MAX upper bound for crash memory, - * as old kexec-tools loads bzImage below that, unless - * "crashkernel=size[KMG],high" is specified. + * as crashkernel=x,high allocs memory over 4G, also allocs + * 256M extra low memory for DMA buffers and swiotlb. + * but the extra memory is not required for all machines. + * So prefer low memory first, and fallback to high memory + * unless "crashkernel=size[KMG],high" is specified. */ - crash_base = memblock_find_in_range(CRASH_ALIGN, - high ? CRASH_ADDR_HIGH_MAX - : CRASH_ADDR_LOW_MAX, - crash_size, CRASH_ALIGN); + if (!high) + crash_base = memblock_find_in_range(CRASH_ALIGN, + CRASH_ADDR_LOW_MAX, + crash_size, CRASH_ALIGN); + if (!crash_base) + crash_base = memblock_find_in_range(CRASH_ALIGN, + CRASH_ADDR_HIGH_MAX, + crash_size, CRASH_ALIGN); if (!crash_base) { pr_info("crashkernel reservation failed - No suitable area found.\n"); return; } - } else { unsigned long long start; --- linux-x86.orig/Documentation/admin-guide/kernel-parameters.txt +++ linux-x86/Documentation/admin-guide/kernel-parameters.txt @@ -704,8 +704,11 @@ upon panic. This parameter reserves the physical memory region [offset, offset + size] for that kernel image. If '@offset' is omitted, then a suitable offset - is selected automatically. Check - Documentation/kdump/kdump.txt for further details. + is selected automatically. + [KNL, x86_64] select a region under 4G first, and + fallback to reserve region above 4G in case without + '@offset'. + See Documentation/kdump/kdump.txt for further details. crashkernel=range1:size1[,range2:size2,...][@offset] [KNL] Same as above, but depends on the memory