All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: marmarek@invisiblethingslab.com,
	Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org,
	Daniel Kiper <daniel.kiper@oracle.com>
Subject: Re: [PATCH 4/5] multiboot2: parse console= option when setting GOP mode
Date: Wed, 29 Mar 2023 18:29:07 +0200	[thread overview]
Message-ID: <ZCRnU03XDCpqZQ5u@Air-de-Roger> (raw)
In-Reply-To: <8f7e0393-8c0f-a924-7cee-25b9fca6f739@suse.com>

On Mon, Dec 05, 2022 at 04:10:28PM +0100, Jan Beulich wrote:
> On 23.11.2022 16:45, Roger Pau Monne wrote:
> > @@ -265,6 +266,15 @@ __efi64_mb2_start:
> >          cmpl    $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx)
> >          je      .Lrun_bs
> >  
> > +        /*
> > +         * Get command line from Multiboot2 information.
> > +         * Must be last parsed tag.
> 
> Why? And how do you guarantee this?

I think the comment is misleading, must be the last checked for tag in
the loop that does this in assembly, because it's not using cmove.
I've adjusted to:

        /* Get command line from Multiboot2 information. */
        cmpl    $MULTIBOOT2_TAG_TYPE_CMDLINE,MB2_tag_type(%rcx)
        jne     .Lno_cmdline
        lea     MB2_tag_string(%rcx),%rdx
        jmp     .Lefi_mb2_next_tag
.Lno_cmdline:

Maybe there's some instruction I'm missing similar to a conditional
lea?

> > --- a/xen/arch/x86/efi/efi-boot.h
> > +++ b/xen/arch/x86/efi/efi-boot.h
> > @@ -786,7 +786,22 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable)
> >  
> >  static void __init efi_arch_flush_dcache_area(const void *vaddr, UINTN size) { }
> >  
> > -void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
> > +/* Return the last occurrence of opt in cmd. */
> 
> Is this sufficient in the general case (it may be for "console=", but
> perhaps not for "vga=", which may also need finding as per below)?

I guess for vga= it's possible to have something like:

vga=current vga=keep

And in that case we do care about the non-last option.

> > +static const char __init *get_option(const char *cmd, const char *opt)
> 
> Nit: The first * wants to move earlier.
> 
> > +{
> > +    const char *s = cmd, *o = NULL;
> > +
> > +    while ( (s = strstr(s, opt)) != NULL )
> 
> I'm afraid this is too easy to break without considering separators as
> well. If I'm not mistaken you'd also match e.g. "sync_console=1" for
> the sole present caller.

Right, wasn't taking into account that sync_console can also be a
boolean (and thus assigned).

> > +        }
> 
> Nit: No need for the braces in cases like this one.

I've added the braces here because it will be expended in the next
patch.  Since you asked for both patches to be merged this will go
away.

Thanks, Roger.


  parent reply	other threads:[~2023-03-29 16:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 15:45 [PATCH 0/5] gfx: improvements when using multiboot2 and EFI + misc Roger Pau Monne
2022-11-23 15:45 ` [PATCH 1/5] x86/platform: introduce hypercall to get initial video console settings Roger Pau Monne
2022-12-05 13:00   ` Jan Beulich
2022-11-23 15:45 ` [PATCH 2/5] efi: only set a console mode if the current one is invalid Roger Pau Monne
2022-12-05 14:19   ` Jan Beulich
2023-03-30 15:44     ` Roger Pau Monné
2023-03-30 16:07       ` Jan Beulich
2023-03-30 16:17         ` Roger Pau Monné
2023-03-31  6:51           ` Jan Beulich
2023-03-31  7:37             ` Roger Pau Monné
2023-04-03 11:03               ` Jan Beulich
2022-11-23 15:45 ` [PATCH 3/5] efi: try to use the currently set GOP mode Roger Pau Monne
2022-12-05 14:32   ` Jan Beulich
2022-11-23 15:45 ` [PATCH 4/5] multiboot2: parse console= option when setting " Roger Pau Monne
2022-12-05 15:10   ` Jan Beulich
2022-12-05 16:01     ` Jan Beulich
2022-12-13 11:41     ` Daniel Kiper
2023-03-29 16:29     ` Roger Pau Monné [this message]
2023-03-30  6:24       ` Jan Beulich
2023-03-30  8:11         ` Roger Pau Monné
2023-03-30  8:52           ` Jan Beulich
2022-11-23 15:45 ` [PATCH 5/5] multiboot2: parse vga= " Roger Pau Monne
2022-12-05 16:26   ` Jan Beulich
2022-11-24  5:15 ` [PATCH 0/5] gfx: improvements when using multiboot2 and EFI + misc Marek Marczykowski-Górecki
2022-11-24  8:11   ` Jan Beulich
2022-11-24  8:59   ` Roger Pau Monné
2022-11-24  9:56     ` Roger Pau Monné
2022-11-24 15:00       ` Marek Marczykowski-Górecki

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=ZCRnU03XDCpqZQ5u@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=daniel.kiper@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 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.