Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2955788imm; Thu, 24 May 2018 19:51:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqkrthDsVkXhX7lHEFN9YB22s5QCQriNHfngAJPPGCCHxUrU2A3AVfidmZl33VGM/NzwWkG X-Received: by 2002:a17:902:6f16:: with SMTP id w22-v6mr641070plk.216.1527216675740; Thu, 24 May 2018 19:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216675; cv=none; d=google.com; s=arc-20160816; b=SwekIq2TOC4/X5RzsD8DxdvL1oODqiF6rAHFZ4rOWiuDEZBne0oOD30YmSlLfgNErN ncaWittOQamNe/2KEcOSV3X4GnOGoyEPkJIgmLTb02/4wTM/FtyM/NXEsen3KamZjnmu xggpkKR03qMJMtNA2URjNJdJnYPjUXgJQj6GqYPdIIlcDl1jHKJ7GDkKmN0qWETgvP9N GRUG5dvdxnGCYcTufgoB8NIaZFzMilfhz0MhA0rpGWlln1Oxtyg6e6rDFIi5bIt9+k98 zaUTguGEfCj+u8WIU4VvegNCriYtEwM1rip/8RhlX6sZJH0Mg2/p+mOJtT/JMZKpzGxK 3sQw== 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:arc-authentication-results; bh=Iig+ELDbuynAIzq/aaaffmVHfERXtH+FLW9JOPhRgrE=; b=e33MrYYllK44oM1Z7qumlFh8wPFsXY3y6rpp0EsmsUKWJMCus8LMgoN3dbWJPdKP6K U5Hg7IGPapx660x/MaHlv6fNvIC+Ytn2Y9m5WgvrhZUh/H1Nbb3eMkjBaOO4VyT+/Jst 2p/utUzjPpq1OuxZJAK//rB2WF91vuohNhAMSMFaYUjE3RGZk3gFs2GdRxDqsmayZmO6 NHK39IvDTm/fDr2fa8hlIoekvIhGSsxbIaDsJm1s7Zbq2qLvhrUIQvwMZxCgsvcwyNnN 9bLoIiQDVWa0bhqhupNnfjQCR3A4jZO4vI5QL3LsoVrcyYYzSSNeC0rCn2uok035df+/ 7u0A== 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 w6-v6si9088017pgb.11.2018.05.24.19.51.01; Thu, 24 May 2018 19:51:15 -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 S935756AbeEYCn6 (ORCPT + 99 others); Thu, 24 May 2018 22:43:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36352 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751358AbeEYCnw (ORCPT ); Thu, 24 May 2018 22:43:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9864F402290A; Fri, 25 May 2018 02:43:51 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-38.pek2.redhat.com [10.72.12.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07AD483B85; Fri, 25 May 2018 02:43:44 +0000 (UTC) Date: Fri, 25 May 2018 10:43:39 +0800 From: Dave Young To: "Eric W. Biederman" Cc: Andrew Morton , linux-kernel@vger.kernel.org, kexec@lists.infradead.org, Cong Wang , Neil Horman , Ingo Molnar , Vivek Goyal , Tony Luck , Anton Vorontsov , Michael Ellerman , Benjamin Herrenschmidt , Martin Schwidefsky , Hari Bathini , dzickus@redhat.com, bhe@redhat.com Subject: Re: [PATCH] kdump: add default crashkernel reserve kernel config options Message-ID: <20180525024339.GA2720@dhcp-128-65.nay.redhat.com> References: <20180521025337.GA4627@dhcp-128-65.nay.redhat.com> <20180521120215.117d963a7619eb0d1f54bced@linux-foundation.org> <20180523070641.GA1689@dhcp-128-65.nay.redhat.com> <877enucqr0.fsf@xmission.com> <20180524014234.GA2031@dhcp-128-65.nay.redhat.com> <87bmd53t0p.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bmd53t0p.fsf@xmission.com> User-Agent: Mutt/1.9.5 (2018-04-13) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 25 May 2018 02:43:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 25 May 2018 02:43:51 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On 05/24/18 at 11:41am, Eric W. Biederman wrote: > Dave Young writes: > > > Hi Eric, > > On 05/23/18 at 10:53am, Eric W. Biederman wrote: > >> Dave Young writes: > >> > >> > [snip] > >> > > >> >> > > >> >> > +config CRASHKERNEL_DEFAULT_THRESHOLD_MB > >> >> > + int "System memory size threshold for kdump memory default reserving" > >> >> > + depends on CRASH_CORE > >> >> > + default 0 > >> >> > + help > >> >> > + CRASHKERNEL_DEFAULT_MB is used as default crashkernel value if > >> >> > + the system memory size is equal or bigger than the threshold. > >> >> > >> >> "the threshold" is rather vague. Can it be clarified? > >> >> > >> >> In fact I'm really struggling to understand the logic here.... > >> >> > >> >> > >> >> > +config CRASHKERNEL_DEFAULT_MB > >> >> > + int "Default crashkernel memory size reserved for kdump" > >> >> > + depends on CRASH_CORE > >> >> > + default 0 > >> >> > + help > >> >> > + This is used as the default kdump reserved memory size in MB. > >> >> > + crashkernel=X kernel cmdline can overwrite this value. > >> >> > + > >> >> > config HAVE_IMA_KEXEC > >> >> > bool > >> >> > > >> >> > @@ -143,6 +144,24 @@ static int __init parse_crashkernel_simp > >> >> > return 0; > >> >> > } > >> >> > > >> >> > +static int __init get_crashkernel_default(unsigned long long system_ram, > >> >> > + unsigned long long *size) > >> >> > +{ > >> >> > + unsigned long long sz = CONFIG_CRASHKERNEL_DEFAULT_MB; > >> >> > + unsigned long long thres = CONFIG_CRASHKERNEL_DEFAULT_THRESHOLD_MB; > >> >> > + > >> >> > + thres *= SZ_1M; > >> >> > + sz *= SZ_1M; > >> >> > + > >> >> > + if (sz >= system_ram || system_ram < thres) { > >> >> > + pr_debug("crashkernel default size can not be used.\n"); > >> >> > + return -EINVAL; > >> >> > >> >> In other words, > >> >> > >> >> if (system_ram <= CONFIG_CRASHKERNEL_DEFAULT_MB || > >> >> system_ram < CONFIG_CRASHKERNEL_DEFAULT_THRESHOLD_MB) > >> >> fail; > >> >> > >> >> yes? > >> >> > >> >> How come? What's happening here? Perhaps a (good) explanatory comment > >> >> is needed. And clearer Kconfig text. > >> >> > >> >> All confused :( > >> > > >> > Andrew, I tuned it a bit, removed the check of sz >= system_ram, so if > >> > the size is too large and kernel can not find enough memory it will > >> > still fail in latter code. > >> > > >> > Is below version looks clearer? > >> > >> What is the advantage of providing this in a kconfig option rather > >> than on the kernel command line as we can now? > > > > It is not a replacement of the cmdline, this can be a supplement to > > the crashkernel command line. For a lot of common use cases if we have > > the auto reservation user just do not need to manually set the cmdline > > for example on a virtual machine and usual setup (except of the > > comlicate storage and very large machines). The crashkernel=auto > > has been used for long time, Red Hat QE tested it on a lot of different > > lab machines and proved it works well. Kdump usually just works so admin > > do little work to enable kdump. > > > > But the crashkernel=auto implementation has some drawbacks that is it > > is more like embed policy in the code and it is not flexible like a > > config option. > > Have you considered using the builtin command line aka CONFIG_CMDLINE? > If as you are reserving a fixed amount of memory as your patch does that > should be sufficient, and doable without any kernel changes. Hmm, even in builtin cmdline it is same as a explict used crashkernel=. If we think from a distribution point of view, it will be hard to differentiate the builtin provided param and bootloader provided params. It looks odd to see two crashkernel= when `cat /proc/cmdline`, it will confuse people and there could cause compatibility problems because it is explict value visible in kernel cmdline. Thanks Dave