Re: how to use kexec to jump back to the original kernel
On Wed, Feb 14, 2018 at 2:24 PM, Gioh Kim wrote: > On Tue, Feb 13, 2018 at 8:06 PM, Bhupesh SHARMA > wrote: >> On Tue, Feb 13, 2018 at 8:15 PM, Gioh Kim wrote: >>> On Tue, Feb 13, 2018 at 3:36 PM, Gioh Kim wrote: On Tue, Feb 13, 2018 at 11:06 AM, Gioh Kim wrote: > On Mon, Feb 12, 2018 at 7:56 AM, Bhupesh SHARMA > wrote: >> Hello, >> >> On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: >>> Hello, >>> >>> "echo c > /proc/sysrq-trigger" generates the kernel dump but it >>> reboots the system. >>> I'd like to generate kernel dump without system reboot. >>> >>> I think it is possible to jump to the kdump kernel and generate kernel >>> dump, and come back to the operating kernel with kexec. >>> I know I can jump to the kdump kernel with "kexec -e" but I cannot >>> figure out how to come back to the operating kernel. >>> >>> For example, I tried following sequences after reading kexec manual >>> page. >>> >>> 0. rebuild kernel with CONFIG_KEXEC_JUMP option >>> 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline >> >> Instead you should be using something like: >> # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname >> -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr >> --mem-max=addr > > Hello Bhupesh, I'm sorry to bother you. I failed because I booted up wrong kernel without KEXEC_JUMP. I can jump to kdump kernel with booting a kernel with KEXEC_JUMP. And I can see "kexec_jump_back_entry=0x000810d2" at kernel booting parameter. Now I can jump to kdump kernel and jump back to the original kernel. Can I ask just one more question? After jumping to kdump kernel, there is not /proc/vmcore file. I checked the kernel enabled CONFIG_PROC_VMCORE option. What kernel option should I enable to use /proc/vmcore? Or should I use another file instead /proc/vmcore? >>> >>> I'm sorry but please let me ask one more question. >>> >>> I ran "kexec -e" command on kdump kernel, then it just rebooted the system. >>> I guess jumping to the original kernel means resuming the original >>> kernel as it was running. >>> Did I misunderstand? >>> Or my machine did not work correctly? >> >> Hello, >> >> I have replied in another thread (in reply to the documentation patch >> for kdump jump feature which you sent out today) about this in detail, >> but to capture my thoughts briefly here, I think you are confusing the >> 'kexec -l' or loading another kernel and 'kexec -p' or the kdump use >> cases. >> >> Can you please explain whether you are trying the jump feature with >> 'kexec -l' or 'kexec -p'. >> > > Hello, > > The another thread about documentation is for documentation. > So I explain the background here. > > I'm working for the Cloud company providing qemu-based virtualization service. > When system has a problem and does not panic yet, we usually migrate > all guest VMs > and reboot the system. > Sometimes log files have a clue for the problem, but in many cases > there is nothing in log files > and it's difficult to investigate. > > What I want to do is generating a kernel dump at the moment when the > system becomes unstable. > After migrating all VMs, the system would be clean and I would get no > clue for the problem. > So I'd like to generate the kernel dump before migrating VMs and > cleaning up the system. > > Of course, when system paniced, I got kernel dump. > But it is the worst case because guest VMs also were killed. > It is the service failure. > > I think I'm confused with system snapshot and kernel dump. > Nevertheless I need a solution to capture the system status without > panic or reboot. > > >> I remember trying the jump feature with 'kexec -p' some time back and >> it did not work for me at that time. Although I was able to use the >> jump feature with 'kexec -l' on the same machine. > > 'kexec -p' command jumps to kdump kernel on panic, doesn't it? > I'd like to jump to kdump kernel without panic or reboot, and get back > to the system kernel > and continue to service. So you mean kexec not kdump here, see more below .. > I think that is the jumping between the system kernel and kdump kernel. > If I misunderstand the meaning of the jump, I'll find another way. > > Thank you again ;-) .. Seems you are mixing up two separate use-cases (see [1] for some background): Kexec is a Linux kernel-to-kernel boot loader that helps to boot the second kernel from the context of first kernel. Kexec shuts down the first kernel, bypasses the BIOS or firmware stage, and jumps to second kernel. Whereas Kdump can be used with the kexec application when the first kernel panics, the second kernel is used to copy the memory dump of first kernel, which can be analysed with tools such as gdb and crash to determine the panic reasons. I am not sure if we can jump back to a primary ker
Re: how to use kexec to jump back to the original kernel
On Tue, Feb 13, 2018 at 8:06 PM, Bhupesh SHARMA wrote: > On Tue, Feb 13, 2018 at 8:15 PM, Gioh Kim wrote: >> On Tue, Feb 13, 2018 at 3:36 PM, Gioh Kim wrote: >>> On Tue, Feb 13, 2018 at 11:06 AM, Gioh Kim wrote: On Mon, Feb 12, 2018 at 7:56 AM, Bhupesh SHARMA wrote: > Hello, > > On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: >> Hello, >> >> "echo c > /proc/sysrq-trigger" generates the kernel dump but it >> reboots the system. >> I'd like to generate kernel dump without system reboot. >> >> I think it is possible to jump to the kdump kernel and generate kernel >> dump, and come back to the operating kernel with kexec. >> I know I can jump to the kdump kernel with "kexec -e" but I cannot >> figure out how to come back to the operating kernel. >> >> For example, I tried following sequences after reading kexec manual page. >> >> 0. rebuild kernel with CONFIG_KEXEC_JUMP option >> 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline > > Instead you should be using something like: > # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname > -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr > --mem-max=addr Hello Bhupesh, >>> >>> I'm sorry to bother you. >>> I failed because I booted up wrong kernel without KEXEC_JUMP. >>> I can jump to kdump kernel with booting a kernel with KEXEC_JUMP. >>> And I can see "kexec_jump_back_entry=0x000810d2" at kernel >>> booting parameter. >>> Now I can jump to kdump kernel and jump back to the original kernel. >>> >>> Can I ask just one more question? >>> After jumping to kdump kernel, there is not /proc/vmcore file. >>> I checked the kernel enabled CONFIG_PROC_VMCORE option. >>> What kernel option should I enable to use /proc/vmcore? >>> Or should I use another file instead /proc/vmcore? >>> >>> >> >> I'm sorry but please let me ask one more question. >> >> I ran "kexec -e" command on kdump kernel, then it just rebooted the system. >> I guess jumping to the original kernel means resuming the original >> kernel as it was running. >> Did I misunderstand? >> Or my machine did not work correctly? > > Hello, > > I have replied in another thread (in reply to the documentation patch > for kdump jump feature which you sent out today) about this in detail, > but to capture my thoughts briefly here, I think you are confusing the > 'kexec -l' or loading another kernel and 'kexec -p' or the kdump use > cases. > > Can you please explain whether you are trying the jump feature with > 'kexec -l' or 'kexec -p'. > Hello, The another thread about documentation is for documentation. So I explain the background here. I'm working for the Cloud company providing qemu-based virtualization service. When system has a problem and does not panic yet, we usually migrate all guest VMs and reboot the system. Sometimes log files have a clue for the problem, but in many cases there is nothing in log files and it's difficult to investigate. What I want to do is generating a kernel dump at the moment when the system becomes unstable. After migrating all VMs, the system would be clean and I would get no clue for the problem. So I'd like to generate the kernel dump before migrating VMs and cleaning up the system. Of course, when system paniced, I got kernel dump. But it is the worst case because guest VMs also were killed. It is the service failure. I think I'm confused with system snapshot and kernel dump. Nevertheless I need a solution to capture the system status without panic or reboot. > I remember trying the jump feature with 'kexec -p' some time back and > it did not work for me at that time. Although I was able to use the > jump feature with 'kexec -l' on the same machine. 'kexec -p' command jumps to kdump kernel on panic, doesn't it? I'd like to jump to kdump kernel without panic or reboot, and get back to the system kernel and continue to service. I think that is the jumping between the system kernel and kdump kernel. If I misunderstand the meaning of the jump, I'll find another way. Thank you again ;-) -- Best regards, Gioh Kim ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: how to use kexec to jump back to the original kernel
On Tue, Feb 13, 2018 at 8:15 PM, Gioh Kim wrote: > On Tue, Feb 13, 2018 at 3:36 PM, Gioh Kim wrote: >> On Tue, Feb 13, 2018 at 11:06 AM, Gioh Kim wrote: >>> On Mon, Feb 12, 2018 at 7:56 AM, Bhupesh SHARMA >>> wrote: Hello, On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: > Hello, > > "echo c > /proc/sysrq-trigger" generates the kernel dump but it > reboots the system. > I'd like to generate kernel dump without system reboot. > > I think it is possible to jump to the kdump kernel and generate kernel > dump, and come back to the operating kernel with kexec. > I know I can jump to the kdump kernel with "kexec -e" but I cannot > figure out how to come back to the operating kernel. > > For example, I tried following sequences after reading kexec manual page. > > 0. rebuild kernel with CONFIG_KEXEC_JUMP option > 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline Instead you should be using something like: # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr --mem-max=addr >>> >>> Hello Bhupesh, >> >> I'm sorry to bother you. >> I failed because I booted up wrong kernel without KEXEC_JUMP. >> I can jump to kdump kernel with booting a kernel with KEXEC_JUMP. >> And I can see "kexec_jump_back_entry=0x000810d2" at kernel >> booting parameter. >> Now I can jump to kdump kernel and jump back to the original kernel. >> >> Can I ask just one more question? >> After jumping to kdump kernel, there is not /proc/vmcore file. >> I checked the kernel enabled CONFIG_PROC_VMCORE option. >> What kernel option should I enable to use /proc/vmcore? >> Or should I use another file instead /proc/vmcore? >> >> > > I'm sorry but please let me ask one more question. > > I ran "kexec -e" command on kdump kernel, then it just rebooted the system. > I guess jumping to the original kernel means resuming the original > kernel as it was running. > Did I misunderstand? > Or my machine did not work correctly? Hello, I have replied in another thread (in reply to the documentation patch for kdump jump feature which you sent out today) about this in detail, but to capture my thoughts briefly here, I think you are confusing the 'kexec -l' or loading another kernel and 'kexec -p' or the kdump use cases. Can you please explain whether you are trying the jump feature with 'kexec -l' or 'kexec -p'. I remember trying the jump feature with 'kexec -p' some time back and it did not work for me at that time. Although I was able to use the jump feature with 'kexec -l' on the same machine. Regards, Bhupesh ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: how to use kexec to jump back to the original kernel
On Tue, Feb 13, 2018 at 3:36 PM, Gioh Kim wrote: > On Tue, Feb 13, 2018 at 11:06 AM, Gioh Kim wrote: >> On Mon, Feb 12, 2018 at 7:56 AM, Bhupesh SHARMA >> wrote: >>> Hello, >>> >>> On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: Hello, "echo c > /proc/sysrq-trigger" generates the kernel dump but it reboots the system. I'd like to generate kernel dump without system reboot. I think it is possible to jump to the kdump kernel and generate kernel dump, and come back to the operating kernel with kexec. I know I can jump to the kdump kernel with "kexec -e" but I cannot figure out how to come back to the operating kernel. For example, I tried following sequences after reading kexec manual page. 0. rebuild kernel with CONFIG_KEXEC_JUMP option 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline >>> >>> Instead you should be using something like: >>> # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname >>> -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr >>> --mem-max=addr >> >> Hello Bhupesh, > > I'm sorry to bother you. > I failed because I booted up wrong kernel without KEXEC_JUMP. > I can jump to kdump kernel with booting a kernel with KEXEC_JUMP. > And I can see "kexec_jump_back_entry=0x000810d2" at kernel > booting parameter. > Now I can jump to kdump kernel and jump back to the original kernel. > > Can I ask just one more question? > After jumping to kdump kernel, there is not /proc/vmcore file. > I checked the kernel enabled CONFIG_PROC_VMCORE option. > What kernel option should I enable to use /proc/vmcore? > Or should I use another file instead /proc/vmcore? > > I'm sorry but please let me ask one more question. I ran "kexec -e" command on kdump kernel, then it just rebooted the system. I guess jumping to the original kernel means resuming the original kernel as it was running. Did I misunderstand? Or my machine did not work correctly? -- Best regards, Gioh Kim ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: how to use kexec to jump back to the original kernel
On Tue, Feb 13, 2018 at 11:06 AM, Gioh Kim wrote: > On Mon, Feb 12, 2018 at 7:56 AM, Bhupesh SHARMA > wrote: >> Hello, >> >> On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: >>> Hello, >>> >>> "echo c > /proc/sysrq-trigger" generates the kernel dump but it >>> reboots the system. >>> I'd like to generate kernel dump without system reboot. >>> >>> I think it is possible to jump to the kdump kernel and generate kernel >>> dump, and come back to the operating kernel with kexec. >>> I know I can jump to the kdump kernel with "kexec -e" but I cannot >>> figure out how to come back to the operating kernel. >>> >>> For example, I tried following sequences after reading kexec manual page. >>> >>> 0. rebuild kernel with CONFIG_KEXEC_JUMP option >>> 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline >> >> Instead you should be using something like: >> # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname >> -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr >> --mem-max=addr > > Hello Bhupesh, > > Thank you for your advice. > > I tried load-preserve-context as below but it failed with "Invalid > argument" error. > There is no reason in the error message. > But there is entry address that looks like the address "kexec -e" in > the kdump kernel will jump to. > Following is what I did. > > root@pserver:~# kexec -l /boot/vmlinuz-`uname -r` > --initrd=/boot/initrd.img-`uname -r` --reuse-cmdline > --load-preserve-context --mem-min=0x100 --mem-max=0x > kexec_load failed: Invalid argument > entry = 0xbffcb7f0 flags = 0x3e0002 > nr_segments = 7 > segment[0].buf = (nil) > segment[0].bufsz = 0x0 > segment[0].mem = 0x100 > segment[0].memsz = 0xba08 > segment[1].buf = 0x7fe372eaa010 > segment[1].bufsz = 0x2f7fddc > segment[1].mem = 0xbb08 > segment[1].memsz = 0x2f8 > segment[2].buf = 0x7fe375e2e210 > segment[2].bufsz = 0x61c840 > segment[2].mem = 0xbe00 > segment[2].memsz = 0x14e1000 > segment[3].buf = (nil) > segment[3].bufsz = 0x0 > segment[3].mem = 0xbf4e1000 > segment[3].memsz = 0xae5000 > segment[4].buf = 0x25eb920 > segment[4].bufsz = 0x42c6 > segment[4].mem = 0xbffc6000 > segment[4].memsz = 0x5000 > segment[5].buf = 0x25e27c0 > segment[5].bufsz = 0x9100 > segment[5].mem = 0xbffcb000 > segment[5].memsz = 0xb000 > segment[6].buf = 0x25e1e20 > segment[6].bufsz = 0x400 > segment[6].mem = 0xbffd6000 > segment[6].memsz = 0x4000 > root@pserver:~# > root@pserver:~# > root@pserver:~# kexec -e > Nothing has been loaded! > I'm sorry to bother you. I failed because I booted up wrong kernel without KEXEC_JUMP. I can jump to kdump kernel with booting a kernel with KEXEC_JUMP. And I can see "kexec_jump_back_entry=0x000810d2" at kernel booting parameter. Now I can jump to kdump kernel and jump back to the original kernel. Can I ask just one more question? After jumping to kdump kernel, there is not /proc/vmcore file. I checked the kernel enabled CONFIG_PROC_VMCORE option. What kernel option should I enable to use /proc/vmcore? Or should I use another file instead /proc/vmcore? -- Best regards, Gioh Kim ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: how to use kexec to jump back to the original kernel
On Mon, Feb 12, 2018 at 7:56 AM, Bhupesh SHARMA wrote: > Hello, > > On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: >> Hello, >> >> "echo c > /proc/sysrq-trigger" generates the kernel dump but it >> reboots the system. >> I'd like to generate kernel dump without system reboot. >> >> I think it is possible to jump to the kdump kernel and generate kernel >> dump, and come back to the operating kernel with kexec. >> I know I can jump to the kdump kernel with "kexec -e" but I cannot >> figure out how to come back to the operating kernel. >> >> For example, I tried following sequences after reading kexec manual page. >> >> 0. rebuild kernel with CONFIG_KEXEC_JUMP option >> 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline > > Instead you should be using something like: > # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname > -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr > --mem-max=addr Hello Bhupesh, Thank you for your advice. I tried load-preserve-context as below but it failed with "Invalid argument" error. There is no reason in the error message. But there is entry address that looks like the address "kexec -e" in the kdump kernel will jump to. Following is what I did. root@pserver:~# kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initrd.img-`uname -r` --reuse-cmdline --load-preserve-context --mem-min=0x100 --mem-max=0x kexec_load failed: Invalid argument entry = 0xbffcb7f0 flags = 0x3e0002 nr_segments = 7 segment[0].buf = (nil) segment[0].bufsz = 0x0 segment[0].mem = 0x100 segment[0].memsz = 0xba08 segment[1].buf = 0x7fe372eaa010 segment[1].bufsz = 0x2f7fddc segment[1].mem = 0xbb08 segment[1].memsz = 0x2f8 segment[2].buf = 0x7fe375e2e210 segment[2].bufsz = 0x61c840 segment[2].mem = 0xbe00 segment[2].memsz = 0x14e1000 segment[3].buf = (nil) segment[3].bufsz = 0x0 segment[3].mem = 0xbf4e1000 segment[3].memsz = 0xae5000 segment[4].buf = 0x25eb920 segment[4].bufsz = 0x42c6 segment[4].mem = 0xbffc6000 segment[4].memsz = 0x5000 segment[5].buf = 0x25e27c0 segment[5].bufsz = 0x9100 segment[5].mem = 0xbffcb000 segment[5].memsz = 0xb000 segment[6].buf = 0x25e1e20 segment[6].bufsz = 0x400 segment[6].mem = 0xbffd6000 segment[6].memsz = 0x4000 root@pserver:~# root@pserver:~# root@pserver:~# kexec -e Nothing has been loaded! I added an output with adding -d option for your information. > > to let the kernel know that the primary kernel context should be > retained so that we can return to the same once we do a 'kexec -e' > from the secondary kernel. > > Can you please try the same. Also can you please share the details of > the hardware you are using this one, AFAIK only x86 and sh > architectures support CONFIG_KEXEC_JUMP in upstream linux. Of course, I'm using x86 platform. I'm testing v4.4 and v4.14 kernel on x86 Dell desktop and x86 Qemu virtual machine. > > Regards, > Bhupesh > >> 2. kexec -e >> 3. now kdump kernel is running >> 4. kexec --load-jump-back-helper --entry= >> 5. kexec -e >> >> I can jump to the kdump kernel with step 1 and step 2. >> kexec manual says I need an entry address. >> I don't know what address I should use. >> I found a email thread about jump_back_entry= but there is no >> parameter like jump_back_entry in kernel booting parameters of >> v4.4~v4.14. >> >> Does anybody know how to use kexec to jump between kdump kernel and >> operating kernel? >> >> >> -- >> >> Best regards, >> Gioh Kim >> >> ___ >> kexec mailing list >> kexec@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/kexec Following is the output of kexec with -d option. root@pserver:~# kexec -d -l /boot/vmlinuz-`uname -r` --initrd=/boot/initrd.img-`uname -r` --reuse-cmdline --load-preserve-context --mem-min=0x100 --mem-max=0x kernel: 0x7fd6b55eb010 kernel_size: 0x620a40 MEMORY RANGES 0100-0009fbff (0) 0009fc00-0009 (1) 000f-000f (1) 0010-bffd9fff (0) bffda000-bfff (1) feffc000-feff (1) fffc- (1) 0001-00013fff (0) -0fff : reserved 1000-0009fbff : System RAM 0009fc00-0009 : reserved 000a-000b : PCI Bus :00 000c-000c95ff : Video ROM 000c9800-000ca5ff : Adapter ROM 000ca800-000ccbff : Adapter ROM 000f-000f : reserved 000f-000f : System ROM 0010-bffd9fff : System RAM 0100-01846440 : Kernel code 01846441-01f5baff : Kernel data 020af000-0236efff : Kernel bss 2a00-31ff : Crash kernel bffda000-bfff : reserved c000-febf : PCI Bus :00 000
Re: how to use kexec to jump back to the original kernel
Hello, On Fri, Feb 9, 2018 at 7:24 PM, Gioh Kim wrote: > Hello, > > "echo c > /proc/sysrq-trigger" generates the kernel dump but it > reboots the system. > I'd like to generate kernel dump without system reboot. > > I think it is possible to jump to the kdump kernel and generate kernel > dump, and come back to the operating kernel with kexec. > I know I can jump to the kdump kernel with "kexec -e" but I cannot > figure out how to come back to the operating kernel. > > For example, I tried following sequences after reading kexec manual page. > > 0. rebuild kernel with CONFIG_KEXEC_JUMP option > 1. kexec --load=/boot/vmlinuz --initrd=/boot/initrd --reuse-cmdline Instead you should be using something like: # kexec -l /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname -r`.img --reuse-cmdline --load-preserve-context --mem-min=addr --mem-max=addr to let the kernel know that the primary kernel context should be retained so that we can return to the same once we do a 'kexec -e' from the secondary kernel. Can you please try the same. Also can you please share the details of the hardware you are using this one, AFAIK only x86 and sh architectures support CONFIG_KEXEC_JUMP in upstream linux. Regards, Bhupesh > 2. kexec -e > 3. now kdump kernel is running > 4. kexec --load-jump-back-helper --entry= > 5. kexec -e > > I can jump to the kdump kernel with step 1 and step 2. > kexec manual says I need an entry address. > I don't know what address I should use. > I found a email thread about jump_back_entry= but there is no > parameter like jump_back_entry in kernel booting parameters of > v4.4~v4.14. > > Does anybody know how to use kexec to jump between kdump kernel and > operating kernel? > > > -- > > Best regards, > Gioh Kim > > ___ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec