* [PATCH] kexec: Make --status work with normal kexec images
@ 2021-03-23 17:50 Raphael Ning
2021-04-02 10:01 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Raphael Ning @ 2021-03-23 17:50 UTC (permalink / raw)
To: Simon Horman; +Cc: kexec, Raphael Ning, Julien Grall, Hongyan Xia, Raphael Ning
From: Raphael Ning <raphning@amazon.com>
According to kexec(8) manpage, --status (-S) works with both
normal kexec (loaded by -l) and crash kernel (loaded by -p) image
types, and defaults to the latter. However, the implementation does
not match the description: `kexec -l -S` queries the -p image type
as if -l were not specified. This is because there is no internal
flag defined for the normal kexec type, and -S treats the zero flag
as the trigger for the default behaviour (-p).
Fix that by making sure the default behaviour for -S is not applied
when the -l option is present.
Signed-off-by: Raphael Ning <raphning@amazon.com>
---
kexec/kexec.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kexec/kexec.c b/kexec/kexec.c
index ffc689ac3d7f..0c4b9619bfd7 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1336,6 +1336,7 @@ static void print_crashkernel_region_size(void)
int main(int argc, char *argv[])
{
+ int has_opt_load = 0;
int do_load = 1;
int do_exec = 0;
int do_load_jump_back_helper = 0;
@@ -1393,6 +1394,7 @@ int main(int argc, char *argv[])
do_exec = 1;
break;
case OPT_LOAD:
+ has_opt_load = 1;
do_load = 1;
do_exec = 0;
do_shutdown = 0;
@@ -1512,7 +1514,7 @@ int main(int argc, char *argv[])
do_sync = 0;
if (do_status) {
- if (kexec_flags == 0)
+ if (kexec_flags == 0 && !has_opt_load)
kexec_flags = KEXEC_ON_CRASH;
do_load = 0;
do_reuse_initrd = 0;
--
2.23.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kexec: Make --status work with normal kexec images
2021-03-23 17:50 [PATCH] kexec: Make --status work with normal kexec images Raphael Ning
@ 2021-04-02 10:01 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2021-04-02 10:01 UTC (permalink / raw)
To: Raphael Ning; +Cc: kexec, Julien Grall, Hongyan Xia, Raphael Ning
On Tue, Mar 23, 2021 at 05:50:07PM +0000, Raphael Ning wrote:
> From: Raphael Ning <raphning@amazon.com>
>
> According to kexec(8) manpage, --status (-S) works with both
> normal kexec (loaded by -l) and crash kernel (loaded by -p) image
> types, and defaults to the latter. However, the implementation does
> not match the description: `kexec -l -S` queries the -p image type
> as if -l were not specified. This is because there is no internal
> flag defined for the normal kexec type, and -S treats the zero flag
> as the trigger for the default behaviour (-p).
>
> Fix that by making sure the default behaviour for -S is not applied
> when the -l option is present.
>
> Signed-off-by: Raphael Ning <raphning@amazon.com>
Thanks, applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-02 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 17:50 [PATCH] kexec: Make --status work with normal kexec images Raphael Ning
2021-04-02 10:01 ` Simon Horman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.