linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kairui Song <kasong@redhat.com>
To: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Cc: "John Donnelly" <john.p.donnelly@oracle.com>,
	stable@vger.kernel.org, "Dave Young" <dyoung@redhat.com>,
	"Baoquan He" <bhe@redhat.com>, "Vivek Goyal" <vgoyal@redhat.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Shawn Guo" <shawnguo@kernel.org>, "Li Yang" <leoyang.li@nxp.com>,
	"Vinod Koul" <vkoul@kernel.org>, "Arnd Bergmann" <arnd@arndb.de>,
	"Anson Huang" <Anson.Huang@nxp.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Michael Walle" <michael@walle.cc>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Olof Johansson" <olof@lixom.net>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Diego Elio Pettenò" <flameeyes@flameeyes.com>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	kexec@lists.infradead.org, linux-doc@vger.kernel.org,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/1] kernel/crash_core.c - Add crashkernel=auto for x86 and ARM
Date: Fri, 20 Nov 2020 17:34:35 +0800	[thread overview]
Message-ID: <CACPcB9d7kU1TYaF-g2GH16Wg=hrQu71sGDoC8uMFFMc6oW_duQ@mail.gmail.com> (raw)
In-Reply-To: <AC36B9BC-654C-4FC1-8EA3-94B986639F1E@oracle.com>

On Fri, Nov 20, 2020 at 4:28 AM Saeed Mirzamohammadi
<saeed.mirzamohammadi@oracle.com> wrote:
>
> Hi,
>
> And I think crashkernel=auto could be used as an indicator that user
> want the kernel to control the crashkernel size, so some further work
> could be done to adjust the crashkernel more accordingly. eg. when
> memory encryption is enabled, increase the crashkernel value for the
> auto estimation, as it's known to consume more crashkernel memory.
>
> Thanks for the suggestion! I tried to keep it simple and leave it to the user to change Kconfig in case a different range is needed. Based on experience, these ranges work well for most of the regular cases.

Yes, I think the current implementation is a very good start.

There are some use cases, where kernel is expected to reserve more memory, like:
- when memory encryption is enabled, an extra swiotlb size of memory
should be reserved
- on pcc, fadump will expect more memory to be reserved

I believe there are a lot more cases like these.
I tried to come up with some patches to let the kernel reserve more
memory automatically, when such conditions are detected, but changing
the crashkernel= specified value is really weird.

But if we have a crashkernel=auto, then kernel automatically reserve
more memory will make sense.

> But why not make it arch-independent? This crashkernel=auto idea
> should simply work with every arch.
>
>
> Thanks! I’ll be making it arch-independent in the v2 patch.
>
>
> #include <asm/page.h>
> #include <asm/sections.h>
> @@ -41,6 +42,15 @@ static int __init parse_crashkernel_mem(char *cmdline,
>                                        unsigned long long *crash_base)
> {
>        char *cur = cmdline, *tmp;
> +       unsigned long long total_mem = system_ram;
> +
> +       /*
> +        * Firmware sometimes reserves some memory regions for it's own use.
> +        * so we get less than actual system memory size.
> +        * Workaround this by round up the total size to 128M which is
> +        * enough for most test cases.
> +        */
> +       total_mem = roundup(total_mem, SZ_128M);
>
>
> I think this rounding may be better moved to the arch specified part
> where parse_crashkernel is called?
>
>
> Thanks for the suggestion. Could you please elaborate why do we need to do that?

Every arch gets their total memory value using different methods,
(just check every parse_crashkernel call, and the system_ram param is
filled in many different ways), so I'm really not sure if this
rounding is always suitable.

>
> Thanks,
> Saeed
>
>
--
Best Regards,
Kairui Song


  parent reply	other threads:[~2020-11-20  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 23:24 [PATCH 1/1] kernel/crash_core.c - Add crashkernel=auto for x86 and ARM Saeed Mirzamohammadi
2020-11-19  1:06 ` Randy Dunlap
2020-11-19 20:16   ` Saeed Mirzamohammadi
2020-11-19  6:09 ` Kairui Song
2020-11-19 20:52   ` Saeed Mirzamohammadi
     [not found]   ` <AC36B9BC-654C-4FC1-8EA3-94B986639F1E@oracle.com>
2020-11-20  9:34     ` Kairui Song [this message]
2020-11-22 15:32       ` Guilherme Piccoli
2020-11-23  3:47         ` Dave Young
2021-01-21 15:32           ` john.p.donnelly
2021-01-22  1:22             ` Dave Young
2021-01-22  3:12               ` Dave Young
     [not found]                 ` <730EBE33-5571-49C0-AF38-08C49736EB70@oracle.com>
2021-01-23  3:51                   ` Dave Young
2021-01-23  3:57                     ` Dave Young
2020-11-19 21:56 ` Guilherme Piccoli
2020-11-20  2:26   ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACPcB9d7kU1TYaF-g2GH16Wg=hrQu71sGDoC8uMFFMc6oW_duQ@mail.gmail.com' \
    --to=kasong@redhat.com \
    --cc=Anson.Huang@nxp.com \
    --cc=arnd@arndb.de \
    --cc=bhe@redhat.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=dyoung@redhat.com \
    --cc=flameeyes@flameeyes.com \
    --cc=geert+renesas@glider.be \
    --cc=hpa@zytor.com \
    --cc=john.p.donnelly@oracle.com \
    --cc=kexec@lists.infradead.org \
    --cc=krzk@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael@walle.cc \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mingo@redhat.com \
    --cc=olof@lixom.net \
    --cc=rdunlap@infradead.org \
    --cc=saeed.mirzamohammadi@oracle.com \
    --cc=shawnguo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    --cc=vkoul@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).