Re: [PATCH] kexec: avoid out of bounds in crash_exclude_mem_range()

2023-11-29 Thread Baoquan He
On 11/27/23 at 10:56am, fuqiang wang wrote: > When the split happened, judge whether mem->nr_ranges is equal to > mem->max_nr_ranges. If it is true, return -ENOMEM. > > The advantage of doing this is that it can avoid array bounds caused by > some bugs. E.g., Before commit 4831be702b95 ("arm64/kex

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Baoquan He
On 11/29/23 at 11:51am, Jiri Bohac wrote: > Hi Baoquan, > > thanks for your interest... > > On Wed, Nov 29, 2023 at 03:57:59PM +0800, Baoquan He wrote: > > On 11/28/23 at 10:08am, Michal Hocko wrote: > > > On Tue 28-11-23 10:11:31, Baoquan He wrote: > > > > On 11/28/23 at 09:12am, Tao Liu wrote:

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Baoquan He
On 11/29/23 at 10:03am, Donald Dutile wrote: > Baoquan, > hi! > > On 11/29/23 3:10 AM, Baoquan He wrote: > > On 11/28/23 at 10:08am, Michal Hocko wrote: > > > On Tue 28-11-23 10:11:31, Baoquan He wrote: > > > > On 11/28/23 at 09:12am, Tao Liu wrote: > > > [...] > > > > Thanks for the effort to bri

Re: [PATCH v3 2/7] kexec_file: print out debugging message if required

2023-11-29 Thread Joe Perches
On Thu, 2023-11-30 at 10:39 +0800, Baoquan He wrote: > Replace pr_debug() with the newly added kexec_dprintk() in kexec_file > loading related codes. trivia: > diff --git a/kernel/crash_core.c b/kernel/crash_core.c [] > @@ -551,9 +551,12 @@ int crash_prepare_elf64_headers(struct crash_mem *mem,

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Baoquan He
On 11/29/23 at 10:25am, Michal Hocko wrote: > On Wed 29-11-23 15:57:59, Baoquan He wrote: > [...] > > Hmm, Redhat could go in a different way. We have been trying to: > > 1) customize initrd for kdump kernel specifically, e.g exclude unneeded > > devices's driver to save memory; > > 2) monitor devi

[PATCH v3 3/7] kexec_file, x86: print out debugging message if required

2023-11-29 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out e820 memmap passed to 2nd kernel just as kexec_load interface has been doing. Signed-off-by: Baoquan He --- arch/x86/kernel/crash.c | 4 ++-- arch/x86/kernel/kexec-bzimage6

[PATCH v3 1/7] kexec_file: add kexec_file flag to control debug printing

2023-11-29 Thread Baoquan He
When specifying 'kexec -c -d', kexec_load interface will print loading information, e.g the regions where kernel/initrd/purgatory/cmdline are put, the memmap passed to 2nd kernel taken as system RAM ranges, and printing all contents of struct kexec_segment, etc. These are very helpful for analyzing

[PATCH v3 4/7] kexec_file, arm64: print out debugging message if required

2023-11-29 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove the kimage->segment[] printing because the generic code has done the printing. Signed-off-by: Baoquan He --- arch/arm64/kernel/kexec_image.c| 6 +++--- arch/arm64/kernel/machine

[PATCH v3 6/7] kexec_file, power: print out debugging message if required

2023-11-29 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Signed-off-by: Baoquan He --- arch/powerpc/kexec/elf_64.c | 8 arch/powerpc/kexec/file_load_64.c | 18 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/

[PATCH v3 7/7] kexec_file, parisc: print out debugging message if required

2023-11-29 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. Signed-off-by: Baoquan He --- arch/parisc/kernel/kexec_file.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/parisc/kernel/kexec_file.c b/arch/parisc/kernel/kexec_file.c

[PATCH v3 5/7] kexec_file, ricv: print out debugging message if required

2023-11-29 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also remove kexec_image_info() because the content has been printed out in generic code. Signed-off-by: Baoquan He --- arch/riscv/kernel/elf_kexec.c | 11 ++- arch/riscv/kernel/machine_k

[PATCH v3 2/7] kexec_file: print out debugging message if required

2023-11-29 Thread Baoquan He
Replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also print out type/start/head of kimage and flags to help debug. Signed-off-by: Baoquan He --- kernel/crash_core.c| 9 ++--- kernel/kexec_file.c| 11 ---

[PATCH v3 0/7] kexec_file: print out debugging message if required

2023-11-29 Thread Baoquan He
Currently, specifying '-d' on kexec command will print a lot of debugging informationabout kexec/kdump loading with kexec_load interface. However, kexec_file_load prints nothing even though '-d' is specified. It's very inconvenient to debug or analyze the kexec/kdump loading when something wrong h

Re: [PATCH] kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP

2023-11-29 Thread Baoquan He
On 11/29/23 at 10:04pm, Ignat Korchagin wrote: > In commit f8ff23429c62 ("kernel/Kconfig.kexec: drop select of KEXEC for > CRASH_DUMP") we tried to fix a config regression, where CONFIG_CRASH_DUMP > required CONFIG_KEXEC. > > However, it was not enough at least for arm64 platforms. While further t

Re: [PATCH] kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP

2023-11-29 Thread Andrew Morton
On Wed, 29 Nov 2023 22:34:13 + Ignat Korchagin wrote: > On Wed, Nov 29, 2023 at 10:23 PM Andrew Morton > wrote: > > > > On Wed, 29 Nov 2023 22:04:09 + Ignat Korchagin > > wrote: > > > > > Fixes: 91506f7e5d21 ("arm64/kexec: refactor for kernel/Kconfig.kexec") > > > Cc: sta...@vger.kerne

Re: [PATCH] kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP

2023-11-29 Thread Ignat Korchagin
On Wed, Nov 29, 2023 at 10:23 PM Andrew Morton wrote: > > On Wed, 29 Nov 2023 22:04:09 + Ignat Korchagin > wrote: > > > Fixes: 91506f7e5d21 ("arm64/kexec: refactor for kernel/Kconfig.kexec") > > Cc: sta...@vger.kernel.org # 6.6+: f8ff234: kernel/Kconfig.kexec: drop > > select of KEXEC for C

Re: [PATCH] kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP

2023-11-29 Thread Andrew Morton
On Wed, 29 Nov 2023 22:04:09 + Ignat Korchagin wrote: > Fixes: 91506f7e5d21 ("arm64/kexec: refactor for kernel/Kconfig.kexec") > Cc: sta...@vger.kernel.org # 6.6+: f8ff234: kernel/Kconfig.kexec: drop select > of KEXEC for CRASH_DUMP > Cc: sta...@vger.kernel.org # 6.6+ I doubt if anyone know

[PATCH] kexec: drop dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP

2023-11-29 Thread Ignat Korchagin
In commit f8ff23429c62 ("kernel/Kconfig.kexec: drop select of KEXEC for CRASH_DUMP") we tried to fix a config regression, where CONFIG_CRASH_DUMP required CONFIG_KEXEC. However, it was not enough at least for arm64 platforms. While further testing the patch with our arm64 config I noticed that CON

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Donald Dutile
Baoquan, hi! On 11/29/23 3:10 AM, Baoquan He wrote: On 11/28/23 at 10:08am, Michal Hocko wrote: On Tue 28-11-23 10:11:31, Baoquan He wrote: On 11/28/23 at 09:12am, Tao Liu wrote: [...] Thanks for the effort to bring this up, Jiri. I am wondering how you will use this crashkernel=,cma parame

[PATCH 1/2] s390x: fix virtual vs physical address confusion

2023-11-29 Thread Alexander Gordeev
Physical and virtual addresses are the same on S390X. That led to misuse of readmem() address type. Signed-off-by: Alexander Gordeev --- arch/s390x.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/s390x.c b/arch/s390x.c index c4fed6f..a01f164 100644 ---

[PATCH 0/2] s390x: uncouple physical and virtual memory spaces

2023-11-29 Thread Alexander Gordeev
Hi all, Currently physical and virtual addresses are the same on S390X, but in the future it is going to be uncoupled just like on any other architecture. This series supports that feature, but it does not impact the current and older kernel versions. Patch 1 is basically NOP and only fix semanti

[PATCH 2/2] s390x: uncouple virtual and physical address spaces

2023-11-29 Thread Alexander Gordeev
Rework vaddr_to_paddr() and paddr_to_vaddr() macros to reflect the future uncoupling of physical and virtual address spaces in kernel. Existing versions are not affected. Signed-off-by: Alexander Gordeev --- arch/s390x.c | 134 - makedumpfile.c |

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Jiri Bohac
Hi Baoquan, thanks for your interest... On Wed, Nov 29, 2023 at 03:57:59PM +0800, Baoquan He wrote: > On 11/28/23 at 10:08am, Michal Hocko wrote: > > On Tue 28-11-23 10:11:31, Baoquan He wrote: > > > On 11/28/23 at 09:12am, Tao Liu wrote: > > [...] > > > Thanks for the effort to bring this up, Ji

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Michal Hocko
On Wed 29-11-23 15:57:59, Baoquan He wrote: [...] > Hmm, Redhat could go in a different way. We have been trying to: > 1) customize initrd for kdump kernel specifically, e.g exclude unneeded > devices's driver to save memory; > 2) monitor device and kenrel memory usage if they begin to consume much

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Baoquan He
On 11/28/23 at 10:08am, Michal Hocko wrote: > On Tue 28-11-23 10:11:31, Baoquan He wrote: > > On 11/28/23 at 09:12am, Tao Liu wrote: > [...] > > Thanks for the effort to bring this up, Jiri. > > > > I am wondering how you will use this crashkernel=,cma parameter. I mean > > the scenario of crashke

Re: [PATCH 0/4] kdump: crashkernel reservation from CMA

2023-11-29 Thread Baoquan He
On 11/28/23 at 10:08am, Michal Hocko wrote: > On Tue 28-11-23 10:11:31, Baoquan He wrote: > > On 11/28/23 at 09:12am, Tao Liu wrote: > [...] > > Thanks for the effort to bring this up, Jiri. > > > > I am wondering how you will use this crashkernel=,cma parameter. I mean > > the scenario of crashke