Skip to content

Commit 42cba6e

Browse files
committed
Merge branch 'timers/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into remove-local-timers
2 parents f722406 + 2699339 commit 42cba6e

225 files changed

Lines changed: 4221 additions & 1866 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
TI-NSPIRE timer
2+
3+
Required properties:
4+
5+
- compatible : should be "lsi,zevio-timer".
6+
- reg : The physical base address and size of the timer (always first).
7+
- clocks: phandle to the source clock.
8+
9+
Optional properties:
10+
11+
- interrupts : The interrupt number of the first timer.
12+
- reg : The interrupt acknowledgement registers
13+
(always after timer base address)
14+
15+
If any of the optional properties are not given, the timer is added as a
16+
clock-source only.
17+
18+
Example:
19+
20+
timer {
21+
compatible = "lsi,zevio-timer";
22+
reg = <0x900D0000 0x1000>, <0x900A0020 0x8>;
23+
interrupts = <19>;
24+
clocks = <&timer_clk>;
25+
};
26+
27+
Example (no clock-events):
28+
29+
timer {
30+
compatible = "lsi,zevio-timer";
31+
reg = <0x900D0000 0x1000>;
32+
clocks = <&timer_clk>;
33+
};
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
REDUCING OS JITTER DUE TO PER-CPU KTHREADS
2+
3+
This document lists per-CPU kthreads in the Linux kernel and presents
4+
options to control their OS jitter. Note that non-per-CPU kthreads are
5+
not listed here. To reduce OS jitter from non-per-CPU kthreads, bind
6+
them to a "housekeeping" CPU dedicated to such work.
7+
8+
9+
REFERENCES
10+
11+
o Documentation/IRQ-affinity.txt: Binding interrupts to sets of CPUs.
12+
13+
o Documentation/cgroups: Using cgroups to bind tasks to sets of CPUs.
14+
15+
o man taskset: Using the taskset command to bind tasks to sets
16+
of CPUs.
17+
18+
o man sched_setaffinity: Using the sched_setaffinity() system
19+
call to bind tasks to sets of CPUs.
20+
21+
o /sys/devices/system/cpu/cpuN/online: Control CPU N's hotplug state,
22+
writing "0" to offline and "1" to online.
23+
24+
o In order to locate kernel-generated OS jitter on CPU N:
25+
26+
cd /sys/kernel/debug/tracing
27+
echo 1 > max_graph_depth # Increase the "1" for more detail
28+
echo function_graph > current_tracer
29+
# run workload
30+
cat per_cpu/cpuN/trace
31+
32+
33+
KTHREADS
34+
35+
Name: ehca_comp/%u
36+
Purpose: Periodically process Infiniband-related work.
37+
To reduce its OS jitter, do any of the following:
38+
1. Don't use eHCA Infiniband hardware, instead choosing hardware
39+
that does not require per-CPU kthreads. This will prevent these
40+
kthreads from being created in the first place. (This will
41+
work for most people, as this hardware, though important, is
42+
relatively old and is produced in relatively low unit volumes.)
43+
2. Do all eHCA-Infiniband-related work on other CPUs, including
44+
interrupts.
45+
3. Rework the eHCA driver so that its per-CPU kthreads are
46+
provisioned only on selected CPUs.
47+
48+
49+
Name: irq/%d-%s
50+
Purpose: Handle threaded interrupts.
51+
To reduce its OS jitter, do the following:
52+
1. Use irq affinity to force the irq threads to execute on
53+
some other CPU.
54+
55+
Name: kcmtpd_ctr_%d
56+
Purpose: Handle Bluetooth work.
57+
To reduce its OS jitter, do one of the following:
58+
1. Don't use Bluetooth, in which case these kthreads won't be
59+
created in the first place.
60+
2. Use irq affinity to force Bluetooth-related interrupts to
61+
occur on some other CPU and furthermore initiate all
62+
Bluetooth activity on some other CPU.
63+
64+
Name: ksoftirqd/%u
65+
Purpose: Execute softirq handlers when threaded or when under heavy load.
66+
To reduce its OS jitter, each softirq vector must be handled
67+
separately as follows:
68+
TIMER_SOFTIRQ: Do all of the following:
69+
1. To the extent possible, keep the CPU out of the kernel when it
70+
is non-idle, for example, by avoiding system calls and by forcing
71+
both kernel threads and interrupts to execute elsewhere.
72+
2. Build with CONFIG_HOTPLUG_CPU=y. After boot completes, force
73+
the CPU offline, then bring it back online. This forces
74+
recurring timers to migrate elsewhere. If you are concerned
75+
with multiple CPUs, force them all offline before bringing the
76+
first one back online. Once you have onlined the CPUs in question,
77+
do not offline any other CPUs, because doing so could force the
78+
timer back onto one of the CPUs in question.
79+
NET_TX_SOFTIRQ and NET_RX_SOFTIRQ: Do all of the following:
80+
1. Force networking interrupts onto other CPUs.
81+
2. Initiate any network I/O on other CPUs.
82+
3. Once your application has started, prevent CPU-hotplug operations
83+
from being initiated from tasks that might run on the CPU to
84+
be de-jittered. (It is OK to force this CPU offline and then
85+
bring it back online before you start your application.)
86+
BLOCK_SOFTIRQ: Do all of the following:
87+
1. Force block-device interrupts onto some other CPU.
88+
2. Initiate any block I/O on other CPUs.
89+
3. Once your application has started, prevent CPU-hotplug operations
90+
from being initiated from tasks that might run on the CPU to
91+
be de-jittered. (It is OK to force this CPU offline and then
92+
bring it back online before you start your application.)
93+
BLOCK_IOPOLL_SOFTIRQ: Do all of the following:
94+
1. Force block-device interrupts onto some other CPU.
95+
2. Initiate any block I/O and block-I/O polling on other CPUs.
96+
3. Once your application has started, prevent CPU-hotplug operations
97+
from being initiated from tasks that might run on the CPU to
98+
be de-jittered. (It is OK to force this CPU offline and then
99+
bring it back online before you start your application.)
100+
TASKLET_SOFTIRQ: Do one or more of the following:
101+
1. Avoid use of drivers that use tasklets. (Such drivers will contain
102+
calls to things like tasklet_schedule().)
103+
2. Convert all drivers that you must use from tasklets to workqueues.
104+
3. Force interrupts for drivers using tasklets onto other CPUs,
105+
and also do I/O involving these drivers on other CPUs.
106+
SCHED_SOFTIRQ: Do all of the following:
107+
1. Avoid sending scheduler IPIs to the CPU to be de-jittered,
108+
for example, ensure that at most one runnable kthread is present
109+
on that CPU. If a thread that expects to run on the de-jittered
110+
CPU awakens, the scheduler will send an IPI that can result in
111+
a subsequent SCHED_SOFTIRQ.
112+
2. Build with CONFIG_RCU_NOCB_CPU=y, CONFIG_RCU_NOCB_CPU_ALL=y,
113+
CONFIG_NO_HZ_FULL=y, and, in addition, ensure that the CPU
114+
to be de-jittered is marked as an adaptive-ticks CPU using the
115+
"nohz_full=" boot parameter. This reduces the number of
116+
scheduler-clock interrupts that the de-jittered CPU receives,
117+
minimizing its chances of being selected to do the load balancing
118+
work that runs in SCHED_SOFTIRQ context.
119+
3. To the extent possible, keep the CPU out of the kernel when it
120+
is non-idle, for example, by avoiding system calls and by
121+
forcing both kernel threads and interrupts to execute elsewhere.
122+
This further reduces the number of scheduler-clock interrupts
123+
received by the de-jittered CPU.
124+
HRTIMER_SOFTIRQ: Do all of the following:
125+
1. To the extent possible, keep the CPU out of the kernel when it
126+
is non-idle. For example, avoid system calls and force both
127+
kernel threads and interrupts to execute elsewhere.
128+
2. Build with CONFIG_HOTPLUG_CPU=y. Once boot completes, force the
129+
CPU offline, then bring it back online. This forces recurring
130+
timers to migrate elsewhere. If you are concerned with multiple
131+
CPUs, force them all offline before bringing the first one
132+
back online. Once you have onlined the CPUs in question, do not
133+
offline any other CPUs, because doing so could force the timer
134+
back onto one of the CPUs in question.
135+
RCU_SOFTIRQ: Do at least one of the following:
136+
1. Offload callbacks and keep the CPU in either dyntick-idle or
137+
adaptive-ticks state by doing all of the following:
138+
a. Build with CONFIG_RCU_NOCB_CPU=y, CONFIG_RCU_NOCB_CPU_ALL=y,
139+
CONFIG_NO_HZ_FULL=y, and, in addition ensure that the CPU
140+
to be de-jittered is marked as an adaptive-ticks CPU using
141+
the "nohz_full=" boot parameter. Bind the rcuo kthreads
142+
to housekeeping CPUs, which can tolerate OS jitter.
143+
b. To the extent possible, keep the CPU out of the kernel
144+
when it is non-idle, for example, by avoiding system
145+
calls and by forcing both kernel threads and interrupts
146+
to execute elsewhere.
147+
2. Enable RCU to do its processing remotely via dyntick-idle by
148+
doing all of the following:
149+
a. Build with CONFIG_NO_HZ=y and CONFIG_RCU_FAST_NO_HZ=y.
150+
b. Ensure that the CPU goes idle frequently, allowing other
151+
CPUs to detect that it has passed through an RCU quiescent
152+
state. If the kernel is built with CONFIG_NO_HZ_FULL=y,
153+
userspace execution also allows other CPUs to detect that
154+
the CPU in question has passed through a quiescent state.
155+
c. To the extent possible, keep the CPU out of the kernel
156+
when it is non-idle, for example, by avoiding system
157+
calls and by forcing both kernel threads and interrupts
158+
to execute elsewhere.
159+
160+
Name: rcuc/%u
161+
Purpose: Execute RCU callbacks in CONFIG_RCU_BOOST=y kernels.
162+
To reduce its OS jitter, do at least one of the following:
163+
1. Build the kernel with CONFIG_PREEMPT=n. This prevents these
164+
kthreads from being created in the first place, and also obviates
165+
the need for RCU priority boosting. This approach is feasible
166+
for workloads that do not require high degrees of responsiveness.
167+
2. Build the kernel with CONFIG_RCU_BOOST=n. This prevents these
168+
kthreads from being created in the first place. This approach
169+
is feasible only if your workload never requires RCU priority
170+
boosting, for example, if you ensure frequent idle time on all
171+
CPUs that might execute within the kernel.
172+
3. Build with CONFIG_RCU_NOCB_CPU=y and CONFIG_RCU_NOCB_CPU_ALL=y,
173+
which offloads all RCU callbacks to kthreads that can be moved
174+
off of CPUs susceptible to OS jitter. This approach prevents the
175+
rcuc/%u kthreads from having any work to do, so that they are
176+
never awakened.
177+
4. Ensure that the CPU never enters the kernel, and, in particular,
178+
avoid initiating any CPU hotplug operations on this CPU. This is
179+
another way of preventing any callbacks from being queued on the
180+
CPU, again preventing the rcuc/%u kthreads from having any work
181+
to do.
182+
183+
Name: rcuob/%d, rcuop/%d, and rcuos/%d
184+
Purpose: Offload RCU callbacks from the corresponding CPU.
185+
To reduce its OS jitter, do at least one of the following:
186+
1. Use affinity, cgroups, or other mechanism to force these kthreads
187+
to execute on some other CPU.
188+
2. Build with CONFIG_RCU_NOCB_CPUS=n, which will prevent these
189+
kthreads from being created in the first place. However, please
190+
note that this will not eliminate OS jitter, but will instead
191+
shift it to RCU_SOFTIRQ.
192+
193+
Name: watchdog/%u
194+
Purpose: Detect software lockups on each CPU.
195+
To reduce its OS jitter, do at least one of the following:
196+
1. Build with CONFIG_LOCKUP_DETECTOR=n, which will prevent these
197+
kthreads from being created in the first place.
198+
2. Echo a zero to /proc/sys/kernel/watchdog to disable the
199+
watchdog timer.
200+
3. Echo a large number of /proc/sys/kernel/watchdog_thresh in
201+
order to reduce the frequency of OS jitter due to the watchdog
202+
timer down to a level that is acceptable for your workload.

