[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3582358fb8ae47d7b88f85aa895a7109@AcuMS.aculab.com>
Date: Fri, 29 Apr 2022 15:24:48 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'Maciej W. Rozycki'" <macro@...am.me.uk>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>
CC: "linux-mips@...r.kernel.org" <linux-mips@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] MIPS: Fix CP0 counter erratum detection for R4k CPUs
> That said reading from the 8254 is messy too and you may need a spinlock
> (you need to write the Counter Latch or Read-Back command to the control
> register and then issue consecutive two reads to the requested timer's
> data register[2]). Which is I guess why support for it has been removed
> from x86 code. For non-SMP it might be good enough.
It is important to 'latch' the counter before reading it.
I tried to optimise some code to avoid the extra accesses.
In principle it ought to have worked, but reading the
unlatched values gave garbage - not just messed up 16bit values.
It was probably returning a value that was being ripple-counted.
The sheer number of IO cycles you need to read the counters
just beggars belief.
So while they can be used to get an accurate timestamp it
really takes too long to be useful.
Even in a modern x86 chipset I think they are still ISA
speed cycles.
(Mind you, we've an fpga based PCIe boards where reads
are ISA speed....)
OTOH I'd have though that for a real 486 (one without a TSC)
that is the only way to get a high res timer count.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists