Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6838227imu; Thu, 27 Dec 2018 07:24:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN4gpQudfMF6CVd1p+tCJ05hlJHwWBQOmQVL8lT+Nw6NTUPUtlMVnpmzR0DsENvJXxHdbDeW X-Received: by 2002:a62:55c4:: with SMTP id j187mr24425011pfb.129.1545924264041; Thu, 27 Dec 2018 07:24:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545924264; cv=none; d=google.com; s=arc-20160816; b=unHtELM6wdzQkw/PzcJoHZg1911f70wpenmHiVPAAKs3OFJoy1CDCvRC1tODa3+j4G HBKIpCzyHZoKj7VRJKf3RmVqE3S1LmSd6Ld8MfTxOam3zsMGk/oOK+sPkrhEEdO2H4M1 zjIlEZ1l1PR+akOFXEtzM34p6Woo5uo+ncMYdl0nS8RCNqWBzPpclFJDIYz0ClZzwmy2 O/0mvQeAe2bV8VO7lnsZp7+8X/eVAHweL7X6n96eQH8SbsvFBy0qxseqJnYzuqjocfH+ +Uy0r30AvXpH+w6/33gUbyKbm5pMFK7xBBM4UTz/XId1N5Il27JPVE0Con6TnA0P19GU 3Tqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kKQTIZOHtW8ffxErHOxVgcrRWqvLiNdZTXKdv5GszKU=; b=TRRRnrEqzNQIs9Sf6Yi/NBMuh9oQJN5/P/Dp5CTK7VOFL1RPaGBRGafHi1dyYKSpRa fXSVCz8gLcZ419m71k+N/fyWgE9aT7Wdd9ectbgcXBkZJxsiqKxs7T6TBXq7T50F/rrl keLch3IEIbTPcuufLbW5cwJ7LlQBo3JDS0jaUbydLwCXnAmbRcKbRapuwpshRk6oxJwZ WrvLE8+kQtz4lyNfIrT6CToYtqIfjtbk3P8d+XKdVZxEsXBN2sOFZ9PHHEMPIb0MJ+7K m8o0PFCNrVuUeZPGZznoOkgC6rv7gNAxStm+qGP1EaNIP/Q9vVW5D4VQD/CRYOcUCpWB gFcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H+2m4e4d; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8si14698126pgm.467.2018.12.27.07.24.08; Thu, 27 Dec 2018 07:24:24 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H+2m4e4d; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728347AbeL0C5k (ORCPT + 99 others); Wed, 26 Dec 2018 21:57:40 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36078 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726720AbeL0C5j (ORCPT ); Wed, 26 Dec 2018 21:57:39 -0500 Received: by mail-ed1-f68.google.com with SMTP id f23so14322412edb.3 for ; Wed, 26 Dec 2018 18:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kKQTIZOHtW8ffxErHOxVgcrRWqvLiNdZTXKdv5GszKU=; b=H+2m4e4dUs2NStwlS0hNRqDW2kNZIKr0QiDZbzwa7QrQDDrGpHrDHp0zQMhgOA3mZa vmXbW+d9hrltuJFXIAoxcrAQ7k5Rs9FPmL8tRs60/9A5mqcqBuRb848DMy+7p+knRDTc WBt4SZJjIWQ/ECMFPaWUYCj7a8GEWe7TcPDFikUgtNSTI6Fy1ohNNCxUXNsYVcyXrjzt QZA/i4iqHnNd5fwrtUlZri1s8OcbTRosZ6gC9m/LSHOPBhe3Ecb3QAU0LYBsMfzv9Aqa SpdW72rhHFiXcIVQ0NbiqmkAa6q5Wx/CfUsZmtfAFym8UUtaLaFuvf8DG6tF4zZk9Jjo 5ltw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kKQTIZOHtW8ffxErHOxVgcrRWqvLiNdZTXKdv5GszKU=; b=jyvzMPgco1q8TNAXkz1PzIlr5Fc8jefNKYuhaUmdMffnuLToO+rBR9eqmspYc+3zn8 XnYPS5G9lbVJSmTnwLuJUATUhPC/W6FlzfieY6gO7HRtqMyuYq/KGvKhQoO59ufQmQ0L RlWaUFbszfcaXihsAteI2pUG7tjatc9qN4YZNMjM84suDL/Sv7nddIFN5Ajd7/ulUvx2 6OBzjEeOWpWzvGxf+7uj5YN/nvDkRCKtvdWVqwWFBIjRUuPR+JvDNIASeKglKVdhl6U1 wKYaKHYo5Lol7oKoGRDzGGEPFtdisKJSZ+zGZSC5IMNPrerPUyQMlHQ3fIJQmDHRY772 +9hQ== X-Gm-Message-State: AA+aEWYBGWEO2xjv03Y+42ueDUUQ6+gvncZNUHftA7sRMTmxrTvjlZY4 VAYe7c10pD5ZvVYAdkNNnwCtTO4UXmJyufNphg== X-Received: by 2002:a17:906:2acf:: with SMTP id m15-v6mr14416497eje.180.1545879457523; Wed, 26 Dec 2018 18:57:37 -0800 (PST) MIME-Version: 1.0 References: <1544760446-506-1-git-send-email-kernelfans@gmail.com> <20181226014701.GD11472@dhcp-128-65.nay.redhat.com> In-Reply-To: <20181226014701.GD11472@dhcp-128-65.nay.redhat.com> From: Pingfan Liu Date: Thu, 27 Dec 2018 10:57:26 +0800 Message-ID: Subject: Re: [PATCHv2] x86/kdump: bugfix, make the behavior of crashkernel=X consistent with kaslr To: Dave Young Cc: linux-kernel@vger.kernel.org, Baoquan He , kexec@lists.infradead.org, Andrew Morton , yinghai@kernel.org, vgoyal@redhat.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 26, 2018 at 9:47 AM Dave Young wrote: > > On 12/14/18 at 12:07pm, Pingfan Liu wrote: > > Customer reported a bug on a high end server with many pcie devices, where > > kernel bootup with crashkernel=384M, and kaslr is enabled. Even > > though we still see much memory under 896 MB, the finding still failed > > intermittently. Because currently we can only find region under 896 MB, > > if w/0 ',high' specified. Then KASLR breaks 896 MB into several parts > > randomly, and crashkernel reservation need be aligned to 128 MB, that's > > why failure is found. It raises confusion to the end user that sometimes > > crashkernel=X works while sometimes fails. > > If want to make it succeed, customer can change kernel option to > > "crashkernel=384M, high". Just this give "crashkernel=xx@yy" a very > > limited space to behave even though its grammer looks more generic. > > And we can't answer questions raised from customer that confidently: > > 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 simplifies the method suggested in the mail [1]. It just goes > > bottom-up to find a candidate region for crashkernel. The bottom-up may be > > better compatible with the old reservation style, i.e. still want to get > > memory region from 896 MB firstly, then [896 MB, 4G], finally above 4G. > > > > There is one trivial thing about the compatibility with old kexec-tools: > > if the reserved region is above 896M, then old tool will fail to load > > bzImage. But without this patch, the old tool also fail since there is no > > memory below 896M can be reserved for crashkernel. > > > > [1]: http://lists.infradead.org/pipermail/kexec/2017-October/019571.html > > Signed-off-by: Pingfan Liu > > Cc: Dave Young > > Cc: Andrew Morton > > Cc: Baoquan He > > Cc: yinghai@kernel.org, > > Cc: vgoyal@redhat.com > > Cc: kexec@lists.infradead.org > > > > --- > > v1->v2: > > improve commit log > > arch/x86/kernel/setup.c | 9 ++++++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > index d494b9b..60f12c4 100644 > > --- a/arch/x86/kernel/setup.c > > +++ b/arch/x86/kernel/setup.c > > @@ -541,15 +541,18 @@ static void __init reserve_crashkernel(void) > > > > /* 0 means: find the address automatically */ > > if (crash_base <= 0) { > > + if (!memblock_bottom_up()) > > + memblock_set_bottom_up(true); > > /* > > * 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. > > */ > > crash_base = memblock_find_in_range(CRASH_ALIGN, > > - high ? CRASH_ADDR_HIGH_MAX > > - : CRASH_ADDR_LOW_MAX, > > - crash_size, CRASH_ALIGN); > > + (max_pfn * PAGE_SIZE), crash_size, CRASH_ALIGN); > > + if (!memblock_bottom_up()) > > + memblock_set_bottom_up(false); > > The previous memblock_set_bottom_up(true) set it as true, so > "!memblock_bottom_up()" is impossible, not sure what is the point of > this condition check. > > Do you want to restore the original memblock direction? If so a variable > to save the old direction is needed. But is this really necessary? > Do you know any side effects of setting the bottom up as true? > Yes, will fix it. Thanks > > + > > if (!crash_base) { > > pr_info("crashkernel reservation failed - No suitable area found.\n"); > > return; > > -- > > 2.7.4 > > > > > > _______________________________________________ > > kexec mailing list > > kexec@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/kexec > > Thanks > Dave