From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Daniel P. Smith" <dpsmith@apertussolutions.com>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 3/4] x86/time: introduce command line option to select wallclock
Date: Tue, 10 Sep 2024 16:24:50 +0200 [thread overview]
Message-ID: <ZuBWsn2wgf9g1Nyv@macbook.local> (raw)
In-Reply-To: <a52b019c-3f1c-4528-91f4-7bc1258c87d9@suse.com>
On Tue, Sep 10, 2024 at 03:49:52PM +0200, Jan Beulich wrote:
> On 10.09.2024 15:10, Roger Pau Monné wrote:
> > On Tue, Sep 10, 2024 at 11:32:05AM +0200, Jan Beulich wrote:
> >> On 09.09.2024 16:54, Roger Pau Monne wrote:
> >>> --- a/xen/arch/x86/time.c
> >>> +++ b/xen/arch/x86/time.c
> >>> @@ -1550,6 +1550,36 @@ static const char *__init wallclock_type_to_string(void)
> >>> return "";
> >>> }
> >>>
> >>> +static int __init cf_check parse_wallclock(const char *arg)
> >>> +{
> >>> + if ( !arg )
> >>> + return -EINVAL;
> >>> +
> >>> + if ( !strcmp("auto", arg) )
> >>> + wallclock_source = WALLCLOCK_UNSET;
> >>> + else if ( !strcmp("xen", arg) )
> >>> + {
> >>> + if ( !xen_guest )
> >>> + return -EINVAL;
> >>> +
> >>> + wallclock_source = WALLCLOCK_XEN;
> >>> + }
> >>> + else if ( !strcmp("cmos", arg) )
> >>> + wallclock_source = WALLCLOCK_CMOS;
> >>> + else if ( !strcmp("efi", arg) )
> >>> + {
> >>> + if ( !efi_enabled(EFI_RS) )
> >>> + return -EINVAL;
> >>
> >> I'm afraid there's a problem here, and I'm sorry for not paying attention
> >> earlier: EFI_RS is possibly affected by "efi=" (and hence may change after
> >> this code ran). (It can also be cleared if ->SetVirtualAddressMap() fails,
> >> but I think that's strictly ahead of command line parsing.)
> >
> > Hm, I see, thanks for noticing. Anyone using 'efi=no-rs
> > wallclock=efi' likely deserves to be punished.
>
> Well, if you don't want to actually do this ;-) then ...
It's not too complicated to attempt to arrange for something half sane
even if the user provided options are nonsense. I've seen people
accumulate all kind of crap on the command line "just because I've
read it online".
> > Would you be fine with
> > adding the following in init_xen_time():
> >
> > /*
> > * EFI run time services can be disabled form the command line, hence the
> > * check for them cannot be done as part of the wallclock option parsing.
> > */
> > if ( wallclock_source == WALLCLOCK_EFI && !efi_enabled(EFI_RS) )
> > wallclock_source = WALLCLOCK_UNSET;
> >
> > if ( wallclock_source == WALLCLOCK_UNSET )
> > probe_wallclock();
>
> ... this is probably the best we can do (nit: s/form/from/ in the comment;
> maybe also "..., hence the check done as part of option parsing may not
> suffice" or some such).
I didn't put in my previous reply, but I've removed the efi_enabled()
check from the option parsing and instead added this comment:
/*
* Checking if run-time services are available must be done after
* command line parsing.
*/
I don't think there's much point in doing the check in
parse_wallclock() if it's not reliable, so your reference in the
comment to "the check done as part of option parsing" is no longer
valid.
Thanks, Roger.
next prev parent reply other threads:[~2024-09-10 14:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 14:54 [PATCH v5 0/4] x86/time: improvements to wallclock logic Roger Pau Monne
2024-09-09 14:54 ` [PATCH v5 1/4] x86/time: pull cmos_rtc_probe outside of function and rename Roger Pau Monne
2024-09-09 15:04 ` Jan Beulich
2024-09-09 14:54 ` [PATCH v5 2/4] x86/time: introduce probing logic for the wallclock Roger Pau Monne
2024-09-10 9:23 ` Jan Beulich
2024-09-09 14:54 ` [PATCH v5 3/4] x86/time: introduce command line option to select wallclock Roger Pau Monne
2024-09-10 9:32 ` Jan Beulich
2024-09-10 13:10 ` Roger Pau Monné
2024-09-10 13:49 ` Jan Beulich
2024-09-10 14:24 ` Roger Pau Monné [this message]
2024-09-10 14:29 ` Jan Beulich
2024-09-10 16:20 ` Roger Pau Monné
2024-09-09 14:54 ` [PATCH v5 4/4] x86/time: prefer CMOS over EFI_GET_TIME Roger Pau Monne
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=ZuBWsn2wgf9g1Nyv@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dpsmith@apertussolutions.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=marmarek@invisiblethingslab.com \
--cc=sstabellini@kernel.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.