‎arch/Kconfig‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ config USE_GENERIC_SMP_HELPERS
213213
config GENERIC_SMP_IDLE_THREAD
214214
bool
215215

216+
config GENERIC_IDLE_POLL_SETUP
217+
bool
218+
216219
# Select if arch init_task initializer is different to init/init_task.c
217220
config ARCH_INIT_TASK
218221
bool

‎arch/arm/Kconfig‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config ARM
1414
select GENERIC_IRQ_PROBE
1515
select GENERIC_IRQ_SHOW
1616
select GENERIC_PCI_IOMAP
17+
select GENERIC_SCHED_CLOCK
1718
select GENERIC_SMP_IDLE_THREAD
1819
select GENERIC_IDLE_POLL_SETUP
1920
select GENERIC_STRNCPY_FROM_USER
@@ -38,6 +39,7 @@ config ARM
3839
select HAVE_GENERIC_HARDIRQS
3940
select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
4041
select HAVE_IDE if PCI || ISA || PCMCIA
42+
select HAVE_IRQ_TIME_ACCOUNTING
4143
select HAVE_KERNEL_GZIP
4244
select HAVE_KERNEL_LZMA
4345
select HAVE_KERNEL_LZO
@@ -488,7 +490,7 @@ config ARCH_IXP4XX
488490
config ARCH_DOVE
489491
bool "Marvell Dove"
490492
select ARCH_REQUIRE_GPIOLIB
491-
select CPU_V7
493+
select CPU_PJ4
492494
select GENERIC_CLOCKEVENTS
493495
select MIGHT_HAVE_PCI
494496
select PINCTRL

