mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Baskov Evgeniy <baskov@ispras.ru>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] x86: Parse CONFIG_CMDLINE in compressed kernel
Date: Thu, 12 May 2022 13:21:12 +0200	[thread overview]
Message-ID: <YnztqAtNEvnF5YcX@zn.tnic> (raw)
In-Reply-To: <20220505103224.21667-3-baskov@ispras.ru>

On Thu, May 05, 2022 at 01:32:24PM +0300, Baskov Evgeniy wrote:

Same note on the subject format as for your previous patch.

> CONFIG_CMDLINE, CONFIG_CMDLINE_BOOL, and CONFIG_CMDLINE_OVERRIDE were
> ignored during options lookup in compressed kernel.
> 
> Parse CONFIG_CMDLINE-related options correctly in compressed kernel
> code.
> 
> cmd_line_ptr_init is explicitly placed in .data section since it is
> used and expected to be equal to zero before .bss section is cleared.

What I'm missing in this commit message is the use case which you have
in your 0/2 mail.

Also, to the tone of your commit messages, from
Documentation/process/submitting-patches.rst:

 "Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
  instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
  to do frotz", as if you are giving orders to the codebase to change
  its behaviour."

Also, do not talk about what your patch does - that should hopefully be
visible in the diff itself. Rather, talk about *why* you're doing what
you're doing.

> Signed-off-by: Baskov Evgeniy <baskov@ispras.ru>
> 
> diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
> index f1add5d85da9..261f53ad395a 100644
> --- a/arch/x86/boot/compressed/cmdline.c
> +++ b/arch/x86/boot/compressed/cmdline.c
> @@ -1,6 +1,8 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include "misc.h"
>  
> +#define COMMAND_LINE_SIZE 2048
> +
>  static unsigned long fs;
>  static inline void set_fs(unsigned long seg)
>  {
> @@ -12,12 +14,32 @@ static inline char rdfs8(addr_t addr)
>  	return *((char *)(fs + addr));
>  }
>  #include "../cmdline.c"
> +
> +#ifdef CONFIG_CMDLINE_BOOL
> +static char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
> +static bool builtin_cmdline_init __section(".data");
> +#endif
> +
>  unsigned long get_cmd_line_ptr(void)
>  {
>  	unsigned long cmd_line_ptr = boot_params->hdr.cmd_line_ptr;
> -
>  	cmd_line_ptr |= (u64)boot_params->ext_cmd_line_ptr << 32;
>  
> +#ifdef CONFIG_CMDLINE_BOOL
> +	if (!builtin_cmdline_init) {
> +		if (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
> +			strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
> +			strlcat(builtin_cmdline,
> +				(char *)cmd_line_ptr,
> +				COMMAND_LINE_SIZE);
> +		}
> +
> +		builtin_cmdline_init = 1;
> +	}
> +
> +	cmd_line_ptr = (unsigned long)builtin_cmdline;
> +#endif

I had asked this already but let me try again: instead of copying this
from kernel proper, why don't you add a common helper which you call
from both locations?

And it is not like this is going to be a huge function so you can stick
it into a shared header in arch/x86/include/asm/shared/ and it'll get
inlined into both locations...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2022-05-12 11:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  2:40 [PATCH] " Baskov Evgeniy
2022-05-04  8:59 ` Borislav Petkov
2022-05-04 20:40   ` baskov
2022-05-04 20:41   ` [PATCH v2 0/2] " Baskov Evgeniy
2022-05-04 20:41     ` [PATCH v2 1/2] x86: add strlcat() to " Baskov Evgeniy
2022-05-04 20:41     ` [PATCH v2 2/2] x86: Parse CONFIG_CMDLINE in " Baskov Evgeniy
2022-05-05 10:32   ` [PATCH v3 0/2] " Baskov Evgeniy
2022-05-05 10:32     ` [PATCH v3 1/2] x86: Add strlcat() to " Baskov Evgeniy
2022-05-12 11:10       ` Borislav Petkov
2022-05-25  5:18         ` baskov
2022-05-05 10:32     ` [PATCH v3 2/2] x86: Parse CONFIG_CMDLINE in " Baskov Evgeniy
2022-05-12 11:21       ` Borislav Petkov [this message]
2022-05-25  5:25         ` baskov
2022-05-25  8:22           ` Borislav Petkov
2022-05-25  9:41             ` baskov
2022-05-25 10:10     ` [PATCH v4 0/5] " Evgeniy Baskov
2022-05-25 10:10       ` [PATCH v4 1/5] x86/boot: Add strlcat() to " Evgeniy Baskov
2022-05-25 10:10       ` [PATCH v4 2/5] x86: Add resolve_cmdline() helper Evgeniy Baskov
2022-08-26 11:35         ` Borislav Petkov
2022-08-27  1:51           ` Evgeniy Baskov
2022-05-25 10:10       ` [PATCH v4 3/5] x86/setup: Use resolve_cmdline() in setup.c Evgeniy Baskov
2022-05-25 10:10       ` [PATCH v4 4/5] x86/boot: Use resolve_cmdline() in compressed kernel Evgeniy Baskov
2022-05-25 10:10       ` [PATCH v4 5/5] x86/boot: Remove no longer needed includes Evgeniy Baskov

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=YnztqAtNEvnF5YcX@zn.tnic \
    --to=bp@alien8.de \
    --cc=baskov@ispras.ru \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®