From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Keir Fraser <keir@xen.org>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH] x86/ACPI: allow CMOS RTC use even when ACPI says there is none
Date: Mon, 28 Jul 2014 14:46:09 +0100 [thread overview]
Message-ID: <53D65421.6060305@citrix.com> (raw)
In-Reply-To: <53D66D020200007800026A2A@mail.emea.novell.com>
On 28/07/14 14:32, Jan Beulich wrote:
>>>> On 28.07.14 at 15:04, <andrew.cooper3@citrix.com> wrote:
>> On 28/07/14 13:47, Jan Beulich wrote:
>>>>> +
>>>>> + start = NOW();
>>>>> + do { /* must try at least 2.228 ms */
>>>>> + t2 = NOW() - start;
>>>>> + } while ( (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
>>>>> + t2 < MILLISECS(3) );
>>>>> +
>>>>> + __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;
>>>>> - for ( i = 0 ; i < 1000000 ; i++ ) /* must try at least 2.228 ms */
>>>>> - if ( !(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) )
>>>>> +
>>>>> + if ( seconds < 60 )
>>>> Seconds doesn't appear to be updated before this point, meaning that we
>>>> will reprobe even if we find a plausible RTC.
>>> But that's exactly the point: We want to go through the loop twice.
>>> Only if the second round results in updated seconds do we consider
>>> the RTC okay for use.
>> Right, but in the case that the RTC is handing back static values (which
>> is slightly more likely if we are probing something which might not be a
>> CMOS RTC), we will sit in the loop forever.
> We won't: If seconds is an invalid value, we bail in the first iteration.
> If seconds is a valid value but unchanged on the second iteration,
> we bail there (see the still available context below.
>
> Jan
Silly me. I had mentally included the break in the if ( rtc.sec !=
seconds ) scope.
In which case, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Unfortunately we don't have affected hardware to test with.
~Andrew
>
>>>>> + {
>>>>> + if ( rtc.sec != seconds )
>>>>> + cmos_rtc_probe = 0;
>>>>> break;
>>>>> + }
>>>>> +
>>>>> + process_pending_softirqs();
>>>>> +
>>>>> + seconds = rtc.sec;
>>>>> + }
>>>>>
>>>>> - res = __get_cmos_time();
>>>>> + if ( unlikely(cmos_rtc_probe) )
>>>>> + panic("No CMOS RTC found - system must be booted from EFI");
>
prev parent reply other threads:[~2014-07-28 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 14:57 [PATCH] x86/ACPI: allow CMOS RTC use even when ACPI says there is none Jan Beulich
2014-07-28 12:40 ` Andrew Cooper
2014-07-28 12:47 ` Jan Beulich
2014-07-28 13:04 ` Andrew Cooper
2014-07-28 13:32 ` Jan Beulich
2014-07-28 13:46 ` Andrew Cooper [this message]
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=53D65421.6060305@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).