‎arch/arm/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ define archhelp
309309
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
310310
echo '* xipImage - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
311311
echo ' uImage - U-Boot wrapped zImage'
312-
echo ' bootpImage - Combined zImage and initial RAM disk'
312+
echo ' bootpImage - Combined zImage and initial RAM disk'
313313
echo ' (supply initrd image via make variable INITRD=<path>)'
314314
echo '* dtbs - Build device tree blobs for enabled boards'
315315
echo ' install - Install uncompressed kernel'

‎arch/arm/common/mcpm_platsmp.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include <linux/smp.h>
1616
#include <linux/spinlock.h>
1717

18-
#include <linux/irqchip/arm-gic.h>
19-
2018
#include <asm/mcpm.h>
2119
#include <asm/smp.h>
2220
#include <asm/smp_plat.h>
@@ -49,7 +47,6 @@ static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *i
4947
static void __cpuinit mcpm_secondary_init(unsigned int cpu)
5048
{
5149
mcpm_cpu_powered_up();
52-
gic_secondary_init(0);
5350
}
5451

5552
#ifdef CONFIG_HOTPLUG_CPU

‎arch/arm/common/timer-sp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#include <linux/of.h>
2929
#include <linux/of_address.h>
3030
#include <linux/of_irq.h>
31+
#include <linux/sched_clock.h>
3132

