Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1962474yba; Sun, 21 Apr 2019 20:04:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfqlkBP/DR2p01RWWEZhuRgDySfoKvsDg5tpDzRbzqE13ofzDeTzmG+a09t7Ybsuw4tzsX X-Received: by 2002:a17:902:380c:: with SMTP id l12mr17655639plc.320.1555902266055; Sun, 21 Apr 2019 20:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555902266; cv=none; d=google.com; s=arc-20160816; b=YmX16JMU288payqokc4+bTymUUeLTJmxMcftau6nrwXGsuSXdrPmCRtovJEVoFneFJ xvKmG4QCTtbwqI7aJZIDzOelioTiW5kUxqkLknWGL0l+K0aNjz9ByAz4T80mJDrVGnvD rqE1ElMRVL1sLBOaZw7/lfgP8cvB0ULiQb7ctT3O0RFDwzTguV1EhdqJ4R2EWtRHh2Ab QaaoWBgPUnkNir0ws31YQhrgc9QUjFmV6GQ8ey/KMlGz/GOyuA8WE7MUBTkzHqhfPo+B KYCFUvPalwIR/zhlfonHt1/DEoPggd/HMC80rI/NW1ZFtdf6Jf19TRZacYRsZzawyUot i+oQ== 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; bh=mcoElZYpJF4cNyLFyu+juGSUeM+L9hFVNGOoCrQeevg=; b=GO1QEaGNJkGAR/1FF6GZq7uAsQWQicBa783gUWGY4pmVUsiG/Nk/ZHlvEIotsYeiO4 YdjUGU6Pj6bGZ7VI8f16sioicEqI5eFLC3LjbRMi6jaaqsSNC/4cmWtNHpCEBcUG404U 3+snZI3BT64ROzvGX5gzgnbL3XYzw4ZdbhrcsxAbNpPbR9tP1Jnaiok3PDluFv8N1IPh wiEKshoRWVasMQevc4lg6qJaijLcj0Wzeq2WKymJnPGpxj7LJzoMVZP102MQ8E9iZCT8 xUbtUZpuaVOPl8plTVMUGUSBnpdwmUG9V/Pape253m+XqEhDW4H8DM1Te//5IqvQAR1i 1PgA== 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 c29si2112975pgl.519.2019.04.21.20.04.11; Sun, 21 Apr 2019 20:04:26 -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 S1726309AbfDVDDQ (ORCPT + 99 others); Sun, 21 Apr 2019 23:03:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43496 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfDVDDP (ORCPT ); Sun, 21 Apr 2019 23:03:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E27A8882FD; Mon, 22 Apr 2019 03:03:14 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-124.pek2.redhat.com [10.72.12.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 008CF61B6D; Mon, 22 Apr 2019 03:03:08 +0000 (UTC) Date: Mon, 22 Apr 2019 11:03:04 +0800 From: Dave Young To: Ingo Molnar 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: <20190422030304.GA8216@dhcp-128-65.nay.redhat.com> References: <20190421035058.943630505@redhat.com> <20190421035303.669870129@redhat.com> <20190421182608.GC35603@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190421182608.GC35603@gmail.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 22 Apr 2019 03:03:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/21/19 at 08:26pm, Ingo Molnar wrote: > > * 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 for review, will reply to 2/2 with an update of those spelling issues. Dave