remarkable-linux/drivers
Doug Anderson 3252a646aa clocksource: exynos_mct: Only use 32-bits where possible
The MCT has a nice 64-bit counter.  That means that we _can_ register
as a 64-bit clocksource and sched_clock.  ...but that doesn't mean we
should.

The 64-bit counter is read by reading two 32-bit registers.  That
means reading needs to be something like:
- Read upper half
- Read lower half
- Read upper half and confirm that it hasn't changed.

That wouldn't be terrible, but:
- THe MCT isn't very fast to access (hundreds of nanoseconds).
- The clocksource is queried _all the time_.

In total system profiles of real workloads on ChromeOS, we've seen
exynos_frc_read() taking 2% or more of CPU time even after optimizing
the 3 reads above to 2 (see below).

The MCT is clocked at ~24MHz on all known systems.  That means that
the 32-bit half of the counter rolls over every ~178 seconds.  This
inspired an optimization in ChromeOS to cache the upper half between
calls, moving 3 reads to 2.  ...but we can do better!  Having a 32-bit
timer that flips every 178 seconds is more than sufficient for Linux.
Let's just use the lower half of the MCT.

Times on 5420 to do 1000000 gettimeofday() calls from userspace:
* Original code:                      1323852 us
* ChromeOS cache upper half:          1173084 us
* ChromeOS + ldmia to optimize:       1045674 us
* Use lower 32-bit only (this code):  1014429 us

As you can see, the time used doesn't increase linearly with the
number of reads and we can make 64-bit work almost as fast as 32-bit
with a bit of assembly code.  But since there's no real gain for
64-bit, let's go with the simplest and fastest implementation.

Note: with this change roughly half the time for gettimeofday() is
spent in exynos_frc_read().  The rest is timer / system call overhead.

