24 May, 2011
1 commit
-
Ben Nagy reported a scalability problem with KVM/QEMU that hit very hard
a single spinlock (idr_lock) in posix-timers code, on its 48 core
machine.Even on a 16 cpu machine (2x4x2), a single test can show 98% of cpu time
used in ticket_spin_lock, from lock_timerRef: http://www.spinics.net/lists/kvm/msg51526.html
Switching to RCU is quite easy, IDR being already RCU ready. idr_lock
should be locked only for an insert/delete, not a lookup.Benchmark on a 2x4x2 machine, 16 processes calling timer_gettime().
Before :
real 1m18.669s
user 0m1.346s
sys 1m17.180sAfter :
real 0m3.296s
user 0m1.366s
sys 0m1.926sReported-by: Ben Nagy
Signed-off-by: Eric Dumazet
Tested-by: Ben Nagy
Cc: Oleg Nesterov
Cc: Avi Kivity
Cc: John Stultz
Cc: Richard Cochran
Cc: Paul E. McKenney
Cc: Andrew Morton
Signed-off-by: Thomas Gleixner
23 May, 2011
1 commit
-
Instead of iterating over all possible timer bases avoid it by marking
the active bases in the cpu base.Signed-off-by: Thomas Gleixner
Reviewed-by: Peter Zijlstra
31 Mar, 2011
1 commit
-
Fixes generated by 'codespell' and manually reviewed.
Signed-off-by: Lucas De Marchi
22 Feb, 2011
1 commit
-
This patch exports CLOCK_BOOTTIME through the posix timers interface
CC: Jamie Lokier
CC: Thomas Gleixner
CC: Alexander Shishkin
CC: Arve Hjønnevåg
Signed-off-by: John Stultz
02 Feb, 2011
22 commits
-
This patch adds support for adding and removing posix clocks. The
clock lifetime cycle is patterned after usb devices. Each clock is
represented by a standard character device. In addition, the driver
may optionally implement custom character device operations.The posix clock and timer system calls listed below now work with
dynamic posix clocks, as well as the traditional static clocks.
The following system calls are affected:- clock_adjtime (brand new syscall)
- clock_gettime
- clock_getres
- clock_settime
- timer_create
- timer_delete
- timer_gettime
- timer_settime[ tglx: Adapted to the posix-timer cleanup. Moved clock_posix_dynamic
to posix-clock.c and made all referenced functions static ]Signed-off-by: Richard Cochran
Acked-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner -
Rename register_posix_clock() to posix_timers_register_clock(). That's
what the function really does. As a side effect this cleans up the
posix_clock namespace for the upcoming dynamic posix_clock
infrastructure.Signed-off-by: Thomas Gleixner
Tested-by: Richard Cochran
Cc: John Stultz
LKML-Reference: -
Extend the negative clockids which are currently used by posix cpu
timers to encode the PID with a file descriptor based type which
encodes the fd in the upper bits.Originally-from: Richard Cochran
Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
LKML-Reference: -
A new syscall is introduced that allows tuning of a POSIX clock. The
new call, clock_adjtime, takes two parameters, the clock ID and a
pointer to a struct timex. Any ADJTIMEX(2) operation may be requested
via this system call, but various POSIX clocks may or may not support
tuning.[ tglx: Adapted to the posix-timer cleanup series. Avoid copy_to_user
in the error case ]Signed-off-by: Richard Cochran
Acked-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner -
Pick the cleanup to the comment in posix-timers.c from Richards all in
one conversion patch.Originally-from: Richard Cochran
Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
LKML-Reference: -
All users gone. Remove the cruft.
Huge thanks to Richard Cochran who tackled that maze first.
Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Set the common function for CLOCK_MONOTONIC and CLOCK_REALTIME kclocks
and use the new decoding function.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Set the common function for CLOCK_MONOTONIC and CLOCK_REALTIME kclocks
and use the new decoding function.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Set the common function for CLOCK_MONOTONIC and CLOCK_REALTIME kclocks
and use the new decoding function.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Setup timer_create for CLOCK_MONOTONIC and CLOCK_REALTIME kclocks and
remove the no_timer_create() implementation.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
The res member of kclock is only used by mmtimer.c, but even there it
contains redundant information. Remove the field and fixup mmtimer.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Use the new kclock decoding. Fixup the fallout in mmtimer.c
Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Richard said: "I would think that we can require k_clocks to provide
the read function. This could be checked and enforced in
register_posix_clock()."Add checks for clock_getres and clock_get in the register function.
Suggested-by: Richard Cochran
Cc: John Stultz
Signed-off-by: Thomas Gleixner -
Use the new kclock decoding mechanism and rename the misnomed
common_clock_get() to posix_clock_realtime_get().Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Use the new kclock decoding function in clock_settime and cleanup all
kclocks which use the default functions. Rename the misnomed
common_clock_set() to posix_clock_realtime_set().Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
posix timers still use the legacy arg0-arg3 members of
restart_block. Use restart_block.nanosleep insteadSigned-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Use the new kclock decoding function in clock_nanosleep_restart.
Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Use the new kclock decoding function in clock_nanosleep and cleanup all
kclocks which use the default functions.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
New function to find the kclock for a given clockid.
Returns a pointer to clock_posix_cpu if clockid < 0. If clockid >=
MAXCLOCK or if the clock_getres pointer is not set it returns
NULL. For valid clocks it returns a pointer to the matching
posix_clock.Signed-off-by: Thomas Gleixner
Cc: John Stultz
Acked-by: Richard Cochran
LKML-Reference: -
Cosmetic. No functional change
Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Define the conditional nanosleep not supported error value outside of
do_posix_clock_nonanosleep(). Preparatory patch for further cleanups.Signed-off-by: Thomas Gleixner
Acked-by: John Stultz
Tested-by: Richard Cochran
LKML-Reference: -
Both settimeofday() and clock_settime() promise with a 'const'
attribute not to alter the arguments passed in. This patch adds the
missing 'const' attribute into the various kernel functions
implementing these calls.Signed-off-by: Richard Cochran
Acked-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner
21 Oct, 2010
1 commit
-
lock_timer() conditionally grabs it_lock in case of returning non-NULL
but unlock_timer() releases it unconditionally. This leads sparse to
complain about the lock context imbalance. Rename and wrap lock_timer
using __cond_lock() macro to make sparse happy.Signed-off-by: Namhyung Kim
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
23 Jul, 2010
1 commit
-
According to Oleg Nesterov:
We can move copy_to_user(created_timer_id) down after
"if (timer_event_spec)" block too. (but before CLOCK_DISPATCH(),
of course).Signed-off-by: Andrey Vagin
Cc: Oleg Nesterov
Cc: Pavel Emelyanov
Cc: Stanislaw Gruszka
Cc: Andrey Vagin
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
28 May, 2010
1 commit
-
Move CLOCK_DISPATCH(which_clock, timer_create, (new_timer)) after all
posible EFAULT erros.*_timer_create may allocate/get resources.
(for example posix_cpu_timer_create does get_task_struct)[ tglx: fold the remove crappy comment patch into this ]
Signed-off-by: Andrey Vagin
Cc: Oleg Nesterov
Cc: Pavel Emelyanov
Cc:
Reviewed-by: Stanislaw Gruszka
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
05 Feb, 2010
1 commit
-
Signed-off-by: H Hartley Sweeten
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
22 Aug, 2009
1 commit
-
After talking with some application writers who want very fast, but not
fine-grained timestamps, I decided to try to implement new clock_ids
to clock_gettime(): CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE
which returns the time at the last tick. This is very fast as we don't
have to access any hardware (which can be very painful if you're using
something like the acpi_pm clocksource), and we can even use the vdso
clock_gettime() method to avoid the syscall. The only trade off is you
only get low-res tick grained time resolution.This isn't a new idea, I know Ingo has a patch in the -rt tree that made
the vsyscall gettimeofday() return coarse grained time when the
vsyscall64 sysctrl was set to 2. However this affects all applications
on a system.With this method, applications can choose the proper speed/granularity
trade-off for themselves.Signed-off-by: John Stultz
Cc: Andi Kleen
Cc: nikolag@ca.ibm.com
Cc: Darren Hart
Cc: arjan@infradead.org
Cc: jonathan@jonmasters.org
LKML-Reference:
Signed-off-by: Thomas Gleixner
04 Aug, 2009
1 commit
-
Prevent calling do_nanosleep() with clockid
CLOCK_MONOTONIC_RAW, it may cause oops, such as NULL pointer
dereference.Signed-off-by: Hiroshi Shimamoto
Cc: Andrew Morton
Cc: Thomas Gleixner
Cc: John Stultz
Cc:
LKML-Reference:
Signed-off-by: Ingo Molnar
14 Jan, 2009
1 commit
-
Signed-off-by: Heiko Carstens
26 Dec, 2008
1 commit
-
…ohz', 'timers/ntp', 'timers/posixtimers' and 'timers/rtc' into timers/core
21 Dec, 2008
1 commit
-
Impact: Prevent kernel crash with posix timer clockid CLOCK_MONOTONIC_RAW
commit 2d42244ae71d6c7b0884b5664cf2eda30fb2ae68 (clocksource:
introduce CLOCK_MONOTONIC_RAW) introduced a new clockid, which is only
available to read out the raw not NTP adjusted system time.The above commit did not prevent that a posix timer can be created
with that clockid. The timer_create() syscall succeeds and initializes
the timer to a non existing hrtimer base. When the timer is deleted
either by timer_delete() or by the exit() cleanup the kernel crashes.Prevent the creation of timers for CLOCK_MONOTONIC_RAW by setting the
posix clock function to no_timer_create which returns an error code.Reported-and-tested-by: Eric Sesterhenn
Signed-off-by: Thomas Gleixner
Acked-by: Oleg Nesterov
Signed-off-by: Linus Torvalds
13 Dec, 2008
2 commits
-
Impact: clean up, speed up
->it_pid (was ->it_process) has also a special meaning: if it is NULL,
the timer is under deletion or it wasn't initialized yet. We can check
->it_signal != NULL instead, this way we can- simplify sys_timer_create() a bit
- remove yet another check from lock_timer()
- move put_pid(->it_pid) into release_posix_timer() which
runs outside of ->it_lockSigned-off-by: Oleg Nesterov
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner -
Impact: restructure, clean up code
k_itimer holds the ref to the ->it_process until sys_timer_delete(). This
allows to pin up to RLIMIT_SIGPENDING dead task_struct's. Change the code
to use "struct pid *" instead.The patch doesn't kill ->it_process, it places ->it_pid into the union.
->it_process is still used by do_cpu_nanosleep() as before. It would be
trivial to change the nanosleep code as well, but since it uses it_process
in a special way I think it is better to keep this field for grep.The patch bloats the kernel by 104 bytes and it also adds the new pointer,
->it_signal, to k_itimer. It is used by lock_timer() to verify that the
found timer was not created by another process. It is not clear why do we
use the global database (and thus the global idr_lock) for posix timers.
We still need the signal_struct->posix_timers which contains all useable
timers, perhaps it is better to use some form of per-process array
instead.Signed-off-by: Oleg Nesterov
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
22 Oct, 2008
1 commit
-
Conflicts:
kernel/time/tick-sched.c
Signed-off-by: Thomas Gleixner
20 Oct, 2008
1 commit
-
…tp', 'timers/posixtimers' and 'timers/debug' into v28-timers-for-linus
18 Oct, 2008
1 commit
-
Conflicts:
arch/x86/kvm/i8254.c