Skip to contentSkip to conversation

kexec: load-preserve-context option on s390

DISCUSSION Michael Holzheu 3 participants 7 messages Sep 26, 2011 – Oct 4, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello Simon,

I think the --load-preserve-context and --load-jump-back-helper kexec options are not working on s390 because we do not support CONFIG_KEXEC_JUMP. I assume the same is true also on other architectures. Correct me, if I am wrong. Unfortunately I did not find much documentation for that feature.

Wouldn't it be better to print an error message when the options are used on those architectures?

Michael

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw
Quoted 10 lines · Michael Holzheu

Hello Simon,

I think the --load-preserve-context and --load-jump-back-helper kexec options are not working on s390 because we do not support CONFIG_KEXEC_JUMP. I assume the same is true also on other architectures. Correct me, if I am wrong. Unfortunately I did not find much documentation for that feature.

Wouldn't it be better to print an error message when the options are used on those architectures?

Ideally it would be nice if kexec-tools could ask the kernel if KEXEC_JUMP is supported (or enabled?) or not rather than hardcoding this information into kexec-tools on a per-architecture basis.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 9 lines · Simon Horman
Quoted 8 lines · Michael Holzheu

Hello Simon,

I think the --load-preserve-context and --load-jump-back-helper kexec options are not working on s390 because we do not support CONFIG_KEXEC_JUMP. I assume the same is true also on other architectures. Correct me, if I am wrong. Unfortunately I did not find much documentation for that feature.

Quoted 6 lines
Quoted 2 lines

Wouldn't it be better to print an error message when the options are used on those architectures?

Ideally it would be nice if kexec-tools could ask the kernel if KEXEC_JUMP is supported (or enabled?) or not rather than hardcoding this information into kexec-tools on a per-architecture basis.

Shouldn't kexec system call return error if KEXEC_JUMP is not supported and user asked for it?

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

Hello Vivec,

Quoted 13 lines · Vivek Goyal
Quoted 12 lines · Simon Horman
Quoted 10 lines · Michael Holzheu

Hello Simon,

I think the --load-preserve-context and --load-jump-back-helper kexec options are not working on s390 because we do not support CONFIG_KEXEC_JUMP. I assume the same is true also on other architectures. Correct me, if I am wrong. Unfortunately I did not find much documentation for that feature.

Wouldn't it be better to print an error message when the options are used on those architectures?

Quoted 6 lines
Quoted 3 lines

Ideally it would be nice if kexec-tools could ask the kernel if KEXEC_JUMP is supported (or enabled?) or not rather than hardcoding this information into kexec-tools on a per-architecture basis.

Shouldn't kexec system call return error if KEXEC_JUMP is not supported and user asked for it?

I think currently not. I assume that we should check the KEXEC_PRESERVE_CONTEXT flag in the kexec_load system call.

What about the following:

---
 kernel/kexec.c |    4 ++++
 1 file changed, 4 insertions(+)
kernel/kexec.c +4 -0
@@ -949,6 +949,10 @@ SYSCALL_DEFINE4(kexec_load, unsigned lon
 	if (!capable(CAP_SYS_BOOT))
 		return -EPERM;
 
+#ifndef CONFIG_KEXEC_JUMP
+	if (flags & KEXEC_PRESERVE_CONTEXT)
+		return -EOPNOTSUPP;
+#endif
 	/*
 	 * Verify we have a legal set of flags
 	 * This leaves us room for future extensions.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
Quoted 1 line · Michael Holzheu

Hello Vivec,

Right spelling is "Vivek" and not "Vivec" :-)

[..]

Quoted 6 lines
Quoted 2 lines

Shouldn't kexec system call return error if KEXEC_JUMP is not supported and user asked for it?

I think currently not. I assume that we should check the KEXEC_PRESERVE_CONTEXT flag in the kexec_load system call.

Shouldn't following existing code take care of this already?

        /*
         * Verify we have a legal set of flags
         * This leaves us room for future extensions.
         */
        if ((flags & KEXEC_FLAGS) != (flags & ~KEXEC_ARCH_MASK))
                return -EINVAL;

In include/linux/kexec.h, we have following.

/* List of defined/legal kexec flags */
#ifndef CONFIG_KEXEC_JUMP
#define KEXEC_FLAGS KEXEC_ON_CRASH
#else
#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
#endif

Not sure why it is not working.

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw

Hello Vivek,

Quoted 4 lines · Vivek Goyal
Quoted 1 line · Michael Holzheu

Hello Vivec,

Right spelling is "Vivek" and not "Vivec" :-)

