i.MX6 kexec functionality

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6 kexec functionality

3,760 Views
chrischapman
Contributor I

I'm currently working on a solution that uses kexec to switch kernels on the fly without a full system restart.  So far I have it functioning after some modification to the kexec-tools to allow for a larger dtb file, but unfortunately I intermittently get failures and the system will hang instead of starting the new kernel. I was wondering if anyone has got kexec working reliably on an i.MX6?

Labels (2)
Tags (3)
0 Kudos
15 Replies

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Chris,

I am currently investigating the same issue. Were you able to solve this issue?

Regards,

Fabio Estevam

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Chris,

Got it running with kernel 3.14 and also 4.1-rc on a mx6quad.

I had issues with mx6solo though, which I will investigate later.

Here are my logs:

root@wandboard-solo:~# kexec -d -l /tmp/zImage --dtb /tmp/imx6q-sabresd.dtb --co - Pastebin.com

0 Kudos

2,392 Views
chrischapman
Contributor I

Fabio,

How far have you taken testing of this fix? I found the only way to be certain that any changes actually fixed the issue was to leave the system in a kexec loop for a long period of time.

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

I rebooted the system several times via kexec and did not see any failure.

0 Kudos

2,392 Views
chrischapman
Contributor I

I recommend attempting the method I mentioned of looping kexec for a significant length of time to test it thoroughly. During my troubleshooting over a year ago I found that you may get numerous successful kexec executions in a row and then the system would lock. Sometimes it went for several minutes of looping, other times several hours, but also I'd see it happen on the first attempt.

If I recall correctly we were running the 3.10.17 kernel release and to get kexec working correctly we had to make some changes around the clock gating. I'm unsure if this ever made it to the BSP or if another workaround was found.

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Ok, thanks for the suggestion, Chris.

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Chris,

I saw an issue on the serial driver during the kexec tests and I fixed it with this commit:

https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/tty/serial/imx.c?id=...

Regards,

Fabio Estevam

0 Kudos

2,392 Views
arthur_rythm
Contributor III

Hi FabioEstevam‌,

I have the same issue here with imx6ull board. I tried the two patches from this topic :

ARM: 8338/1: kexec: Relax SMP validation to improve DT compatibility · Freescale/linux-fslc@fee3fd4 ... 

kernel/git/next/linux-next.git - The linux-next integration testing tree 

But same result .. SMP is disable

I am using the freescale releasel : rel_imx_4.1.15_2.1.0_ga

My kernel parameter to configure kdump:

# cat /proc/cmdline 
console=ttymxc0,115200 cma=96M root=/dev/mmcblk1p8 rootwait rw crashkernel=50M@0x81000000

iomem seems to be good :

# cat /proc/iomem
(...)
80000000-8fffffff : System RAM
  80008000-808c62ab : Kernel code
  80920000-809cc7bf : Kernel data
  81000000-841fffff : Crash kernel

script to test kexec :

# cat kx.sh 
#!/bin/sh
 
DUMPK_CMDLINE="console=ttymxc0,115200 cma=96M root=/dev/mmcblk1p8 rootwait rw  maxcpus=1 reset_devices earlyprinkt init=/sbin/init"
kexec --type zImage \
-l /data/zImage \
--dtb=/data/imx6ul-nano.dtb \
--append="${DUMPK_CMDLINE}"
[ $? -ne 0 ] && {
    echo "kexec failed." ; exit 1
}
echo "$0: kexec: success, dump kernel loaded."
exit 0

I run the script with success :

# sh kx.sh 
kx.sh: kexec: success, dump kernel loaded.

Finally I tried to execute it :

# kexec -d -e
imx2-wdt 20bc000.wdog: Device shutdown: Expect reboot!
kexec: Starting new kernel
Bye!

Nothing after that. No more output. My board is freeze.

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Arthur,

Please start a new thread as the original one is from 2014.

Also, please use a more recent kernel, such as NXP 4.9 or mainline 4.15.

Regards,

Fabio Estevam

0 Kudos

2,392 Views
Henry_p
NXP Employee
NXP Employee

Hi Fabio,

My customer had some troubles to enable kexec on 3.10.17 kernel.

Could you give more information on how to enable kexec at your side?

If you can share any guide document or reference, it would be very helpful for us.

Especially I want to know which version of kexec you used(in yocto package? or seperately downloaded?) and whether there is any special difference between kernel versions.

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Yong,

I tested kexec on mx6 using FSL 3.14 kernel and also mainline 4.1.

With mainline kernel it works out of the box. With 3.14 kernel we need to apply the following patch:

ARM: 8338/1: kexec: Relax SMP validation to improve DT compatibility · Freescale/linux-fslc@fee3fd4 ...

I haven't tested kexec with 3.10, but you probably need to adapt this patch to 3.10 and give it a try.

I used the kexec version that is provided by Yocto fido.

The commands I used are posted here:

root@wandboard-solo:~# kexec -d -l /tmp/zImage --dtb /tmp/imx6q-sabresd.dtb --co - Pastebin.com

Regards,

Fabio Estevam

2,392 Views
Henry_p
NXP Employee
NXP Employee

Hi Fabio,

I tried kexec on 3.10.17 kernel, but failed with following log.

I applied the patch you mentioned and another patch which applied before the patch.

GIT Browse

Any other things to have a try?

Regards,

Henry.

============================================================================

kexec -d -l ./zImage --dtb ./imx6q-sabresd.dtb --command-line="console=ttymxc0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait rw"


kernel: 0x75df8008 kernel_size: 0x507250
kexec_load: entry = 0x10008000 flags = 0x280000
nr_segments = 2
segment[0].buf   = 0x75df8008
segment[0].bufsz = 0x507250
segment[0].mem   = 0x10008000
segment[0].memsz = 0x508000
segment[1].buf   = 0x1246008
segment[1].bufsz = 0xb8a4
segment[1].mem   = 0x1141e000
segment[1].memsz = 0xc000
root@imx6qsabreauto:~/kexec/kernel#
root@imx6qsabreauto:~/kexec/kernel#
root@imx6qsabreauto:~/kexec/kernel# kexec -e
Starting new kernel
Disabling non-boot CPUs ...
CPU1: shutdown
CPU2: shutdown
CPU3: shutdown
Bye!

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Henry,

Were you able to verify kexec functionality on 3.14 first?

I have never tried kexec on 3.10, so not sure how easy it will be to find the missing patches.

Regards,

Fabio Estevam

0 Kudos

2,392 Views
Henry_p
NXP Employee
NXP Employee

Hi Fabio,

3.14.28 kernel successfully boot by kexec on 3.14.28 kernel. Even I did'nt apply "ARM: 8338/1: kexec: Relax SMP validation to improve DT compatibility"

In case 3.14.28 boot -> kexec -> 3.10.17 kernel didn't boot (stopped at Bye!)

In case 3.10.17 boot -> kexec -> 3.14.28 kernel didn't boot(stopped during kernel booting)

Maybe more patches are required for 3.10 kernel.

Regards,

Henry.

0 Kudos

2,392 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Henry,

I forgot to mention that the "ARM: 8338/1: kexec: Relax SMP validation to improve DT compatibility" is only needed for booting the mx6 solo.

mx6quad and dual-lite boot fine without this patch on 3.14.

Regards,

Fabio Estevam

0 Kudos