32-
#include <asm/sched_clock.h>
3333
#include <asm/hardware/arm_timer.h>
3434
#include <asm/hardware/timer-sp.h>
3535

‎arch/arm/include/asm/cmpxchg.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
233233
((__typeof__(*(ptr)))atomic64_cmpxchg(container_of((ptr), \
234234
atomic64_t, \
235235
counter), \
236-
(unsigned long)(o), \
237-
(unsigned long)(n)))
236+
(unsigned long long)(o), \
237+
(unsigned long long)(n)))
238238

239239
#define cmpxchg64_local(ptr, o, n) \
240240
((__typeof__(*(ptr)))local64_cmpxchg(container_of((ptr), \
241241
local64_t, \
242242
a), \
243-
(unsigned long)(o), \
244-
(unsigned long)(n)))
243+
(unsigned long long)(o), \
244+
(unsigned long long)(n)))
245245

246246
#endif /* __LINUX_ARM_ARCH__ >= 6 */
247247

‎arch/arm/include/asm/sched_clock.h‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
/*
2-
* sched_clock.h: support for extending counters to full 64-bit ns counter
3-
*
4-
* This program is free software; you can redistribute it and/or modify
5-
* it under the terms of the GNU General Public License version 2 as
6-
* published by the Free Software Foundation.
1+
/* You shouldn't include this file. Use linux/sched_clock.h instead.
2+
* Temporary file until all asm/sched_clock.h users are gone
73
*/
8-
#ifndef ASM_SCHED_CLOCK
9-
#define ASM_SCHED_CLOCK
10-
11-
extern void sched_clock_postinit(void);
12-
extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
13-
14-
extern unsigned long long (*sched_clock_func)(void);
15-
16-
#endif
4+
#include <linux/sched_clock.h>

‎arch/arm/kernel/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CFLAGS_REMOVE_return_address.o = -pg
1616
# Object file lists.
1717

1818
obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
19-
process.o ptrace.o return_address.o sched_clock.o \
19+
process.o ptrace.o return_address.o \
2020
setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
2121

2222
obj-$(CONFIG_ATAGS) += atags_parse.o

0 commit comments

Comments
 (0)