kexec.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: Baoquan He <bhe@redhat.com>, Vivek Goyal <vgoyal@redhat.com>,
	Dave Young <dyoung@redhat.com>,
	kexec@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, mhocko@suse.cz
Subject: [PATCH 0/4] kdump: crashkernel reservation from CMA
Date: Fri, 24 Nov 2023 20:54:36 +0100	[thread overview]
Message-ID: <ZWD_fAPqEWkFlEkM@dwarf.suse.cz> (raw)

Hi,

this series implements a new way to reserve additional crash kernel
memory using CMA.

Currently, all the memory for the crash kernel is not usable by
the 1st (production) kernel. It is also unmapped so that it can't
be corrupted by the fault that will eventually trigger the crash.
This makes sense for the memory actually used by the kexec-loaded
crash kernel image and initrd and the data prepared during the
load (vmcoreinfo, ...). However, the reserved space needs to be
much larger than that to provide enough run-time memory for the
crash kernel and the kdump userspace. Estimating the amount of
memory to reserve is difficult. Being too careful makes kdump
likely to end in OOM, being too generous takes even more memory
from the production system. Also, the reservation only allows
reserving a single contiguous block (or two with the "low"
suffix). I've seen systems where this fails because the physical
memory is fragmented.

By reserving additional crashkernel memory from CMA, the main
crashkernel reservation can be just small enough to fit the 
kernel and initrd image, minimizing the memory taken away from
the production system. Most of the run-time memory for the crash
kernel will be memory previously available to userspace in the
production system. As this memory is no longer wasted, the
reservation can be done with a generous margin, making kdump more
reliable. Kernel memory that we need to preserve for dumping is 
never allocated from CMA. User data is typically not dumped by 
makedumpfile. When dumping of user data is intended this new CMA 
reservation cannot be used.

There are four patches in this series:

The first adds a new ",cma" suffix to the recenly introduced generic
crashkernel parsing code. parse_crashkernel() takes one more
argument to store the cma reservation size.

The second patch implements reserve_crashkernel_cma() which
performs the reservation. If the requested size is not available
in a single range, multiple smaller ranges will be reserved.

The third patch enables the functionality for x86 as a proof of
concept. There are just three things every arch needs to do:
- call reserve_crashkernel_cma()
- include the CMA-reserved ranges in the physical memory map
- exclude the CMA-reserved ranges from the memory available
  through /proc/vmcore by excluding them from the vmcoreinfo
  PT_LOAD ranges.
Adding other architectures is easy and I can do that as soon as
this series is merged.

The fourth patch just updates Documentation/

Now, specifying
	crashkernel=100M craskhernel=1G,cma
on the command line will make a standard crashkernel reservation
of 100M, where kexec will load the kernel and initrd.

An additional 1G will be reserved from CMA, still usable by the
production system. The crash kernel will have 1.1G memory
available. The 100M can be reliably predicted based on the size
of the kernel and initrd.

When no crashkernel=size,cma is specified, everything works as
before.

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, Prague, Czechia


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2023-11-24 19:54 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 19:54 Jiri Bohac [this message]
2023-11-24 19:57 ` [PATCH 1/4] kdump: add crashkernel cma suffix Jiri Bohac
2023-11-25  7:24   ` kernel test robot
2023-11-24 19:58 ` [PATCH 2/4] kdump: implement reserve_crashkernel_cma Jiri Bohac
2023-11-24 19:58 ` [PATCH 3/4] kdump, x86: implement crashkernel CMA reservation Jiri Bohac
2023-11-24 19:58 ` [PATCH 4/4] kdump, documentation: describe craskernel " Jiri Bohac
2023-11-25  1:51 ` [PATCH 0/4] kdump: crashkernel reservation from CMA Tao Liu
2023-11-25 21:22   ` Jiri Bohac
2023-11-28  1:12     ` Tao Liu
2023-11-28  2:11       ` Baoquan He
2023-11-28  9:08         ` Michal Hocko
2023-11-29  7:57           ` Baoquan He
2023-11-29  9:25             ` Michal Hocko
2023-11-30  2:42               ` Baoquan He
2023-11-29 10:51             ` Jiri Bohac
2023-11-30  4:01               ` Baoquan He
2023-12-01 12:35                 ` Jiri Bohac
2023-11-29  8:10           ` Baoquan He
2023-11-29 15:03             ` Donald Dutile
2023-11-30  3:00               ` Baoquan He
2023-11-30 10:16                 ` Michal Hocko
2023-11-30 12:04                   ` Baoquan He
2023-11-30 12:31                     ` Baoquan He
2023-11-30 13:41                       ` Michal Hocko
2023-12-01 11:33                         ` Philipp Rudo
2023-12-01 11:55                           ` Michal Hocko
2023-12-01 15:51                             ` Philipp Rudo
2023-12-01 16:59                               ` Michal Hocko
2023-12-06 11:08                                 ` Philipp Rudo
2023-12-06 11:23                                   ` David Hildenbrand
2023-12-06 13:49                                   ` Michal Hocko
2023-12-06 15:19                                     ` Michal Hocko
2023-12-07  4:23                                       ` Baoquan He
2023-12-07  8:55                                         ` Michal Hocko
2023-12-07 11:13                                           ` Philipp Rudo
2023-12-07 11:52                                             ` Michal Hocko
2023-12-08  1:55                                               ` Baoquan He
2023-12-08 10:04                                                 ` Michal Hocko
2023-12-08  2:10                                           ` Baoquan He
2023-12-07 11:13                                       ` Philipp Rudo
2023-11-30 13:29                     ` Michal Hocko
2023-11-30 13:33                       ` Pingfan Liu
2023-11-30 13:43                         ` Michal Hocko
2023-12-01  0:54                           ` Pingfan Liu
2023-12-01 10:37                             ` Michal Hocko
2023-11-28  2:07     ` Pingfan Liu
2023-11-28  8:58       ` Michal Hocko
2023-12-01 11:34 ` Philipp Rudo

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=ZWD_fAPqEWkFlEkM@dwarf.suse.cz \
    --to=jbohac@suse.cz \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=vgoyal@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).