31 Jul, 2013
1 commit
-
We need to calculate the same number in the clocksource code and
the sched_clock code, so extract this code into its own function.
We also drop the min_t and just use min() because the two types
are the same.Signed-off-by: Stephen Boyd
Signed-off-by: John Stultz
05 Jul, 2013
1 commit
-
Up to commit 5d33b883a (clocksource: Always verify highres capability)
we had no sanity check when selecting a clocksource, which prevented
that a non highres capable clocksource is used when the system already
switched to highres/nohz mode.The new sanity check works as Alex and Tim found out. It prevents the
TSC from being used. This happens because on x86 the boot process
looks like this:tsc_start_freqency_validation(TSC);
clocksource_register(HPET);
clocksource_done_booting();
clocksource_select()
Selects HPET which is valid for high-resswitch_to_highres();
clocksource_register(TSC);
TSC is not selected, because it is not yet
flagged as VALID_HIGH_RESclocksource_watchdog()
Validates TSC for highres, but that does not make TSC
the current clocksource.Before the sanity check was added, we installed TSC unvalidated which
worked most of the time. If the TSC was really detected as unstable,
then the unstable logic removed it and installed HPET again.The sanity check is correct and needed. So the watchdog needs to kick
a reselection of the clocksource, when it qualifies TSC as a valid
high res clocksource.To solve this, we mark the clocksource which got the flag
CLOCK_SOURCE_VALID_FOR_HRES set by the watchdog with an new flag
CLOCK_SOURCE_RESELECT and trigger the watchdog thread. The watchdog
thread evaluates the flag and invokes clocksource_select() when set.To avoid that the clocksource_done_booting() code, which is about to
install the first real clocksource anyway, needs to go through
clocksource_select and tick_oneshot_notify() pointlessly, split out
the clocksource_watchdog_kthread() list walk code and invoke the
select/notify only when called from clocksource_watchdog_kthread().So clocksource_done_booting() can utilize the same splitout code
without the select/notify invocation and the clocksource_mutex
unlock/relock dance.Reported-and-tested-by: Alex Shi
Cc: Hans Peter Anvin
Cc: Tim Chen
Cc: Andi Kleen
Tested-by: Peter Zijlstra
Cc: Ingo Molnar
Cc: Davidlohr Bueso
Cc: John Stultz
Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1307042239150.11637@ionos.tec.linutronix.de
Signed-off-by: Thomas Gleixner
16 May, 2013
3 commits
-
The unregister call can fail, if the clocksource is the current one
and there is no replacement clocksource available. It can also fail,
if the clocksource is the watchdog clocksource and I'm not going to
provide support for this.Signed-off-by: Thomas Gleixner
Cc: John Stultz
Cc: Magnus Damm
Link: http://lkml.kernel.org/r/20130425143436.029915527@linutronix.de
Signed-off-by: Thomas Gleixner -
Add a module refcount, so the current clocksource cannot be removed
unconditionally.Signed-off-by: Thomas Gleixner
Cc: John Stultz
Cc: Magnus Damm
Link: http://lkml.kernel.org/r/20130425143435.762417789@linutronix.de
Signed-off-by: Thomas Gleixner -
timekeeping_notify() can fail due cs->enable() failure. Though the
caller does not notice and happily keeps the wrong clocksource as the
current one.Let the caller know about failure, so the current clocksource will be
shown correctly in sysfs.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Cc: Magnus Damm
Link: http://lkml.kernel.org/r/20130425143435.696321912@linutronix.de
Signed-off-by: Thomas Gleixner
03 May, 2013
1 commit
-
Pull ARM SoC cleanup from Olof Johansson:
"Here is a collection of cleanup patches. Among the pieces that stand
out are:- The deletion of h720x platforms
- Split of at91 non-dt platforms to their own Kconfig file to keep
them separate
- General cleanups and refactoring of i.MX and MXS platforms
- Some restructuring of clock tables for OMAP
- Convertion of PMC driver for Tegra to dt-only
- Some renames of sunxi -> sun4i (Allwinner A10)
- ... plus a bunch of other stuff that I haven't mentioned"* tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (119 commits)
ARM: i.MX: remove unused ARCH_* configs
ARM i.MX53: remove platform ahci support
ARM: sunxi: Rework the restart code
irqchip: sunxi: Rename sunxi to sun4i
irqchip: sunxi: Make use of the IRQCHIP_DECLARE macro
clocksource: sunxi: Rename sunxi to sun4i
clocksource: sunxi: make use of CLKSRC_OF
clocksource: sunxi: Cleanup the timer code
ARM: at91: remove trailing semicolon from macros
ARM: at91/setup: fix trivial typos
ARM: EXYNOS: remove "config EXYNOS_DEV_DRM"
ARM: EXYNOS: change the name of USB ohci header
ARM: SAMSUNG: Remove unnecessary code for dma
ARM: S3C24XX: Remove unused GPIO drive strength register definitions
ARM: OMAP4+: PM: Restore CPU power state to ON with clockdomain force wakeup method
ARM: S3C24XX: Removed unneeded dependency on CPU_S3C2412
ARM: S3C24XX: Removed unneeded dependency on CPU_S3C2410
ARM: S3C24XX: Removed unneeded dependency on ARCH_S3C24XX for boards
ARM: SAMSUNG: Fix typo "CONFIG_SAMSUNG_DEV_RTC"
ARM: S5P64X0: Fix typo "CONFIG_S5P64X0_SETUP_SDHCI"
...
28 Mar, 2013
1 commit
-
This ensures that a function pointer passed into CLOCKSOURCE_OF_DECLARE
takes the same arguments that we use for calling that function later.Also fix the extraneous semicolon at end of the CLOCKSOURCE_OF_DECLARE
definition.Signed-off-by: Arnd Bergmann
Acked-by: Rob Herring
16 Mar, 2013
1 commit
-
Some x86 processors have a TSC clocksource, which continues to run
even when system is suspended. Also most OMAP platforms have a
32 KHz timer which has similar capability. Add a feature flag so that
it could be utilized.Signed-off-by: Feng Tang
Signed-off-by: John Stultz
11 Mar, 2013
1 commit
-
Add an empty clocksource_of_init when !CLKSRC_OF. This is needed for builds
where no timer has selected CLKSRC_OF.Signed-off-by: Rob Herring
Cc: John Stultz
Cc: Thomas Gleixner
01 Feb, 2013
1 commit
-
This allows clocksource drivers that support both DT and non-DT to
always invoke macro CLOCKSOURCE_OF_DECLARE(), rather than wrapping
it in a #ifdef CONFIG_CLKSRC_OF, which simplifies their code.Signed-off-by: Stephen Warren
Signed-off-by: Olof Johansson
03 Jan, 2013
1 commit
-
It is desirable to move all clocksource drivers to drivers/clocksource,
yet each requires its own initialization function. We'd rather not
pollute with a header for each function. Instead, create a
single of_clksrc_init() function which will determine which clocksource
driver to initialize based on device tree.Based on a similar patch for drivers/irqchip by Thomas Petazzoni.
Signed-off-by: Stephen Warren
25 Sep, 2012
1 commit
-
Since users will need to include timekeeper_internal.h, move
update_vsyscall definitions to timekeeper_internal.h.Cc: Tony Luck
Cc: Paul Mackerras
Cc: Benjamin Herrenschmidt
Cc: Andy Lutomirski
Cc: Martin Schwidefsky
Cc: Paul Turner
Cc: Steven Rostedt
Cc: Richard Cochran
Cc: Prarit Bhargava
Cc: Thomas Gleixner
Signed-off-by: John Stultz
02 Feb, 2012
1 commit
-
No one is using this, so encourage the use of
clocksource_register_hz/khz(), and drop this helper.Cc: Thomas Gleixner
Signed-off-by: Yong Zhang
[jstultz: tweaked commit message]
Signed-off-by: John Stultz
19 Dec, 2011
1 commit
-
Fix various KernelDoc build warnings.
Signed-off-by: Kusanagi Kouichi
Cc: John Stultz
Link: http://lkml.kernel.org/r/20111219091320.0D5AF6FC03D@msa105.auone-net.jp
Signed-off-by: Ingo Molnar
11 Nov, 2011
1 commit
-
For some frequencies, the clocks_calc_mult_shift() function will
unfortunately select mult values very close to 0xffffffff. This
has the potential to overflow when NTP adjusts the clock, adding
to the mult value.This patch adds a clocksource.maxadj value, which provides
an approximation of an 11% adjustment(NTP limits adjustments to
500ppm and the tick adjustment is limited to 10%), which could
be made to the clocksource.mult value. This is then used to both
check that the current mult value won't overflow/underflow, as
well as warning us if the timekeeping_adjust() code pushes over
that 11% boundary.v2: Fix max_adjustment calculation, and improve WARN_ONCE
messages.v3: Don't warn before maxadj has actually been set
CC: Yong Zhang
CC: David Daney
CC: Thomas Gleixner
CC: Chen Jie
CC: zhangfx
CC: stable@kernel.org
Reported-by: Chen Jie
Reported-by: zhangfx
Tested-by: Yong Zhang
Signed-off-by: John Stultz
23 Jul, 2011
1 commit
-
* 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86-64, vdso: Do not allocate memory for the vDSO
clocksource: Change __ARCH_HAS_CLOCKSOURCE_DATA to a CONFIG option
x86, vdso: Drop now wrong comment
Document the vDSO and add a reference parser
ia64: Replace clocksource.fsys_mmio with generic arch data
x86-64: Move vread_tsc and vread_hpet into the vDSO
clocksource: Replace vread with generic arch data
x86-64: Add --no-undefined to vDSO build
x86-64: Allow alternative patching in the vDSO
x86: Make alternative instruction pointers relative
x86-64: Improve vsyscall emulation CS and RIP handling
x86-64: Emulate legacy vsyscalls
x86-64: Fill unused parts of the vsyscall page with 0xcc
x86-64: Remove vsyscall number 3 (venosys)
x86-64: Map the HPET NX
x86-64: Remove kernel.vsyscall64 sysctl
x86-64: Give vvars their own page
x86-64: Document some of entry_64.S
x86-64: Fix alignment of jiffies variable
22 Jul, 2011
1 commit
-
The machinery for __ARCH_HAS_CLOCKSOURCE_DATA assumed a file in
asm-generic would be the default for architectures without their own
file in asm/, but that is not how it works.Replace it with a Kconfig option instead.
Link: http://lkml.kernel.org/r/4E288AA6.7090804@zytor.com
Signed-off-by: H. Peter Anvin
Cc: Andy Lutomirski
Cc: Arnd Bergmann
Cc: Tony Luck
15 Jul, 2011
1 commit
-
Now that clocksource.archdata is available, use it for ia64-specific
code.Cc: Clemens Ladisch
Cc: linux-ia64@vger.kernel.org
Cc: Tony Luck
Cc: Fenghua Yu
Cc: John Stultz
Cc: Thomas Gleixner
Signed-off-by: Andy Lutomirski
Link: http://lkml.kernel.org/r/d31de0ee0842a0e322fb6441571c2b0adb323fa2.1310563276.git.luto@mit.edu
Signed-off-by: H. Peter Anvin
14 Jul, 2011
1 commit
-
The vread field was bloating struct clocksource everywhere except
x86_64, and I want to change the way this works on x86_64, so let's
split it out into per-arch data.Cc: x86@kernel.org
Cc: Clemens Ladisch
Cc: linux-ia64@vger.kernel.org
Cc: Tony Luck
Cc: Fenghua Yu
Cc: John Stultz
Cc: Thomas Gleixner
Signed-off-by: Andy Lutomirski
Link: http://lkml.kernel.org/r/3ae5ec76a168eaaae63f08a2a1060b91aa0b7759.1310563276.git.luto@mit.edu
Signed-off-by: H. Peter Anvin
17 Jun, 2011
1 commit
-
The clocksource watchdog code is interruptible and it has been
observed that this can trigger false positives which disable the TSC.The reason is that an interrupt storm or a long running interrupt
handler between the read of the watchdog source and the read of the
TSC brings the two far enough apart that the delta is larger than the
unstable treshold. Move both reads into a short interrupt disabled
region to avoid that.Reported-and-tested-by: Vernon Mauery
Signed-off-by: Thomas Gleixner
Cc: stable@kernel.org
24 May, 2011
1 commit
-
Add a generic mmio clocksource, covering both 32-bit and 16-bit register
access sizes, for up or down counters. This can be used to easily
create clocksources for simple counter-based implementations.Cc: Alessandro Rubini
Cc: Colin Cross
Cc: Eric Miao
Cc: Erik Gilling
Acked-by: "Hans J. Koch"
Cc: Imre Kaloz
Cc: Krzysztof Halasa
Cc: Kukjin Kim
Cc: Lennert Buytenhek
Cc: Linus Walleij
Cc: linux-omap@vger.kernel.org
Acked-by: Nicolas Pitre
Cc: Olof Johansson
Tested-by: Sascha Hauer
Reviewed-by: Thomas Gleixner
Tested-by: Tony Lindgren
Reviewed-by: Viresh Kumar
Cc: Wan ZongShun
Signed-off-by: Russell King
19 May, 2011
1 commit
-
Group the hot path members of struct clocksource together so we have a
better cache line footprint. Make it cacheline aligned.Signed-off-by: Thomas Gleixner
Cc: John Stultz
Cc: Eric Dumazet
Reviewed-by: Ingo Molnar
Link: http://lkml.kernel.org/r/%3C20110518210136.003081882%40linutronix.de%3E
14 May, 2011
2 commits
-
…into timers/clocksource
Conflicts:
arch/ia64/kernel/cyclone.c
arch/mips/kernel/i8253.c
arch/x86/kernel/i8253.cReason: Resolve conflicts so further cleanups do not conflict further
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-
Convert the footbridge isa-timer code to use generic i8253 clocksource.
Acked-by: John Stultz
Acked-by: Thomas Gleixner
Signed-off-by: Russell King
22 Feb, 2011
1 commit
-
As nothing should be writing to the clocksource name string, make the
clocksource name pointer const. Build-tested on ARM Versatile Express.Signed-off-by: Russell King
Signed-off-by: John Stultz
27 Jul, 2010
2 commits
-
To properly handle clocksources that change frequencies
at the clocksource->enable() point, this patch adds
a method that will update the clocksource's mult/shift and
max_idle_ns values.Signed-off-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner -
update_vsyscall() did not provide the wall_to_monotoinc offset,
so arch specific implementations tend to reference wall_to_monotonic
directly. This limits future cleanups in the timekeeping core, so
this patch fixes the update_vsyscall interface to provide
wall_to_monotonic, allowing wall_to_monotonic to be made static
as planned in Documentation/feature-removal-schedule.txtSigned-off-by: John Stultz
Cc: Martin Schwidefsky
Cc: Anton Blanchard
Cc: Paul Mackerras
Cc: Tony Luck
LKML-Reference:
Signed-off-by: Thomas Gleixner
10 May, 2010
1 commit
-
How to pick good mult/shift pairs has always been difficult to
describe to folks writing clocksource drivers, since it requires
careful tradeoffs in adjustment accuracy vs overflow limits.Now, with the clocks_calc_mult_shift function, its much
easier. However, not many clocksources have converted to using that
function, and there is still the issue of the max interval length
assumption being made by each clocksource driver independently.So this patch simplifies the registration process by having
clocksources be registered with a hz/khz value and the registration
function taking care of setting mult/shift.This should take most of the confusion out of writing a clocksource
driver.Additionally it also keeps the shift size tradeoff (more accuracy vs
longer possible nohz times) centralized so the timekeeping core can
keep track of the assumptions being made.[ tglx: Coding style and comments fixed ]
Signed-off-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner
05 Feb, 2010
2 commits
-
Add a clocksource suspend callback. This callback can be used by the
clocksource driver to shutdown and perform any kind of late suspend
activities even though the clocksource driver itself is a non-sysdev
driver.One example where this is useful is to fix the sh_cmt.c platform driver
that today suspends using the platform bus and shuts down the clocksource
too early.With this callback in place the sh_cmt driver will suspend using the
clocksource and clockevent hooks and leave the platform device pm
callbacks unused.Signed-off-by: Magnus Damm
Cc: Paul Mundt
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner -
Pass the clocksource as an argument to the clocksource resume callback.
Needed so we can point out which CMT channel the sh_cmt.c driver shall
resume.Signed-off-by: Magnus Damm
Cc: john stultz
Cc: Paul Mundt
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
09 Dec, 2009
1 commit
-
…nel/git/tip/linux-2.6-tip
* 'timers-for-linus-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
hrtimer: Fix /proc/timer_list regression
itimers: Fix racy writes to cpu_itimer fields
timekeeping: Fix clock_gettime vsyscall time warp
17 Nov, 2009
1 commit
-
Since commit 0a544198 "timekeeping: Move NTP adjusted clock multiplier
to struct timekeeper" the clock multiplier of vsyscall is updated with
the unmodified clock multiplier of the clock source and not with the
NTP adjusted multiplier of the timekeeper.This causes user space observerable time warps:
new CLOCK-warp maximum: 120 nsecs, 00000025c337c537 -> 00000025c337c4bfAdd a new argument "mult" to update_vsyscall() and hand in the
timekeeping internal NTP adjusted multiplier.Signed-off-by: Lin Ming
Cc: "Zhang Yanmin"
Cc: Martin Schwidefsky
Cc: Benjamin Herrenschmidt
Cc: Tony Luck
LKML-Reference:
Signed-off-by: Thomas Gleixner
14 Nov, 2009
2 commits
-
The dynamic tick allows the kernel to sleep for periods longer than a
single tick, but it does not limit the sleep time currently. In the
worst case the kernel could sleep longer than the wrap around time of
the time keeping clock source which would result in losing track of
time.Prevent this by limiting it to the safe maximum sleep time of the
current time keeping clock source. The value is calculated when the
clock source is registered.[ tglx: simplified the code a bit and massaged the commit msg ]
Signed-off-by: Jon Hunter
Cc: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner -
MIPS has two functions to calculcate the mult/shift factors for clock
sources and clock events at run time. ARM needs such functions as
well.Implement a function which calculates the mult/shift factors based on
the frequencies to which and from which is converted. The function
also has a parameter to specify the minimum conversion range in
seconds. This range is guaranteed not to produce a 64bit overflow when
a value is multiplied with the calculated mult factor. The larger the
conversion range the less becomes the conversion accuracy.Provide two inline wrappers which handle clock events and clock
sources. For clock events the "from" frequency is nano seconds per
second which corresponds to 1GHz and "to" is the device frequency. For
clock sources "from" is the device frequency and "to" is nano seconds
per second.Signed-off-by: Thomas Gleixner
Tested-by: Mikael Pettersson
Acked-by: Ralf Baechle
Acked-by: Linus Walleij
Cc: John Stultz
LKML-Reference:
29 Aug, 2009
1 commit
-
Martin Schwidefsky analyzed it:
To register a clocksource the clocksource_mutex is acquired and if
necessary timekeeping_notify is called to install the clocksource as
the timekeeper clock. timekeeping_notify uses stop_machine which needs
to take cpu_add_remove_lock mutex.
Starting a new cpu is done with the cpu_add_remove_lock mutex held.
native_cpu_up checks the tsc of the new cpu and if the tsc is no good
clocksource_change_rating is called. Which needs the clocksource_mutex
and the deadlock is complete.The solution is to replace the TSC via the clocksource watchdog
mechanism. Mark the TSC as unstable and schedule the watchdog work so
it gets removed in the watchdog thread context.Signed-off-by: Thomas Gleixner
LKML-Reference:
Cc: Martin Schwidefsky
Cc: John Stultz
15 Aug, 2009
5 commits
-
update_wall_time calls change_clocksource HZ times per second to check
if a new clock source is available. In close to 100% of all calls
there is no new clock. Replace the tick based check by an update done
with stop_machine.Signed-off-by: Martin Schwidefsky
Cc: Ingo Molnar
Acked-by: John Stultz
Cc: Daniel Walker
LKML-Reference:
Signed-off-by: Thomas Gleixner -
The clocksource structure has two multipliers, the unmodified multiplier
clock->mult_orig and the NTP corrected multiplier clock->mult. The NTP
multiplier is misplaced in the struct clocksource, this is private
information of the timekeeping code. Add the mult field to the struct
timekeeper to contain the NTP corrected value, keep the unmodifed
multiplier in clock->mult and remove clock->mult_orig.Signed-off-by: Martin Schwidefsky
Cc: Ingo Molnar
Acked-by: John Stultz
Cc: Daniel Walker
LKML-Reference:
Signed-off-by: Thomas Gleixner -
Add struct timekeeper to keep the internal values timekeeping.c needs
in regard to the currently selected clock source. This moves the
timekeeping intervals, xtime_nsec and the ntp error value from struct
clocksource to struct timekeeper. The raw_time is removed from the
clocksource as well. It gets treated like xtime as a global variable.
Eventually xtime raw_time should be moved to struct timekeeper.[ tglx: minor cleanup ]
Signed-off-by: Martin Schwidefsky
Cc: Ingo Molnar
Acked-by: John Stultz
Cc: Daniel Walker
LKML-Reference:
Signed-off-by: Thomas Gleixner -
Move the downgrade of an unstable clocksource from the timer interrupt
context into the process context of a work queue thread. This is
needed to be able to do the clocksource switch with stop_machine.Signed-off-by: Martin Schwidefsky
Cc: Ingo Molnar
Acked-by: John Stultz
Cc: Daniel Walker
LKML-Reference:
Signed-off-by: Thomas Gleixner -
If a non high-resolution clocksource is first set as override clock
and then registered it becomes active even if the system is in one-shot
mode. Move the override check from sysfs_override_clocksource to the
clocksource selection. That fixes the bug and simplifies the code. The
check in clocksource_register for double registration of the same
clocksource is removed without replacement.To find the initial clocksource a new weak function in jiffies.c is
defined that returns the jiffies clocksource. The architecture code
can then override the weak function with a more suitable clocksource,
e.g. the TOD clock on s390.[ tglx: Folded in a fix from John Stultz ]
Signed-off-by: Martin Schwidefsky
Acked-by: John Stultz
Cc: Daniel Walker
LKML-Reference:
Signed-off-by: Thomas Gleixner