All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Suchánek" <msuchanek@suse.de>
To: Simon Horman <horms@verge.net.au>
Cc: Petr Tesarik <ptesarik@suse.cz>,
	kexec@lists.infradead.org, Tony Jones <tonyj@suse.com>
Subject: Re: [PATCH 2/5] kexec: do not special-case the -s option
Date: Fri, 2 Mar 2018 14:38:22 +0100	[thread overview]
Message-ID: <20180302143822.7b0fc155@kitsune.suse.cz> (raw)
In-Reply-To: <20180302123616.4avyougf2aeagvqy@verge.net.au>

On Fri, 2 Mar 2018 13:36:16 +0100
Simon Horman <horms@verge.net.au> wrote:

> On Mon, Feb 26, 2018 at 01:00:35PM +0100, Michal Suchanek wrote:
> > It is parsed separately to save a few CPU cycles when setting up
> > other options but it just complicates the code. So fold it back and
> > set up all flags both for KEXEC_LOAD and KEXEC_FILE_LOAD
> > 
> > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > ---
> >  kexec/kexec.c | 25 ++++---------------------
> >  1 file changed, 4 insertions(+), 21 deletions(-)
> > 
> > diff --git a/kexec/kexec.c b/kexec/kexec.c
> > index ab8cff7fe083..9ea102e1565a 100644
> > --- a/kexec/kexec.c
> > +++ b/kexec/kexec.c
> > @@ -1256,19 +1256,6 @@ int main(int argc, char *argv[])
> >  	};
> >  	static const char short_options[] = KEXEC_ALL_OPT_STR;
> >  
> > -	/*
> > -	 * First check if --use-kexec-file-syscall is set. That
> > changes lot of
> > -	 * things
> > -	 */
> > -	while ((opt = getopt_long(argc, argv, short_options,
> > -				  options, 0)) != -1) {
> > -		switch(opt) {
> > -		case OPT_KEXEC_FILE_SYSCALL:
> > -			do_kexec_file_syscall = 1;
> > -			break;
> > -		}
> > -	}
> > -
> >  	/* Reset getopt for the next pass. */
> >  	opterr = 1;
> >  	optind = 1;
> > @@ -1310,8 +1297,7 @@ int main(int argc, char *argv[])
> >  			do_shutdown = 0;
> >  			do_sync = 0;
> >  			do_unload = 1;
> > -			if (do_kexec_file_syscall)
> > -				kexec_file_flags |=
> > KEXEC_FILE_UNLOAD;
> > +			kexec_file_flags |= KEXEC_FILE_UNLOAD;
> >  			break;
> >  		case OPT_EXEC:
> >  			do_load = 0;
> > @@ -1354,11 +1340,8 @@ int main(int argc, char *argv[])
> >  			do_exec = 0;
> >  			do_shutdown = 0;
> >  			do_sync = 0;
> > -			if (do_kexec_file_syscall)
> > -				kexec_file_flags |=
> > KEXEC_FILE_ON_CRASH;
> > -			else
> > -				kexec_flags = KEXEC_ON_CRASH;
> > -			break;
> > +			kexec_file_flags |= KEXEC_FILE_ON_CRASH;
> > +			kexec_flags = KEXEC_ON_CRASH;  
> 
> This appears to change the logic of options parsing.
> 

Care to share how exactly is the logic changed? I do not see it. To me
it looks like we have separate flags for KEXEC_LOAD and KEXEC_FILE_LOAD
so setting up both does not change anything. Whatever syscall is used
it has the flags set up.

In the existing logic we decide which syscall to do beforehand and set
up only flags for that syscall but that does not save much CPU cycles
and makes the code more complex and fragile. 

Thanks

