From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B92E3C433B4 for ; Fri, 7 May 2021 08:16:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0590C6145E for ; Fri, 7 May 2021 08:16:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0590C6145E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F3BD28D0002; Fri, 7 May 2021 04:16:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F12606B00A4; Fri, 7 May 2021 04:16:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D78858D0002; Fri, 7 May 2021 04:16:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BA39E6B00A3 for ; Fri, 7 May 2021 04:16:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7B47F12FD for ; Fri, 7 May 2021 08:16:23 +0000 (UTC) X-FDA: 78113727846.01.E03588E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 72E46C0007CE for ; Fri, 7 May 2021 08:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620375382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QU5nPCq4OJAv/v6RLOBfbWfNHLCkuq3W/8oOHWi1GtM=; b=M1HOlb1Ur2WxxzC8SeQeQpGPD5syYFhRu2JQt2nHD+Dy49LL25rDSWYc+OnLWreS88/JCH gpi7L/lflFt4F/7t9gHfNFpfopitXJ5oQX8pUZkAql5bl75RggUzw6YfcvCU4xxZqL/l+C cT2vx4g6tDGDcEoUus2WbQBIMDlhAfg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-5cmzFSy2McSr3rf1apMO3w-1; Fri, 07 May 2021 04:16:14 -0400 X-MC-Unique: 5cmzFSy2McSr3rf1apMO3w-1 Received: by mail-wr1-f69.google.com with SMTP id 91-20020adf94640000b029010b019075afso3241313wrq.17 for ; Fri, 07 May 2021 01:16:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=QU5nPCq4OJAv/v6RLOBfbWfNHLCkuq3W/8oOHWi1GtM=; b=YnkV12YoDGAXwO3QhKBnhXbbkH5nJLoyW3n+iVEPixg0Q49pi774uNvF4K+UsxVGSQ cFydns32kiyisMfjjqRErMKqHETDt3g5gyojnP1Glxk1wBiU/QVPs3uNKw0pJW7IR49Y t0fFsmvbJFdxv2wLv6LcUYpJ1Jx0B0dvDlQfuPWzIWFVBTAXMaJiZb6MXxOV0kGhlNjM 43q4AuGjh4x0fKoEvYR8pPKD7eKrbvI+02jyI7ovWQyx/91V3A2IvrFWc7SqWbp4MXHv eMe5o1XvIkHLN38z5nK0MMEXoU44lGblByDphaV4P1leqXEOlAznBAAGlPSfDIOyuPd4 LJQg== X-Gm-Message-State: AOAM5328LU5bwsJQEgi5NDoVPO6MML7GJTuUC3RnaNKF2G4bJ1XHlSCz PJMdWjjW/S18OeqPBiPtohY0eCXsIxmsPKjPlj8PowUAj5dL5MY0rYyniv04srOs7/d0TLqDun1 qyNn3JK4q43o= X-Received: by 2002:a5d:5989:: with SMTP id n9mr10510561wri.60.1620375372865; Fri, 07 May 2021 01:16:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPwlxwGpKSwux7xmomYJp4AJrLdLT8b/gkgFSV2749Azw5aIolat5m1b3QUnWYput7V6ffpg== X-Received: by 2002:a5d:5989:: with SMTP id n9mr10510515wri.60.1620375372610; Fri, 07 May 2021 01:16:12 -0700 (PDT) Received: from [192.168.3.132] (p5b0c63c0.dip0.t-ipconnect.de. [91.12.99.192]) by smtp.gmail.com with ESMTPSA id b6sm12050107wmj.2.2021.05.07.01.16.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 May 2021 01:16:12 -0700 (PDT) To: Andrew Morton , andreyknvl@google.com, bhe@redhat.com, christian.brauner@ubuntu.com, colin.king@canonical.com, corbet@lwn.net, dyoung@redhat.com, frederic@kernel.org, gpiccoli@canonical.com, john.p.donnelly@oracle.com, jpoimboe@redhat.com, keescook@chromium.org, linux-mm@kvack.org, masahiroy@kernel.org, mchehab+huawei@kernel.org, mike.kravetz@oracle.com, mingo@kernel.org, mm-commits@vger.kernel.org, paulmck@kernel.org, peterz@infradead.org, rdunlap@infradead.org, rostedt@goodmis.org, rppt@kernel.org, saeed.mirzamohammadi@oracle.com, samitolvanen@google.com, sboyd@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, vgoyal@redhat.com, yifeifz2@illinois.edu References: <20210507010432.IN24PudKT%akpm@linux-foundation.org> From: David Hildenbrand Organization: Red Hat Subject: Re: [patch 48/91] kernel/crash_core: add crashkernel=auto for vmcore creation Message-ID: <889c6b90-7335-71ce-c955-3596e6ac7c5a@redhat.com> Date: Fri, 7 May 2021 10:16:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210507010432.IN24PudKT%akpm@linux-foundation.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M1HOlb1U; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam03 X-Stat-Signature: akgz7o6hm7dxeuur6s4nn3sh5x5bitz5 X-Rspamd-Queue-Id: 72E46C0007CE Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf22; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620375375-20448 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 07.05.21 03:04, Andrew Morton wrote: > From: Saeed Mirzamohammadi > Subject: kernel/crash_core: add crashkernel=3Dauto for vmcore creation >=20 > This adds crashkernel=3Dauto feature to configure reserved memory for v= mcore > creation. CONFIG_CRASH_AUTO_STR is defined to be set for different ker= nel > distributions and different archs based on their needs. >=20 > Link: https://lkml.kernel.org/r/20210223174153.72802-1-saeed.mirzamoham= madi@oracle.com > Signed-off-by: Saeed Mirzamohammadi > Signed-off-by: John Donnelly > Tested-by: John Donnelly > ed-by: Dave Young > Cc: Baoquan He > Cc: Vivek Goyal > Cc: Jonathan Corbet > Cc: "Paul E. McKenney" > Cc: Randy Dunlap > Cc: Thomas Gleixner > Cc: Mauro Carvalho Chehab > Cc: Mike Kravetz > Cc: "Guilherme G. Piccoli" > Cc: Kees Cook > Cc: "Peter Zijlstra (Intel)" > Cc: Ingo Molnar > Cc: "Steven Rostedt (VMware)" > Cc: YiFei Zhu > Cc: Josh Poimboeuf > Cc: Mike Rapoport > Cc: Masahiro Yamada > Cc: Sami Tolvanen > Cc: Frederic Weisbecker > Cc: Christian Brauner > Cc: Stephen Boyd > Cc: Andrey Konovalov > Cc: Colin Ian King > Signed-off-by: Andrew Morton > --- >=20 > Documentation/admin-guide/kdump/kdump.rst | 3 +- > Documentation/admin-guide/kernel-parameters.txt | 6 ++++ > arch/Kconfig | 20 ++++++++++++++ > kernel/crash_core.c | 7 ++++ > 4 files changed, 35 insertions(+), 1 deletion(-) >=20 > --- a/arch/Kconfig~kernel-crash_core-add-crashkernel=3Dauto-for-vmcore-= creation > +++ a/arch/Kconfig > @@ -14,6 +14,26 @@ menu "General architecture-dependent opt > config CRASH_CORE > bool > =20 > +config CRASH_AUTO_STR > + string "Memory reserved for crash kernel" > + depends on CRASH_CORE > + default "1G-64G:128M,64G-1T:256M,1T-:512M" > + help > + This configures the reserved memory dependent > + on the value of System RAM. The syntax is: > + crashkernel=3D:[,:,...][@offset] > + range=3Dstart-[end] > + > + For example: > + crashkernel=3D512M-2G:64M,2G-:128M > + > + This would mean: > + > + 1) if the RAM is smaller than 512M, then don't reserve anything > + (this is the "rescue" case) > + 2) if the RAM size is between 512M and 2G (exclusive), then res= erve 64M > + 3) if the RAM size is larger than 2G, then reserve 128M > + > config KEXEC_CORE > select CRASH_CORE > bool > --- a/Documentation/admin-guide/kdump/kdump.rst~kernel-crash_core-add-c= rashkernel=3Dauto-for-vmcore-creation > +++ a/Documentation/admin-guide/kdump/kdump.rst > @@ -285,7 +285,8 @@ This would mean: > 2) if the RAM size is between 512M and 2G (exclusive), then reser= ve 64M > 3) if the RAM size is larger than 2G, then reserve 128M > =20 > - > +Or you can use crashkernel=3Dauto to choose the crash kernel memory si= ze > +based on the recommended configuration set for each arch. > =20 > Boot into System Kernel > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- a/Documentation/admin-guide/kernel-parameters.txt~kernel-crash_core= -add-crashkernel=3Dauto-for-vmcore-creation > +++ a/Documentation/admin-guide/kernel-parameters.txt > @@ -751,6 +751,12 @@ > a memory unit (amount[KMG]). See also > Documentation/admin-guide/kdump/kdump.rst for an example. > =20 > + crashkernel=3Dauto > + [KNL] This parameter will set the reserved memory for > + the crash kernel based on the value of the CRASH_AUTO_STR > + that is the best effort estimation for each arch. See also > + arch/Kconfig for further details. > + > crashkernel=3Dsize[KMG],high > [KNL, X86-64] range could be above 4G. Allow kernel > to allocate physical memory region from top, so could > --- a/kernel/crash_core.c~kernel-crash_core-add-crashkernel=3Dauto-for-= vmcore-creation > +++ a/kernel/crash_core.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > =20 > #include > #include > @@ -250,6 +251,12 @@ static int __init __parse_crashkernel(ch > if (suffix) > return parse_crashkernel_suffix(ck_cmdline, crash_size, > suffix); > +#ifdef CONFIG_CRASH_AUTO_STR > + if (strncmp(ck_cmdline, "auto", 4) =3D=3D 0) { > + ck_cmdline =3D CONFIG_CRASH_AUTO_STR; > + pr_info("Using crashkernel=3Dauto, the size chosen is a best effort = estimation.\n"); > + } > +#endif I remember that the original "crashkernel=3Dauto" as once proposed by Red= =20 Hat people did not receive a warm welcome. Let me take a look .... oh, there it is from 2009 https://marc.info/?t=3D125006512600002&r=3D1&w=3D2 and then we had it in 2018 https://lkml.org/lkml/2018/5/20/262 The issue I have with this: it's just plain wrong when you take memory=20 hotplug into serious account as we see it quite heavily in VMs. You=20 don't know what you'll need when building a kernel. Just pass it via the=20 cmdline ... --=20 Thanks, David / dhildenb