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>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 1/2] x86/time: split CMOS time fetching into wrapper
Date: Tue, 3 Sep 2024 10:38:35 +0200 [thread overview]
Message-ID: <ZtbLC1Yz6drguz9F@macbook.local> (raw)
In-Reply-To: <d7cfa284-f764-46a0-ac2e-e5f928a043ad@suse.com>
On Tue, Sep 03, 2024 at 09:53:47AM +0200, Jan Beulich wrote:
> On 03.09.2024 09:35, Roger Pau Monné wrote:
> > On Tue, Sep 03, 2024 at 08:24:18AM +0200, Jan Beulich wrote:
> >> On 30.08.2024 11:52, Roger Pau Monne wrote:
> >>> @@ -1285,33 +1270,56 @@ static unsigned long get_cmos_time(void)
> >>> } while ( (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
> >>> t2 < MILLISECS(3) );
> >>>
> >>> - __get_cmos_time(&rtc);
> >>> + __get_cmos_time(rtc);
> >>>
> >>> spin_unlock_irqrestore(&rtc_lock, flags);
> >>>
> >>> - if ( likely(!cmos_rtc_probe) ||
> >>> - t1 > SECONDS(1) || t2 >= MILLISECS(3) ||
> >>> - rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
> >>> - !rtc.day || rtc.day > 31 ||
> >>> - !rtc.mon || rtc.mon > 12 )
> >>> - break;
> >>> + if ( likely(!cmos_rtc_probe) )
> >>> + return true;
> >>> +
> >>> + if ( t1 > SECONDS(1) || t2 >= MILLISECS(3) ||
> >>> + rtc->sec >= 60 || rtc->min >= 60 || rtc->hour >= 24 ||
> >>> + !rtc->day || rtc->day > 31 ||
> >>> + !rtc->mon || rtc->mon > 12 )
> >>> + return false;
> >>>
> >>> if ( seconds < 60 )
> >>> {
> >>> - if ( rtc.sec != seconds )
> >>> - {
> >>> - cmos_rtc_probe = false;
> >>
> >> This clearing of the variable is lost, which looks wrong to me.
> >
> > Note the code in get_cmos_time() is modified, so the variable is no
> > longer used past the call to read_cmos_time(). Instead the signaling
> > of whether the CMOS is functional or not is done using the return
> > value of the newly introduced read_cmos_time() function.
>
> I wasn't concerned of the further processing on the 1st invocation, but
> of the behavior of the 2nd invocation. But yes, there the flag will end
> up being cleared because of the FADT flag also having been cleared. Not
> easily visible, though. Could minimally do with a remark in the
> description.
Indeed, the variable gets clearer on further invocations, as the
adjustment to ACPI_FADT_NO_CMOS_RTC gets propagated.
Given Andrew comments, I've reworked all of this and I think it ended
up being clearer.
Thanks, Roger.
next prev parent reply other threads:[~2024-09-03 8:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 9:52 [PATCH v2 0/2] x86/time: prefer CMOS over EFI_GET_TIME Roger Pau Monne
2024-08-30 9:52 ` [PATCH v2 1/2] x86/time: split CMOS time fetching into wrapper Roger Pau Monne
2024-08-30 15:47 ` Andrew Cooper
2024-09-03 6:24 ` Jan Beulich
2024-09-03 7:35 ` Roger Pau Monné
2024-09-03 7:53 ` Jan Beulich
2024-09-03 8:38 ` Roger Pau Monné [this message]
2024-08-30 9:52 ` [PATCH v2 2/2] x86/time: prefer CMOS over EFI_GET_TIME Roger Pau Monne
2024-08-30 16:31 ` Andrew Cooper
2024-09-02 8:13 ` Jan Beulich
2024-09-02 8:45 ` Roger Pau Monné
2024-09-02 8:56 ` Jan Beulich
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=ZtbLC1Yz6drguz9F@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dpsmith@apertussolutions.com \
--cc=jbeulich@suse.com \
--cc=marmarek@invisiblethingslab.com \
--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.