Michal

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2018-03-02 13:38 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 12:00 [PATCH 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Michal Suchanek
2018-02-26 12:00 ` [PATCH 2/5] kexec: do not special-case the -s option Michal Suchanek
2018-03-02 12:36   ` Simon Horman
2018-03-02 13:38     ` Michal Suchánek [this message]
2018-03-05  6:38       ` Simon Horman
2018-02-26 12:00 ` [PATCH 3/5] kexec: add option to revert -s Michal Suchanek
2018-02-26 12:00 ` [PATCH 4/5] kexec: fallback to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Michal Suchanek
2018-02-28 13:05   ` Michal Suchánek
2018-03-02  9:17   ` Dave Young
2018-03-05 17:49     ` Michal Suchánek
2018-03-06 13:15     ` [PATCH v4 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Michal Suchanek
2018-03-06 13:15     ` [PATCH v4 2/5] kexec: do not special-case the -s option Michal Suchanek
2018-03-15 10:38       ` Simon Horman
2018-03-15 11:13         ` Michal Suchánek
2018-03-16 11:20           ` Simon Horman
2018-03-16 11:38             ` Michal Suchánek
2018-03-16 11:47               ` Simon Horman
2018-03-06 13:15     ` [PATCH v4 3/5] kexec: add option to revert -s Michal Suchanek
2018-03-06 13:15     ` [PATCH v4 4/5] kexec: add option to fall back to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Michal Suchanek
2018-03-13 17:30       ` Tony Jones
2018-03-14  3:44         ` Dave Young
2018-03-14  3:21       ` Dave Young
2018-03-15 11:06         ` Michal Suchánek
2018-03-16  6:45           ` Dave Young
2018-03-16 11:44             ` Michal Suchánek
2018-03-14  3:22       ` Dave Young
2018-03-14  7:23         ` Michal Suchánek
2018-03-14  7:48           ` Dave Young
2018-03-06 13:15     ` [PATCH v4 5/5] kexec: document -s, -c and -a options Michal Suchanek
2018-03-14  3:41       ` Dave Young
2018-03-14  7:25         ` Michal Suchánek
2018-03-14  7:50           ` Dave Young
2018-03-15 11:44             ` Michal Suchánek
2018-03-16  6:51               ` Dave Young
2018-03-16 16:01                 ` Michal Suchánek
2018-03-14  3:43       ` Dave Young
2018-03-15 11:18         ` Michal Suchánek
2018-03-20 15:56     ` [PATCH v5 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Michal Suchanek
2018-03-26  7:25       ` Simon Horman
2018-03-26  7:53         ` Dave Young
2018-03-26 18:17           ` Michal Suchánek
2018-03-27  9:39             ` Dave Young
2018-03-20 15:56     ` [PATCH v5 2/5] kexec: Fix option checks to take KEXEC_FILE_LOAD into account Michal Suchanek
2018-03-20 15:56     ` [PATCH v5 3/5] kexec: Do not special-case the -s option Michal Suchanek
2018-03-20 15:56     ` [PATCH v5 4/5] kexec: Add option to fall back to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Michal Suchanek
2018-03-26  9:08       ` Dave Young
2018-03-26  9:12         ` Dave Young
2018-03-26 17:38           ` Michal Suchánek
2018-03-26 18:52             ` Thiago Jung Bauermann
2018-03-26 19:07               ` Michal Suchánek
2018-03-27  9:59               ` Dave Young
2018-03-28 13:15                 ` [PATCH v6 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Michal Suchanek
2018-03-28 13:15                   ` [PATCH v6 2/5] kexec: Fix option checks to take KEXEC_FILE_LOAD into account Michal Suchanek
2018-03-28 13:15                   ` [PATCH v6 3/5] kexec: Do not special-case the -s option Michal Suchanek
2018-04-05 11:05                     ` Petr Tesarik
2018-04-09  8:38                       ` Bhupesh Sharma
2018-03-28 13:15                   ` [PATCH v6 4/5] kexec: Add option to revert -s Michal Suchanek
2018-03-28 13:15                   ` [PATCH v6 5/5] kexec: Add option to fall back to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Michal Suchanek
2018-03-28 13:15                   ` [PATCH 6/6] kexec: Document -s, -c and -a options in the man page Michal Suchanek
2018-03-30  6:29                   ` [PATCH v6 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Simon Horman
2018-03-30  8:00                     ` Dave Young
2018-03-30  8:46                       ` Simon Horman
2018-03-27 10:06             ` [PATCH v5 4/5] kexec: Add option to fall back to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Dave Young
2018-03-27 11:01               ` Michal Suchánek
2018-03-27 11:10                 ` Petr Tesarik
2018-03-28  0:53                 ` Dave Young
2018-03-28  7:42                   ` Simon Horman
2018-03-20 15:56     ` [PATCH v5 5/5] kexec: Document -s, -c and -a options Michal Suchanek
2018-03-02  9:24   ` [PATCH 4/5] kexec: fallback to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Dave Young
2018-03-02 12:32     ` Michal Suchánek
2018-03-02 12:46       ` Simon Horman
2018-03-02 13:28         ` Michal Suchánek
2018-03-02 13:32         ` [PATCH v3 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Michal Suchanek
2018-03-02 13:33         ` [PATCH v3 2/5] kexec: do not special-case the -s option Michal Suchanek
2018-03-02 13:33         ` [PATCH v3 3/5] kexec: add option to revert -s Michal Suchanek
2018-03-02 13:33         ` [PATCH v3 4/5] kexec: fallback to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Michal Suchanek
2018-03-02 13:55           ` Michal Suchánek
2018-03-05 12:52           ` [PATCH] kexec: add option to fall back " Michal Suchanek
2018-03-02 13:33         ` [PATCH v3 5/5] kexec: document -s, -c and -a options Michal Suchanek
2018-03-05  1:51         ` [PATCH 4/5] kexec: fallback to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported Dave Young
2018-03-02 12:44   ` Simon Horman
2018-03-13 20:43     ` Michal Suchánek
2018-02-26 12:00 ` [PATCH 5/5] kexec: document -s and -c options Michal Suchanek
2018-03-02 12:34 ` [PATCH 1/5] kexec: Return -ENOSYS when kexec does not know how to call KEXEC_FILE_LOAD Simon Horman
2018-03-02 13:44   ` Michal Suchánek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180302143822.7b0fc155@kitsune.suse.cz \
    --to=msuchanek@suse.de \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=ptesarik@suse.cz \
    --cc=tonyj@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.