All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/12] ppc64: enable kdump support for kexec_file_load syscall
@ 2020-07-13 17:20 ` Hari Bathini
  0 siblings, 0 replies; 125+ messages in thread
From: Hari Bathini @ 2020-07-13 17:20 UTC (permalink / raw)
  To: Michael Ellerman, Andrew Morton
  Cc: Pingfan Liu, Kexec-ml, Mimi Zohar, Nayna Jain, Petr Tesarik,
	Mahesh J Salgaonkar, Sourabh Jain, lkml, linuxppc-dev,
	Eric Biederman, Thiago Jung Bauermann, Dave Young, Vivek Goyal

This patch series enables kdump support for kexec_file_load system
call (kexec -s -p) on PPC64. The changes are inspired from kexec-tools
code but heavily modified for kernel consumption. There is scope to
expand purgatory to verify sha256 digest along with other improvements
in purgatory code. Will deal with those changes in a separate patch
series later.

The first patch adds a weak arch_kexec_locate_mem_hole() function to
override locate memory hole logic suiting arch needs. There are some
special regions in ppc64 which should be avoided while loading buffer
& there are multiple callers to kexec_add_buffer making it complicated
to maintain range sanity and using generic lookup at the same time.

The second patch marks ppc64 specific code within arch/powerpc/kexec
and arch/powerpc/purgatory to make the subsequent code changes easy
to understand.

The next patch adds helper function to setup different memory ranges
needed for loading kdump kernel, booting into it and exporting the
crashing kernel's elfcore.

The fourth patch overrides arch_kexec_locate_mem_hole() function to
locate memory hole for kdump segments by accounting for the special
memory regions, referred to as excluded memory ranges, and sets
kbuf->mem when a suitable memory region is found.

The fifth patch moves walk_drmem_lmbs() out of .init section with
a few changes to reuse it for setting up kdump kernel's usable memory
ranges. The next patch uses walk_drmem_lmbs() to look up the LMBs
and set linux,drconf-usable-memory & linux,usable-memory properties
in order to restrict kdump kernel's memory usage.

The seventh patch adds relocation support for the purgatory. Patch 8
helps setup the stack for the purgatory. The next patch setups up
backup region as a segment while loading kdump kernel and teaches
purgatory to copy it from source to destination.

Patch 10 builds the elfcore header for the running kernel & passes
the info to kdump kernel via "elfcorehdr=" parameter to export as
/proc/vmcore file. The next patch sets up the memory reserve map
for the kexec kernel and also claims kdump support for kdump as
all the necessary changes are added.

The last patch fixes a lookup issue for `kexec -l -s` case when
memory is reserved for crashkernel.

Tested the changes successfully on P8, P9 lpars, couple of OpenPOWER
boxes, one with secureboot enabled and a simulator.

v2 -> v3:
* Fixed TOC pointer calculation for purgatory by using section info
  that has relocations applied.
* Fixed arch_kexec_locate_mem_hole() function to fallback to generic
  kexec_locate_mem_hole() lookup if exclude ranges list is empty.
* Dropped check for backup_start in trampoline_64.S as purgatory()
  function takes care of it anyway.

v1 -> v2:
* Introduced arch_kexec_locate_mem_hole() for override and dropped
  weak arch_kexec_add_buffer().
* Addressed warnings reported by lkp.
* Added patch to address kexec load issue when memory is reserved
  for crashkernel.
* Used the appropriate license header for the new files added.
* Added an option to merge ranges to minimize reallocations while
  adding memory ranges.
* Dropped within_crashkernel parameter for add_opal_mem_range() &
  add_rtas_mem_range() functions as it is not really needed.

---

Hari Bathini (12):
      kexec_file: allow archs to handle special regions while locating memory hole
      powerpc/kexec_file: mark PPC64 specific code
      powerpc/kexec_file: add helper functions for getting memory ranges
      ppc64/kexec_file: avoid stomping memory used by special regions
      powerpc/drmem: make lmb walk a bit more flexible
      ppc64/kexec_file: restrict memory usage of kdump kernel
      ppc64/kexec_file: add support to relocate purgatory
      ppc64/kexec_file: setup the stack for purgatory
      ppc64/kexec_file: setup backup region for kdump kernel
      ppc64/kexec_file: prepare elfcore header for crashing kernel
      ppc64/kexec_file: add appropriate regions for memory reserve map
      ppc64/kexec_file: fix kexec load failure with lack of memory hole


 arch/powerpc/include/asm/crashdump-ppc64.h |   15 
 arch/powerpc/include/asm/drmem.h           |    9 
 arch/powerpc/include/asm/kexec.h           |   35 +
 arch/powerpc/include/asm/kexec_ranges.h    |   18 
 arch/powerpc/include/asm/purgatory.h       |   11 
 arch/powerpc/kernel/prom.c                 |   13 
 arch/powerpc/kexec/Makefile                |    2 
 arch/powerpc/kexec/elf_64.c                |   35 +
 arch/powerpc/kexec/file_load.c             |   78 +
 arch/powerpc/kexec/file_load_64.c          | 1508 ++++++++++++++++++++++++++++
 arch/powerpc/kexec/ranges.c                |  397 +++++++
 arch/powerpc/mm/drmem.c                    |   87 +-
 arch/powerpc/mm/numa.c                     |   13 
 arch/powerpc/purgatory/Makefile            |   28 -
 arch/powerpc/purgatory/purgatory_64.c      |   36 +
 arch/powerpc/purgatory/trampoline.S        |  117 --
 arch/powerpc/purgatory/trampoline_64.S     |  170 +++
 include/linux/kexec.h                      |   29 -
 kernel/kexec_file.c                        |   16 
 19 files changed, 2407 insertions(+), 210 deletions(-)
 create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h
 create mode 100644 arch/powerpc/include/asm/kexec_ranges.h
 create mode 100644 arch/powerpc/include/asm/purgatory.h
 create mode 100644 arch/powerpc/kexec/file_load_64.c
 create mode 100644 arch/powerpc/kexec/ranges.c
 create mode 100644 arch/powerpc/purgatory/purgatory_64.c
 delete mode 100644 arch/powerpc/purgatory/trampoline.S
 create mode 100644 arch/powerpc/purgatory/trampoline_64.S


^ permalink raw reply	[flat|nested] 125+ messages in thread

end of thread, other threads:[~2020-07-17 20:00 UTC | newest]

Thread overview: 125+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 17:20 [PATCH v3 00/12] ppc64: enable kdump support for kexec_file_load syscall Hari Bathini
2020-07-13 17:20 ` Hari Bathini
2020-07-13 17:20 ` Hari Bathini
2020-07-13 17:20 ` [PATCH v3 01/12] kexec_file: allow archs to handle special regions while locating memory hole Hari Bathini
2020-07-13 17:20   ` Hari Bathini
2020-07-13 17:20   ` Hari Bathini
2020-07-14 21:00   ` Thiago Jung Bauermann
2020-07-14 21:00     ` Thiago Jung Bauermann
2020-07-14 21:00     ` Thiago Jung Bauermann
2020-07-13 17:21 ` [PATCH v3 02/12] powerpc/kexec_file: mark PPC64 specific code Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-16  1:49   ` Thiago Jung Bauermann
2020-07-16  1:49     ` Thiago Jung Bauermann
2020-07-16  1:49     ` Thiago Jung Bauermann
2020-07-17  4:46     ` Hari Bathini
2020-07-17  4:46       ` Hari Bathini
2020-07-17  4:46       ` Hari Bathini
2020-07-17 18:34       ` Thiago Jung Bauermann
2020-07-17 18:34         ` Thiago Jung Bauermann
2020-07-13 17:21 ` [PATCH v3 03/12] powerpc/kexec_file: add helper functions for getting memory ranges Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-14 23:49   ` Thiago Jung Bauermann
2020-07-14 23:49     ` Thiago Jung Bauermann
2020-07-14 23:49     ` Thiago Jung Bauermann
2020-07-16 21:08     ` Hari Bathini
2020-07-16 21:08       ` Hari Bathini
2020-07-17  4:32     ` Hari Bathini
2020-07-17  4:32       ` Hari Bathini
2020-07-17  4:32       ` Hari Bathini
2020-07-17 20:00       ` Hari Bathini
2020-07-17 20:00         ` Hari Bathini
2020-07-13 17:21 ` [PATCH v3 04/12] ppc64/kexec_file: avoid stomping memory used by special regions Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-15  2:39   ` Thiago Jung Bauermann
2020-07-15  2:39     ` Thiago Jung Bauermann
2020-07-15  2:39     ` Thiago Jung Bauermann
2020-07-16  5:58     ` Thiago Jung Bauermann
2020-07-16  5:58       ` Thiago Jung Bauermann
2020-07-16  5:58       ` Thiago Jung Bauermann
2020-07-16 21:09     ` Hari Bathini
2020-07-16 21:09       ` Hari Bathini
2020-07-16 21:59       ` Thiago Jung Bauermann
2020-07-16 21:59         ` Thiago Jung Bauermann
2020-07-16 21:59         ` Thiago Jung Bauermann
2020-07-13 17:21 ` [PATCH v3 05/12] powerpc/drmem: make lmb walk a bit more flexible Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-13 17:21   ` Hari Bathini
2020-07-15  3:50   ` Thiago Jung Bauermann
2020-07-15  3:50     ` Thiago Jung Bauermann
2020-07-15  3:50     ` Thiago Jung Bauermann
2020-07-16 21:09     ` Hari Bathini
2020-07-16 21:09       ` Hari Bathini
2020-07-16 22:01       ` Thiago Jung Bauermann
2020-07-16 22:01         ` Thiago Jung Bauermann
2020-07-16 22:01         ` Thiago Jung Bauermann
2020-07-13 17:22 ` [PATCH v3 06/12] ppc64/kexec_file: restrict memory usage of kdump kernel Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-15 22:52   ` Thiago Jung Bauermann
2020-07-15 22:52     ` Thiago Jung Bauermann
2020-07-15 22:52     ` Thiago Jung Bauermann
2020-07-16 21:10     ` Hari Bathini
2020-07-16 21:10       ` Hari Bathini
2020-07-16 22:03       ` Thiago Jung Bauermann
2020-07-16 22:03         ` Thiago Jung Bauermann
2020-07-16 22:03         ` Thiago Jung Bauermann
2020-07-17  4:17         ` Hari Bathini
2020-07-17  4:17           ` Hari Bathini
2020-07-13 17:22 ` [PATCH v3 07/12] ppc64/kexec_file: add support to relocate purgatory Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-16  0:20   ` Thiago Jung Bauermann
2020-07-16  0:20     ` Thiago Jung Bauermann
2020-07-16  0:20     ` Thiago Jung Bauermann
2020-07-16 21:11     ` Hari Bathini
2020-07-16 21:11       ` Hari Bathini
2020-07-16 22:12       ` Thiago Jung Bauermann
2020-07-16 22:12         ` Thiago Jung Bauermann
2020-07-16 22:12         ` Thiago Jung Bauermann
2020-07-13 17:22 ` [PATCH v3 08/12] ppc64/kexec_file: setup the stack for purgatory Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-16  0:35   ` Thiago Jung Bauermann
2020-07-16  0:35     ` Thiago Jung Bauermann
2020-07-16  0:35     ` Thiago Jung Bauermann
2020-07-16  1:40   ` Thiago Jung Bauermann
2020-07-16  1:40     ` Thiago Jung Bauermann
2020-07-16  1:40     ` Thiago Jung Bauermann
2020-07-13 17:22 ` [PATCH v3 09/12] ppc64/kexec_file: setup backup region for kdump kernel Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-13 17:22   ` Hari Bathini
2020-07-16  1:38   ` Thiago Jung Bauermann
2020-07-16  1:38     ` Thiago Jung Bauermann
2020-07-16  1:38     ` Thiago Jung Bauermann
2020-07-16 21:10     ` Hari Bathini
2020-07-16 21:10       ` Hari Bathini
2020-07-16 22:06       ` Thiago Jung Bauermann
2020-07-16 22:06         ` Thiago Jung Bauermann
2020-07-16 22:06         ` Thiago Jung Bauermann
2020-07-13 17:23 ` [PATCH v3 10/12] ppc64/kexec_file: prepare elfcore header for crashing kernel Hari Bathini
2020-07-13 17:23   ` Hari Bathini
2020-07-13 17:23   ` Hari Bathini
2020-07-16  2:22   ` Thiago Jung Bauermann
2020-07-16  2:22     ` Thiago Jung Bauermann
2020-07-16  2:22     ` Thiago Jung Bauermann
2020-07-16 21:07     ` Hari Bathini
2020-07-16 21:07       ` Hari Bathini
2020-07-16 21:57       ` Thiago Jung Bauermann
2020-07-16 21:57         ` Thiago Jung Bauermann
2020-07-16 21:57         ` Thiago Jung Bauermann
2020-07-13 17:23 ` [PATCH v3 11/12] ppc64/kexec_file: add appropriate regions for memory reserve map Hari Bathini
2020-07-13 17:23   ` Hari Bathini
2020-07-13 17:23   ` Hari Bathini
2020-07-16  2:27   ` Thiago Jung Bauermann
2020-07-16  2:27     ` Thiago Jung Bauermann
2020-07-16  2:27     ` Thiago Jung Bauermann
2020-07-13 17:23 ` [PATCH v3 12/12] ppc64/kexec_file: fix kexec load failure with lack of memory hole Hari Bathini
2020-07-13 17:23   ` Hari Bathini
2020-07-13 17:23   ` Hari Bathini
2020-07-16  5:43   ` Thiago Jung Bauermann
2020-07-16  5:43     ` Thiago Jung Bauermann
2020-07-16  5:43     ` Thiago Jung Bauermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.