Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1634675yba; Sun, 21 Apr 2019 11:28:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzARasUqjYuMDv32Zqy7BVpYD6DhpAgH3qRbLlnXX7oz06CxOYZToUAXsNrjiv3rtXNDzGs X-Received: by 2002:a65:500d:: with SMTP id f13mr15592468pgo.250.1555871289631; Sun, 21 Apr 2019 11:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555871289; cv=none; d=google.com; s=arc-20160816; b=cTCkzW5wRAr8Ic1uMvrJcSIASZiiDhWnHQNucjovaveToMbGESWu2PJIw5/f4YRqOG teAstOiPnxH69IVS2RNfes/dDpUDlJD056oJud/WQLlvPJz96DNKE13w2jmhBm73sG3U 9b/JipmyuauXjaK3cIfmUDjzgAzGAgZK+z90mji8KtS8u6Go+pb/yVycHU2svEdFRMzh PZPOH0ynbV104UrXntfI88LOcDQ6LYWeLKCtnzlki53GWmk5ybQWUlqZHGg0g1svqKve rIvxavEEmr56/eVVOFLBKrwR4Oxd3wm+uRuZKXn0rnKBeeuNWAew4b0NgEGyKQ2W1I5w u1FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qmMH9Uez5kEH3yFVlw0XLwgWbj3HZM5kKJKPlYG01uY=; b=L+nXaYh/JgkbZEz05H8E4yK9I/MW1ufoDzXka59gV5lU0u+WHM17uLA+g6YnbrpPK/ ZryjSnqUk+Ha5QyAJnrAd27Td5Ki3DRWu84to75VixYgz7eHJqu+273pyCwFoWJPnEnm Ljbz6U94iXvNi2IuJyNzEeEcrCwFYOl4+FinCIAvXPxPOJt8U+NG/RFiLvmSmcfwNsO8 bUOd0cZOqPQH0PiWZYKK/lHywUICGT82fgOsaysS3ctkWlAahJmPZug39ZBc5K7WRpPF vju28J60Jd3STR7bs12x1UOcZvJkO+v4eDasIz0tgOx7xlPI56YwD1GikN+9LtuntHwt nwxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kDglwq1C; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si10300908pgi.60.2019.04.21.11.27.54; Sun, 21 Apr 2019 11:28:09 -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=fail header.i=@gmail.com header.s=20161025 header.b=kDglwq1C; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726552AbfDUS0N (ORCPT + 99 others); Sun, 21 Apr 2019 14:26:13 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40993 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDUS0N (ORCPT ); Sun, 21 Apr 2019 14:26:13 -0400 Received: by mail-wr1-f67.google.com with SMTP id c12so7214646wrt.8 for ; Sun, 21 Apr 2019 11:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qmMH9Uez5kEH3yFVlw0XLwgWbj3HZM5kKJKPlYG01uY=; b=kDglwq1C1tr5SA4mdDW7xvcv91ew4UFrJgi1lacfoyi/OJ4I3Gg+jSfRNDYxBHiqJM 0lh+GqYF1JFCqg7bkobS19FbHVpeEreGmTKAZd2Dix0tQzUuCsj599kid/e+uD/aqmAr lKed5Z3g3qqLqAcxSF9VYoIMVjCc+sZFaEEa1Lj1Bnw8q42Wmbsq2cmH5epqWPLCoSL0 JLoWCtWduH5L4sMIMEUhu7y64ThT2ZVpS5EOw1ZFCnroryspZQB1zsmVqxy7s1yszG47 rIaWvjBgW8VFAuYQXGU6KpMSF5CwFGiy9IoaUntL+j03Yj3drAOoS1tOw8DUAVZOzNKH kUPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=qmMH9Uez5kEH3yFVlw0XLwgWbj3HZM5kKJKPlYG01uY=; b=tx7e4HBRw8oCIjBTMBSktIcyJn3/44VsxnVseQ3Y8TUWkIdhi3Iv1Ej6PAGp4YHTMo gdAISoUSyX1n3vnhOgg8qvOeGFVEEz6CIWIymDLpJ9c4lRZ1nVcHDRW6t2FGxMx1e/AD MOcyPSkxmaalUFpJNHYKanlW58ozQOwmEvGaZPzJiMyU7Pzc06Stm1rd323CcweptZS7 iwRMTazdlR0Xs5wq0H98vrNBJ2w55/XQ9XL2Hj085RUolLDp3J2u4wk7bHhPXvFMmH+b zl65o5r/ELR5FxfY8OfD+0CtbBggUZi3MXMnXIC9so+aIYkApdJlc1nU0ocyOlRfo3Y5 wm4Q== X-Gm-Message-State: APjAAAUoE7D+XgYyQM5SmbK7jxDqiJI4QH2JTUN67QD497avnAOrLg5N agWiEL4McyyYeNz7LzsYKSU= X-Received: by 2002:adf:f802:: with SMTP id s2mr10142919wrp.274.1555871171362; Sun, 21 Apr 2019 11:26:11 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id v190sm11119331wme.18.2019.04.21.11.26.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Apr 2019 11:26:10 -0700 (PDT) Date: Sun, 21 Apr 2019 20:26:08 +0200 From: Ingo Molnar To: Dave Young Cc: 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: Re: [PATCH 2/2] X86/kdump: fall back to reserve high crashkernel memory Message-ID: <20190421182608.GC35603@gmail.com> References: <20190421035058.943630505@redhat.com> <20190421035303.669870129@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190421035303.669870129@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Dave Young wrote: > 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 s/allocs /allocates > + * 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 s/fallback /fall back > + * 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 s/fallback /fall back > + '@offset'. > + See Documentation/kdump/kdump.txt for further details. > > crashkernel=range1:size1[,range2:size2,...][@offset] > [KNL] Same as above, but depends on the memory With the nits fixed: Reviewed-by: Ingo Molnar Thanks, Ingo