Re: s390x: kdump kernel can not boot if I load kernel and initrd images via the kexec_file_load syscall.

2020-05-13 Thread Christian Borntraeger



On 12.05.20 19:39, Philipp Rudo wrote:
> Hi Lianbo,
> 
> stupid me obviously never tested the kdump+initrd combination...
> 
> The patch below fixed the problem for me. Could please give it a try, too.
> 
> Thanks
> Philipp
> 
> ---
> 
> From 3f77088c9139582261d2e3ee6476324fc1ded401 Mon Sep 17 00:00:00 2001
> From: Philipp Rudo 
> Date: Tue, 12 May 2020 19:25:14 +0200
> Subject: [PATCH] s390/kexec_file: fix initrd location for kdump kernel
> 
> initrd_start must not point at the location the initrd is loaded into
> the crashkernel memory but at the location it will be after the
> crashkernel memory is swapped with the memory at 0.
> 
> Fixes: ee337f5469fd ("s390/kexec_file: Add crash support to image loader")
> Reported-by: Lianbo Jiang 
> Signed-off-by: Philipp Rudo 
> ---
>  arch/s390/kernel/machine_kexec_file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kernel/machine_kexec_file.c 
> b/arch/s390/kernel/machine_kexec_file.c
> index 8415ae7d2a23..f9e4baa64b67 100644
> --- a/arch/s390/kernel/machine_kexec_file.c
> +++ b/arch/s390/kernel/machine_kexec_file.c
> @@ -151,7 +151,7 @@ static int kexec_file_add_initrd(struct kimage *image,
>   buf.mem += crashk_res.start;
>   buf.memsz = buf.bufsz;
>  
> - data->parm->initrd_start = buf.mem;
> + data->parm->initrd_start = data->memsz;
>   data->parm->initrd_size = buf.memsz;
>   data->memsz += buf.memsz;


Thanks, applied. 


Re: s390x: kdump kernel can not boot if I load kernel and initrd images via the kexec_file_load syscall.

2020-05-12 Thread lijiang
在 2020年05月13日 01:39, Philipp Rudo 写道:
> Hi Lianbo,
> 
> stupid me obviously never tested the kdump+initrd combination...
> 
> The patch below fixed the problem for me. Could please give it a try, too.
> 

Thank you for the patch, Philipp. Kdump kernel can boot on s390x machine with 
this patch.

> Thanks
> Philipp
> 
> ---
> 
> From 3f77088c9139582261d2e3ee6476324fc1ded401 Mon Sep 17 00:00:00 2001
> From: Philipp Rudo 
> Date: Tue, 12 May 2020 19:25:14 +0200
> Subject: [PATCH] s390/kexec_file: fix initrd location for kdump kernel
> 
> initrd_start must not point at the location the initrd is loaded into
> the crashkernel memory but at the location it will be after the
> crashkernel memory is swapped with the memory at 0.
> 
> Fixes: ee337f5469fd ("s390/kexec_file: Add crash support to image loader")
> Reported-by: Lianbo Jiang 
> Signed-off-by: Philipp Rudo 
> ---
>  arch/s390/kernel/machine_kexec_file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kernel/machine_kexec_file.c 
> b/arch/s390/kernel/machine_kexec_file.c
> index 8415ae7d2a23..f9e4baa64b67 100644
> --- a/arch/s390/kernel/machine_kexec_file.c
> +++ b/arch/s390/kernel/machine_kexec_file.c
> @@ -151,7 +151,7 @@ static int kexec_file_add_initrd(struct kimage *image,
>   buf.mem += crashk_res.start;
>   buf.memsz = buf.bufsz;
>  
> - data->parm->initrd_start = buf.mem;
> + data->parm->initrd_start = data->memsz;

Good findings.

>   data->parm->initrd_size = buf.memsz;
>   data->memsz += buf.memsz;
>  
> 

Tested-by: Lianbo Jiang 

Thanks.
Lianbo



Re: s390x: kdump kernel can not boot if I load kernel and initrd images via the kexec_file_load syscall.

2020-05-12 Thread Philipp Rudo
Hi Lianbo,

stupid me obviously never tested the kdump+initrd combination...

The patch below fixed the problem for me. Could please give it a try, too.

Thanks
Philipp

---

>From 3f77088c9139582261d2e3ee6476324fc1ded401 Mon Sep 17 00:00:00 2001
From: Philipp Rudo 
Date: Tue, 12 May 2020 19:25:14 +0200
Subject: [PATCH] s390/kexec_file: fix initrd location for kdump kernel

initrd_start must not point at the location the initrd is loaded into
the crashkernel memory but at the location it will be after the
crashkernel memory is swapped with the memory at 0.

Fixes: ee337f5469fd ("s390/kexec_file: Add crash support to image loader")
Reported-by: Lianbo Jiang 
Signed-off-by: Philipp Rudo 
---
 arch/s390/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kernel/machine_kexec_file.c 
b/arch/s390/kernel/machine_kexec_file.c
index 8415ae7d2a23..f9e4baa64b67 100644
--- a/arch/s390/kernel/machine_kexec_file.c
+++ b/arch/s390/kernel/machine_kexec_file.c
@@ -151,7 +151,7 @@ static int kexec_file_add_initrd(struct kimage *image,
buf.mem += crashk_res.start;
buf.memsz = buf.bufsz;
 
-   data->parm->initrd_start = buf.mem;
+   data->parm->initrd_start = data->memsz;
data->parm->initrd_size = buf.memsz;
data->memsz += buf.memsz;
 
-- 
2.17.1


On Tue, 12 May 2020 18:03:56 +0800
lijiang  wrote:

> There may be more people who would like to care about this issue. So I added
> them to cc list.
> 
> Thanks.
> Lianbo
> 
> 在 2020年05月12日 17:47, lijiang 写道:
> > Also added Dave Young to the cc list. Thanks.
> > 
> > 在 2020年05月12日 10:52, lijiang 写道:  
> >> 在 2020年05月11日 23:01, Philipp Rudo 写道:  
> >>> Hi Lianbo,
> >>>  
> >> Thank you for this reply, Philipp.
> >>  
> >>> one more question. Does the same problem occur withe the kexec_load 
> >>> syscall,
> >>> i.e. option '-c' instead of '-s'?
> >>>  
> >> No, kdump kernel can boot with the kexec_load syscal option '-c'.
> >>
> >> Currently, I only found kdump kernel can not boot with the kexec_file_load 
> >> syscall(option '-s').
> >>  
> >>> Thanks
> >>> Philipp
> >>>
> >>> On Mon, 11 May 2020 11:15:58 +0200
> >>> Philipp Rudo  wrote:
> >>>  
>  Hi Lianbo,
> 
>  I believe that your crashkernel memory is simply too small. Pretty much 
>  at the
>  beginning of the kernel log you have
>   
> > [0.070468] setup: The initial RAM disk does not fit into the memory 
> >  
> 
>  Although I must say 256M should be enough for most purposes...
> 
>  Could you please retry with a bigger crashkernel memory?
>   
> >>
> >> I increased the size of crash memory to 512M(crashkernel=512M), kdump 
> >> kernel still can
> >> not boot, there is a same issue.
> >>
> >> I added some debug information in the arch/s390/kernel/setup.c, and got 
> >> the following logs:
> >>
> >> [0.070885] Linux version 5.7.0-rc5+ 
> >> (r...@ibm-z-124.rhts.eng.bos.redhat.com)
> >>  (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC), GNU ld version 
> >> 2.30-73.el8
> >> ) #3 SMP Mon May 11 10:28:57 EDT 2020  
> >>  
> >> [0.070888] setup: Linux is running as a z/VM guest operating system in 
> >> 64-bi
> >> t mode 
> >>  
> >> [0.071125] lijiang-debug initrd_start:4aeeb000 size:17180900
> >> <--
> >> [0.071128] setup: The maximum memory size is 2048MB
> >>  
> >> [0.071130] cma: Reserved 4 MiB at 0x1fc0   
> >>  
> >> [0.071131] setup: The initial RAM disk does not fit into the memory
> >>  
> >> [0.071132] lijiang-debug: check_initrd 810 start:4aeeb000, 
> >> size:17180900  <--  
> >> [0.099765] cpu: 2 configured CPUs, 0 standby CPUs  
> >>
> >> The size of initrd is 17M, the 512M memory should be enough. I could 
> >> suspect that kdump
> >> kernel doesn't find an appropriate memory block, thereby this causes the 
> >> failure.
> >>
> >> The compressed initrd is really decompressed in the unpack_to_rootfs().
> >>
> >> I have a s390 machine with 2cpus and 2G memory, which is too slow. :-)
> >>
> >>
> >> Thanks.
> >> Lianbo
> >>
> >>  
>  Thanks
>  Philipp
> 
> 
>  On Fri, 8 May 2020 18:45:56 +0800
>  lijiang  wrote:
>   
> > Hi, Philipp Rudo
> >
> > Sorry to disturb you. I ran into a problem on s390 machine, can you 
> > help to have a look?
> >
> > Kdump kernel can not boot on s390x machines if I load the kernel and 
> > initrd images with the kexec_file_load() syscall as below:
> >
> > #kexec -s -p /boot//boot/vmlinuz-5.7.0-rc4+ 
> > --initrd=/boot/initramfs-5.7.0-rc4+kdump.img 
> > --command-line="rd.dasd=0.0.0120 rd.dasd=0.0.0121 rd.dasd=0.0.0122 
> > rd.dasd=0.0.0123 
> > rd.znet=qeth,0.0.8000,0.0.8001,0.0.8002

Re: s390x: kdump kernel can not boot if I load kernel and initrd images via the kexec_file_load syscall.

2020-05-12 Thread lijiang
There may be more people who would like to care about this issue. So I added
them to cc list.

Thanks.
Lianbo

在 2020年05月12日 17:47, lijiang 写道:
> Also added Dave Young to the cc list. Thanks.
> 
> 在 2020年05月12日 10:52, lijiang 写道:
>> 在 2020年05月11日 23:01, Philipp Rudo 写道:
>>> Hi Lianbo,
>>>
>> Thank you for this reply, Philipp.
>>
>>> one more question. Does the same problem occur withe the kexec_load syscall,
>>> i.e. option '-c' instead of '-s'?
>>>
>> No, kdump kernel can boot with the kexec_load syscal option '-c'.
>>
>> Currently, I only found kdump kernel can not boot with the kexec_file_load 
>> syscall(option '-s').
>>
>>> Thanks
>>> Philipp
>>>
>>> On Mon, 11 May 2020 11:15:58 +0200
>>> Philipp Rudo  wrote:
>>>
 Hi Lianbo,

 I believe that your crashkernel memory is simply too small. Pretty much at 
 the
 beginning of the kernel log you have

> [0.070468] setup: The initial RAM disk does not fit into the memory

 Although I must say 256M should be enough for most purposes...

 Could you please retry with a bigger crashkernel memory?

>>
>> I increased the size of crash memory to 512M(crashkernel=512M), kdump kernel 
>> still can
>> not boot, there is a same issue.
>>
>> I added some debug information in the arch/s390/kernel/setup.c, and got the 
>> following logs:
>>
>> [0.070885] Linux version 5.7.0-rc5+ 
>> (r...@ibm-z-124.rhts.eng.bos.redhat.com)
>>  (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC), GNU ld version 
>> 2.30-73.el8
>> ) #3 SMP Mon May 11 10:28:57 EDT 2020
>>
>> [0.070888] setup: Linux is running as a z/VM guest operating system in 
>> 64-bi
>> t mode   
>>
>> [0.071125] lijiang-debug initrd_start:4aeeb000 size:17180900
>> <--
>> [0.071128] setup: The maximum memory size is 2048MB  
>>
>> [0.071130] cma: Reserved 4 MiB at 0x1fc0 
>>
>> [0.071131] setup: The initial RAM disk does not fit into the memory  
>>
>> [0.071132] lijiang-debug: check_initrd 810 start:4aeeb000, size:17180900 
>>  <--  
>> [0.099765] cpu: 2 configured CPUs, 0 standby CPUs  
>>
>> The size of initrd is 17M, the 512M memory should be enough. I could suspect 
>> that kdump
>> kernel doesn't find an appropriate memory block, thereby this causes the 
>> failure.
>>
>> The compressed initrd is really decompressed in the unpack_to_rootfs().
>>
>> I have a s390 machine with 2cpus and 2G memory, which is too slow. :-)
>>
>>
>> Thanks.
>> Lianbo
>>
>>
 Thanks
 Philipp


 On Fri, 8 May 2020 18:45:56 +0800
 lijiang  wrote:

> Hi, Philipp Rudo
>
> Sorry to disturb you. I ran into a problem on s390 machine, can you help 
> to have a look?
>
> Kdump kernel can not boot on s390x machines if I load the kernel and 
> initrd images with the kexec_file_load() syscall as below:
>
> #kexec -s -p /boot//boot/vmlinuz-5.7.0-rc4+ 
> --initrd=/boot/initramfs-5.7.0-rc4+kdump.img 
> --command-line="rd.dasd=0.0.0120 rd.dasd=0.0.0121 rd.dasd=0.0.0122 
> rd.dasd=0.0.0123 
> rd.znet=qeth,0.0.8000,0.0.8001,0.0.8002,layer2=1,portname=z-126,portno=0 
> $tuned_params BOOT_IMAGE=0 nr_cpus=1 cgroup_disable=memory numa=off 
> udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never 
> novmcoredd nokaslr"
>
> But the kexec reboot can work well if I use the kexec_file_load() syscall 
> as follow:
>
> #kexec -s -l  /boot//boot/vmlinuz-5.7.0-rc4+ 
> --initrd=/boot/initramfs-5.7.0-rc4+kdump.img 
> --command-line="root=/dev/mapper/rhel_ibm--z--126-root crashkernel=256M 
> rd.dasd=0.0.0120 rd.dasd=0.0.0121 rd.dasd=0.0.0122 rd.dasd=0.0.0123 
> rd.lvm.lv=rhel_ibm-z-126/root rd.lvm.lv=rhel_ibm-z-126/swap 
> rd.znet=qeth,0.0.8000,0.0.8001,0.0.8002,layer2=1,portname=z-126,portno=0 
> $tuned_params BOOT_IMAGE=0"
>
> I added the debug information in the populate_rootfs() 
> (init/initramfs.c), and I found that the address of initrd_start is null, 
> and also
> checked the process of kexec file load, I didn't see any errors. It's 
> strange. Any suggestions will be appreciated.
>  
> BTW: I put the kernel log at the end.
>
> Thanks.
> Lianbo
>
>
> kdump kernel log:
>
> 01: HCPGSP2629I The virtual machine is placed in CP mode due to a SIGP 
> stop from
>  CPU 01.  
>   
> 01: HCPGSP2629I The virtual machine is placed in CP mode due to a SIGP 
> stop from
>  CPU 00.  
>   
> [0.070339] Linux version 5.7.0-rc4+ 
> (r...@ibm-z-126.rhts.eng.bos.redhat.com)