Also note: this patch disables the use of the MCT on ARM64 systems
until we've sorted out how to make "cycles_t" always 32-bit.  Really
ARM64 systems should be using arch timers anyway.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2014-07-23 12:02:41 +02:00
..
accessibility
acpi Merge branch 'acpi-video' 2014-07-10 21:04:25 +02:00
amba
ata ahci_xgene: fix the dma state machine lockup for the IDENTIFY DEVICE PIO mode command. 2014-07-08 11:46:05 -04:00
atm
auxdisplay
base DMA, CMA: fix possible memory leak 2014-06-23 16:47:44 -07:00
bcma
block zram: revalidate disk after capacity change 2014-07-03 09:21:53 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-06-12 14:27:40 -07:00
bus bus/arm-cci: add dependency on OF && CPU_V7 2014-06-17 17:09:35 +02:00
cdrom Merge branch 'for-linus' of git://git.kernel.dk/linux-block 2014-06-11 08:41:17 -07:00
char i8k: Fix non-SMP operation 2014-07-09 16:45:36 -07:00
clk This batch of fixes is for a handful of clock drivers from Allwinner, 2014-07-13 12:21:04 -07:00
clocksource clocksource: exynos_mct: Only use 32-bits where possible 2014-07-23 12:02:41 +02:00
connector
cpufreq cpufreq: Makefile: fix compilation for davinci platform 2014-07-09 02:54:15 +02:00
cpuidle cpuidle: mvebu: Fix the name of the states 2014-06-18 21:54:46 +02:00
crypto crypto: caam - fix memleak in caam_jr module 2014-07-10 16:59:13 +08:00
dca
devfreq
dio
dma Update imx-sdma cyclic handling to report residue 2014-07-01 12:23:42 +05:30
edac
eisa
extcon
firewire firewire: Use ktime_get_ts() 2014-06-12 16:18:45 +02:00
firmware efi-pstore: Fix an overflow on 32-bit builds 2014-06-27 07:30:32 +01:00
fmc
gpio gpio: of: Fix handling for deferred probe for -gpio suffix 2014-06-12 09:57:00 +02:00
gpu Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 2014-07-10 20:37:33 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2014-07-07 13:13:03 -07:00
hsi
hv Drivers: hv: util: Fix a bug in the KVP code 2014-07-09 14:34:35 -07:00
hwmon hwmon: (adc128d818) Drop write support on inX_input attributes 2014-07-07 09:48:23 -07:00
hwspinlock
i2c i2c: sun6i-p2wi: Remove duplicate inclusion of module.h 2014-06-27 14:39:36 +02:00
ide
idle
iio iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends 2014-07-08 21:21:22 +01:00
infiniband Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-06-12 22:38:32 -07:00
input
iommu iommu/amd: Fix small race between invalidate_range_end/start 2014-06-20 16:14:22 +02:00
ipack
irqchip irqchip: spear_shirq: Fix interrupt offset 2014-06-21 23:26:39 +00:00
isdn isdn: hisax: Drop duplicate Kconfig entry 2014-06-16 21:31:37 -07:00
leds Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds 2014-06-12 13:08:09 -07:00
lguest
macintosh powerpc/macintosh/smu.c: Fix closing brace followed by if 2014-06-24 12:43:15 +10:00
mailbox
mcb
md . Fix DM multipath IO hang regression from 3.15 due to logic bug in 2014-07-11 09:33:36 -07:00
media Merge branch 'topic/omap3isp' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-06-12 23:04:28 -07:00
memory
memstick drivers/memstick/host/rtsx_pci_ms.c: add cancel_work when remove driver 2014-06-23 16:47:44 -07:00
message
mfd mfd: ab8500: Fix dt irq mapping 2014-06-26 13:34:15 +01:00
misc ARM: SoC fixes for 3.16 2014-06-25 12:19:01 -07:00
mmc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-06-12 14:27:40 -07:00
mtd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-06-12 10:30:18 -07:00
net net: allwinner: emac: Add missing free_irq 2014-06-25 16:31:17 -07:00
nfc
ntb
nubus
of of: Provide a function to request and map memory 2014-07-23 12:02:30 +02:00
oprofile
parisc
parport
pci PCI: Fix unaligned access in AF transaction pending test 2014-06-17 15:40:13 -06:00
pcmcia
phy USB fixes for 3.16-rc5 2014-07-12 14:13:10 -07:00
pinctrl pinctrl: berlin: fix an error code in berlin_pinctrl_probe() 2014-07-05 01:15:35 +02:00
platform
pnp
power
powercap
pps
ps3
ptp ptp: ptp_pch depends on x86_32 2014-06-17 15:43:48 -07:00
pwm pwm: Changes for v3.16-rc1 2014-06-11 14:06:55 -07:00
rapidio
regulator Merge remote-tracking branches 'regulator/fix/bcm590xx', 'regulator/fix/palmas' and 'regulator/fix/tps65218' into regulator-linus 2014-06-28 14:01:04 +01:00
remoteproc remoteproc: da8xx: don't select CMA on no-MMU 2014-06-17 17:09:36 +02:00
reset
rpmsg
rtc drivers/rtc/rtc-puv3.c: remove "&dev->" for typo issue MIME-Version: 1.0 2014-06-20 08:22:39 +08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2014-06-21 06:47:01 -10:00
sbus
scsi SCSI for-linus on 20140705 2014-07-06 12:08:30 -07:00
sfi
sh
sn
soc
spi Merge remote-tracking branches 'spi/fix/pxa2xx', 'spi/fix/qup' and 'spi/fix/sh-sci' into spi-linus 2014-06-28 14:01:23 +01:00
spmi
ssb
staging Second set of IIO fixes for the 3.16 cycle. 2014-06-29 09:43:23 -07:00
target iscsi-target: fix iscsit_del_np deadlock on unload 2014-06-27 23:23:35 -07:00
tc TC: Handle device_register() errors. 2014-06-26 10:48:23 +01:00
thermal thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked 2014-07-01 09:52:35 +08:00
tty serial: imx: Fix build breakage 2014-07-11 17:43:13 -07:00
uio Revert "uio: fix vma io range check in mmap" 2014-06-17 16:07:08 -07:00
usb USB: serial: ftdi_sio: Add Infineon Triboard 2014-07-11 18:22:38 -07:00
uwb
vfio
vhost vhost-scsi: don't open-code kvfree 2014-06-23 09:22:48 +03:00
video fb: adv7393: add missing semicolon 2014-07-01 13:18:38 +03:00
virt
virtio
vlynq
vme
w1 w1: mxc_w1: Fix incorrect "presence" status 2014-06-19 17:51:46 -07:00
watchdog Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2014-06-21 06:47:01 -10:00
xen xen: regression and PVH fixes for 3.16-rc1 2014-06-19 07:53:27 -10:00
zorro
Kconfig
Makefile