[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8eb7ba99a746110597bbac6f1e027aa63384dfce.camel@infradead.org>
Date: Thu, 01 Aug 2024 10:00:38 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: mikelley@...rosoft.com, kvm <kvm@...r.kernel.org>
Cc: bp@...en8.de, dave.hansen@...ux.intel.com, decui@...rosoft.com,
haiyangz@...rosoft.com, kys@...rosoft.com, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, lirongqing@...du.com, mingo@...hat.com,
seanjc@...gle.com, tglx@...utronix.de, wei.liu@...nel.org, x86@...nel.org
Subject: RE: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in
shutdown
On 2023-02-08 at 01:04:19 +0000, "Michael Kelley (LINUX)" <mikelley@...rosoft.com> said:
> From: lirongqing@...du.com <lirongqing@...du.com> Sent: Monday, February 6, 2023 5:15 PM
> >
> > Zeroing the counter register in pit_shutdown() isn't actually supposed to
> > stop it from counting, will causes the PIT to start running again,
> > From the spec:
> >
> > The largest possible initial count is 0; this is equivalent to 216 for
> > binary counting and 104 for BCD counting.
> >
> > The Counter does not stop when it reaches zero. In Modes 0, 1, 4, and 5 the
> > Counter "wraps around" to the highest count, either FFFF hex for binary
> > count- ing or 9999 for BCD counting, and continues counting.
> >
> > Mode 0 is typically used for event counting. After the Control Word is
> > written, OUT is initially low, and will remain low until the Counter
> > reaches zero. OUT then goes high and remains high until a new count or a
> > new Mode 0 Control Word is written into the Counter.
> >
> > Hyper-V and KVM follow the spec, the issue that 35b69a42 "(clockevents/drivers/
> > i8253: Add support for PIT shutdown quirk") fixed is in i8253 drivers, not Hyper-v,
> > so delete the zero timer counter register in shutdown, and delete PIT shutdown
> > quirk for Hyper-v
>
> From the standpoint of Hyper-V, I'm good with this change. But there's a
> risk that old hardware might not be compliant with the spec, and needs the
> zero'ing for some reason. The experts in the x86 space will be in the best
> position to assess the risk. At the time, the quirk approach was taken so
> the change applied only to Hyper-V, and any such risk was avoided.
>
> For Hyper-V,
> Reviewed-by: Michael Kelley <mikelley@...rosoft.com>
It's not entirely clear why we zero it at all. What was it supposed to
achieve?
I suppose if we want to be ultra-careful, perhaps we could do the
zeroing only on real hardware, if hypervisor_is_type(X86_HYPER_NATIVE)?
This does seem to be making VMMs spend a bunch of time stealing cycles
from the guest to emulate an unwanted timer, so it would be good to fix
it.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists