Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5933584imu; Sun, 20 Jan 2019 23:46:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN5n/zxFFqCfCrvqbv2B1mTTFZ3mv5le9JK9Z08uw6Q7d6UwnR+xQraDB7OUGxwfOXXxeJgX X-Received: by 2002:a17:902:d68c:: with SMTP id v12mr28867211ply.4.1548056767614; Sun, 20 Jan 2019 23:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548056767; cv=none; d=google.com; s=arc-20160816; b=H/qf4KcsgBAIHZIufn4CF93aAr1CiI8LYyOblL10d1ROQmr1VZZIIx9wG8ReK56JfS j3m+f72vfJOrWi+ZVjpMENy20fq/WN8F3o1xa9cNwUXc88WOsAQR4dCtsFyt1jrh7+dk cZryjuGNiq6zZ6iomhndAQlV6gMIJwkZG05buEdEZdVaozLzGPBw16dEa7a9uCoQ/dEp UfRZWKFrhTGVUYkzP0NN7894sETpfIqubnz0v+mYCkIY83fmKU+ECLCDG+jOICx1OoSH WM6rDRxueH6hPND/RpLQpX0vko6e0SLKAxZPAk3miIfdnRRUeiWmcLZ1DNEvWXM8GfS5 x8cA== 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=+zYMFVV8ERB4bO711QH6AoLQHXvL/uDPdZ3A+XrMdzg=; b=flmvm9EBTqUBzD0EXbUJhHxLszWYK5FC/+5S6n+ZXM0ZVtDaeM5lgPy+BzBcaYbc4W 6M3CruZahSmZEnEtrl6XkpnJ6OxY2G5Rb6sDg0h5tJbLASonW3Wc/ZbquGZZJ0xSoi2j LWqEV1FlSKsbqkT/EZ/a2ZdYX1ZcgSC3wR0XnYe9MVXOWCXrairkt98Yd4o3vtmb/8OF My92ZPRhESbHF1Tqvi8R4ok9mzYqmybITi7gHSF2ylscESa29+/98BFZfwNdBfY2wioU YjMf9rLUMpDUITmTjHF0QqFelkQ9TBMCPLoJb4yv8dafXf6MOeuMfwPGk6NYopVjgCAs PY7A== 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 26si9244289pgu.190.2019.01.20.23.45.52; Sun, 20 Jan 2019 23:46:07 -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; 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 S1728923AbfAUHn4 (ORCPT + 99 others); Mon, 21 Jan 2019 02:43:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39024 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfAUHnz (ORCPT ); Mon, 21 Jan 2019 02:43:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23DAF811D3; Mon, 21 Jan 2019 06:24:42 +0000 (UTC) Received: from localhost (ovpn-12-168.pek2.redhat.com [10.72.12.168]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E70C5D6AA; Mon, 21 Jan 2019 06:24:38 +0000 (UTC) Date: Mon, 21 Jan 2019 14:24:35 +0800 From: Baoquan He To: Pingfan Liu Cc: kexec@lists.infradead.org, Dave Young , Andrew Morton , Mike Rapoport , yinghai@kernel.org, vgoyal@redhat.com, Randy Dunlap , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv7] x86/kdump: bugfix, make the behavior of crashkernel=X consistent with kaslr Message-ID: <20190121062435.GA23371@MiWiFi-R3L-srv> References: <1548047768-7656-1-git-send-email-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1548047768-7656-1-git-send-email-kernelfans@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 21 Jan 2019 06:24:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/21/19 at 01:16pm, Pingfan Liu wrote: > People reported crashkernel=384M reservation failed on a high end server > with KASLR enabled. In that case there is enough free memory under 896M > but crashkernel reservation still fails intermittently. > > The situation is crashkernel reservation code only finds free region under > 896 MB with 128M aligned in case no ',high' being used. And KASLR could > break the first 896M into several parts randomly thus the failure happens. > User has no way to predict and make sure crashkernel=xM working unless > he/she use 'crashkernel=xM,high'. Since 'crashkernel=xM' is the most > common use case this issue is a serious bug. > > And we can't answer questions raised from customer: > 1) why it doesn't succeed to reserve 896 MB; > 2) what's wrong with memory region under 4G; > 3) why I have to add ',high', I only require 384 MB, not 3840 MB. > > This patch tries to get memory region from 896 MB firstly, then [896MB,4G], > finally above 4G. > > Dave Young sent the original post, and I just re-post it with commit log > improvement as his requirement. > http://lists.infradead.org/pipermail/kexec/2017-October/019571.html > There was an old discussion below (previously posted by Chao Wang): > https://lkml.org/lkml/2013/10/15/601 > > Signed-off-by: Pingfan Liu > Cc: Dave Young > Cc: Baoquan He > Cc: Andrew Morton > Cc: Mike Rapoport > Cc: yinghai@kernel.org, > Cc: vgoyal@redhat.com > Cc: Randy Dunlap > Cc: Borislav Petkov > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org Looks good, ack. Acked-by: Baoquan He Thanks Baoquan > --- > v6 -> v7: commit log improvement > arch/x86/kernel/setup.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index 3d872a5..fa62c81 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -551,6 +551,22 @@ static void __init reserve_crashkernel(void) > high ? CRASH_ADDR_HIGH_MAX > : CRASH_ADDR_LOW_MAX, > crash_size, CRASH_ALIGN); > +#ifdef CONFIG_X86_64 > + /* > + * crashkernel=X reserve below 896M fails? Try below 4G > + */ > + if (!high && !crash_base) > + crash_base = memblock_find_in_range(CRASH_ALIGN, > + (1ULL << 32), > + crash_size, CRASH_ALIGN); > + /* > + * crashkernel=X reserve below 4G fails? Try MAXMEM > + */ > + if (!high && !crash_base) > + crash_base = memblock_find_in_range(CRASH_ALIGN, > + CRASH_ADDR_HIGH_MAX, > + crash_size, CRASH_ALIGN); > +#endif > if (!crash_base) { > pr_info("crashkernel reservation failed - No suitable area found.\n"); > return; > -- > 2.7.4 >