I know... and I really wanted to avoid that error. But somehow the "c" is always coming automatically :-)

Quoted 19 lines

[..]

Quoted 6 lines
Quoted 2 lines

Shouldn't kexec system call return error if KEXEC_JUMP is not supported and user asked for it?

I think currently not. I assume that we should check the KEXEC_PRESERVE_CONTEXT flag in the kexec_load system call.

Shouldn't following existing code take care of this already?

        /*
         * Verify we have a legal set of flags
         * This leaves us room for future extensions.
         */
        if ((flags & KEXEC_FLAGS) != (flags & ~KEXEC_ARCH_MASK))
                return -EINVAL;

In include/linux/kexec.h, we have following.

Quoted 8 lines

/* List of defined/legal kexec flags */
#ifndef CONFIG_KEXEC_JUMP
#define KEXEC_FLAGS KEXEC_ON_CRASH
#else
#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
#endif

Not sure why it is not working.

Hmmm, actually it is working. I somehow must have overlooked that before.

When I call kexec with --load-preserve-context - while not really knowing what I am doing here - I get the following:

# kexec -p /boot/vmlinuz --load-preserve-context --mem-min=0x10000
--mem-max=0x100000000 

kexec_load failed: Invalid argument
entry = 0x10000 flags = 160002
nr_segments = 2
segment[0].buf = 0x3fffc989010
segment[0].bufsz = 330600
segment[0].mem = 0x10000
segment[0].memsz = 331000
segment[1].buf = (nil)
segment[1].bufsz = 0
segment[1].mem = 0x341000
segment[1].memsz = 334be000

Perhaps a better error message could help here. But there are several possible reasons for getting EINVAL from kexec_load(). So probably we can't say "--load-preserve-context not supported by current kernel" every time we get EINVAL from kexec_load().

Not sure what to do here. Perhaps we just leave it as it is.

BTW: Is there any good documentation on KEXEC_PRESERVE_CONTEXT?

Michael

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#6 lore raw

On Tue, Oct 04, 2011 at 04:07:06PM +0200, Michael Holzheu wrote:

[..]

Quoted 23 lines
Quoted 1 line

Not sure why it is not working.

Hmmm, actually it is working. I somehow must have overlooked that before.

When I call kexec with --load-preserve-context - while not really knowing what I am doing here - I get the following:

# kexec -p /boot/vmlinuz --load-preserve-context --mem-min=0x10000
--mem-max=0x100000000 

kexec_load failed: Invalid argument
entry = 0x10000 flags = 160002
nr_segments = 2
segment[0].buf = 0x3fffc989010
segment[0].bufsz = 330600
segment[0].mem = 0x10000
segment[0].memsz = 331000
segment[1].buf = (nil)
segment[1].bufsz = 0
segment[1].mem = 0x341000
segment[1].memsz = 334be000

Quoted 6 lines

Perhaps a better error message could help here. But there are several possible reasons for getting EINVAL from kexec_load(). So probably we can't say "--load-preserve-context not supported by current kernel" every time we get EINVAL from kexec_load().

Not sure what to do here. Perhaps we just leave it as it is.

I am also not sure what can we do here. There are many cases where -EINVAL can happen.

Quoted 2 lines

BTW: Is there any good documentation on KEXEC_PRESERVE_CONTEXT?

I am not aware of any and really wished there was one

Huang, is there any? Also is anybody using KEXEC_PRESERVE_CONTEXT? I have not encountered any users yet.

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec