From: Thomas Gleixner <tglx@linutronix.de>
To: David Woodhouse <dwmw2@infradead.org>,
lirongqing@baidu.com, seanjc@google.com, kys@microsoft.com,
haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, linux-hyperv@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown
Date: Thu, 01 Aug 2024 20:57:06 +0200 [thread overview]
Message-ID: <87le1g2hrx.ffs@tglx> (raw)
In-Reply-To: <b781a3f94e7ff1c2b49101255d382ab9d8d74035.camel@infradead.org>
On Thu, Aug 01 2024 at 19:25, David Woodhouse wrote:
> On Thu, 2024-08-01 at 18:49 +0100, David Woodhouse wrote:
>> > The stop sequence is wrong:
>> >
>> > When there is a count in progress, writing a new LSB before the
>> > counter has counted down to 0 and rolled over to FFFFh, WILL stop
>> > the counter. However, if the LSB is loaded AFTER the counter has
>> > rolled over to FFFFh, so that an MSB now exists in the counter, then
>> > the counter WILL NOT stop.
>> >
>> > The original i8253 datasheet says:
>> >
>> > 1) Write 1st byte stops the current counting
>> > 2) Write 2nd byte starts the new count
>>
>
> It also prefixes that with "Rewriting a counter register during
> counting results in the following:".
>
> But after you write the MODE register, is it actually supposed to be
> counting? Just a little further up, under 'Counter Loading', it says:
It's not counting right out of reset. But once it started counting it's
tedious to stop :)
> "The count register is not loaded until the count value is written (one
> or two bytes, depending on the mode selected by the RL bits), followed
> by a rising edge and a falling edge of the clock. Any read of the
> counter prior to that falling clock edge may yield invalid data".
>
> OK, but what *triggers* that invalid state? Given that it explicitly
> says that a one-byte counter write ends that state, it isn't the first
> of two bytes. Surely that means that from the time the MODE register is
> written, any read of the counter may yield invalid data, until the
> counter is written?
It seems to keep ticking with the old value.
> I suspect there are as many implementations (virt and hardware) as
> there are reasonable interpretations of the spec... and then some.
Indeed.
Thanks,
tglx
next prev parent reply other threads:[~2024-08-01 18:57 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 1:14 [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown lirongqing
2023-02-08 1:04 ` Michael Kelley (LINUX)
2023-02-08 15:04 ` Sean Christopherson
2023-02-24 9:45 ` Li,Rongqing
[not found] ` <3b8496c071214bda9e5ecfa048f18ab9@baidu.com>
2023-04-13 1:28 ` Wei Liu
[not found] ` <1311175816673.202304.ZDdawTGHoa/UH20U@liuwe-devbox-debian-v2>
2023-04-14 5:17 ` Li,Rongqing
2024-08-01 9:00 ` David Woodhouse
2024-08-01 15:22 ` David Woodhouse
2024-08-01 21:07 ` Thomas Gleixner
2024-08-01 21:10 ` David Woodhouse
2024-08-01 14:21 ` Thomas Gleixner
2024-08-01 16:14 ` Michael Kelley
2024-08-01 18:54 ` Thomas Gleixner
2024-08-02 8:21 ` David Woodhouse
2024-08-02 14:55 ` Sean Christopherson
2024-08-02 15:04 ` David Woodhouse
2024-08-12 23:59 ` Sean Christopherson
2024-08-13 6:39 ` David Woodhouse
2024-08-01 17:49 ` David Woodhouse
2024-08-01 18:25 ` David Woodhouse
2024-08-01 18:57 ` Thomas Gleixner [this message]
2024-08-02 8:07 ` David Woodhouse
2024-08-02 10:49 ` Thomas Gleixner
2024-08-02 11:04 ` David Woodhouse
2024-08-02 13:27 ` Thomas Gleixner
2024-08-02 13:46 ` David Woodhouse
2024-08-01 19:06 ` Thomas Gleixner
2024-08-01 19:21 ` David Woodhouse
2024-08-01 20:00 ` Thomas Gleixner
2024-08-01 20:49 ` David Woodhouse
2024-08-01 21:22 ` Thomas Gleixner
2024-08-01 21:31 ` David Woodhouse
2024-08-02 9:55 ` David Woodhouse
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=87le1g2hrx.ffs@tglx \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=dwmw2@infradead.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=mingo@redhat.com \
--cc=seanjc@google.com \
--cc=wei.liu@kernel.org \
--cc=x86@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).