linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: "Mateusz Jończyk" <mat.jonczyk@o2.pl>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-rtc@vger.kernel.org
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Shuah Khan <shuah@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests/rtc: continuously read RTC in a loop for 30s
Date: Fri, 25 Feb 2022 17:02:43 -0700	[thread overview]
Message-ID: <fb6da998-3970-90f9-f79e-386987bfd431@linuxfoundation.org> (raw)
In-Reply-To: <6d8f500d-0ee0-3e27-dfdf-e8c0a34880e5@linuxfoundation.org>

On 2/25/22 1:56 PM, Shuah Khan wrote:
> On 2/19/22 12:27 AM, Mateusz Jończyk wrote:
>> Some problems with reading the RTC time may happen rarely, for example
>> while the RTC is updating. So read the RTC many times to catch these
>> problems. For example, a previous attempt for my
>> commit ea6fa4961aab ("rtc: mc146818-lib: fix RTC presence check")
>> was incorrect and would have triggered this selftest.
>>
>> To avoid the risk of damaging the hardware, wait 11ms before consecutive
>> reads.
>>
>> In rtc_time_to_timestamp I copied values manually instead of casting -
>> just to be on the safe side. The 11ms wait period was chosen so that it is
>> not a divisor of 1000ms.
>>
>> Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
>> Cc: Alessandro Zummo <a.zummo@towertech.it>
>> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
>> Cc: Shuah Khan <shuah@kernel.org>
>> ---
>>
>> Also, before
>> commit cdedc45c579f ("rtc: cmos: avoid UIP when reading alarm time")
>> reading the RTC alarm time during RTC update produced incorrect results
>> on many Intel platforms. Preparing a similar selftest for this case
>> would be more difficult, though, because the RTC alarm time is cached by
>> the kernel. Direct access would have to be exposed somehow, for example
>> in debugfs. I may prepare a patch for it in the future.
>> ---
> 
> Looks good to me. We end up tweaking the timeout=210 in settings every
> now and then. Not sure how we can avoid adjusting it as we find problems.
> 
> I will apply this in for Linux 5.18-rc1
> 

Applied to linux-kselftest next for Linux 5.18-rc1

thanks,
-- Shuah

      reply	other threads:[~2022-02-26  0:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-19  7:27 [PATCH] selftests/rtc: continuously read RTC in a loop for 30s Mateusz Jończyk
2022-02-25 20:56 ` Shuah Khan
2022-02-26  0:02   ` Shuah Khan [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=fb6da998-3970-90f9-f79e-386987bfd431@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mat.jonczyk@o2.pl \
    --cc=shuah@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;
as well as URLs for NNTP newsgroup(s).