diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/addon_cpuid_features.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 77 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/longhaul.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/ftrace.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/ptrace.c | 3 |
7 files changed, 49 insertions, 42 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 0beba0d1468d..bb83b1c397aa 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -154,6 +154,7 @@ | |||
154 | * CPUID levels like 0x6, 0xA etc | 154 | * CPUID levels like 0x6, 0xA etc |
155 | */ | 155 | */ |
156 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ | 156 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ |
157 | #define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */ | ||
157 | 158 | ||
158 | /* Virtualization flags: Linux defined */ | 159 | /* Virtualization flags: Linux defined */ |
159 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ | 160 | #define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 098ec84b8c00..f2870920f246 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -431,6 +431,12 @@ static void __cpuinit setup_APIC_timer(void) | |||
431 | { | 431 | { |
432 | struct clock_event_device *levt = &__get_cpu_var(lapic_events); | 432 | struct clock_event_device *levt = &__get_cpu_var(lapic_events); |
433 | 433 | ||
434 | if (cpu_has(¤t_cpu_data, X86_FEATURE_ARAT)) { | ||
435 | lapic_clockevent.features &= ~CLOCK_EVT_FEAT_C3STOP; | ||
436 | /* Make LAPIC timer preferrable over percpu HPET */ | ||
437 | lapic_clockevent.rating = 150; | ||
438 | } | ||
439 | |||
434 | memcpy(levt, &lapic_clockevent, sizeof(*levt)); | 440 | memcpy(levt, &lapic_clockevent, sizeof(*levt)); |
435 | levt->cpumask = cpumask_of(smp_processor_id()); | 441 | levt->cpumask = cpumask_of(smp_processor_id()); |
436 | 442 | ||
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 8220ae69849d..c965e5212714 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -31,6 +31,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
31 | 31 | ||
32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { | 32 | static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { |
33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, | 33 | { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 }, |
34 | { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 }, | ||
34 | { 0, 0, 0, 0 } | 35 | { 0, 0, 0, 0 } |
35 | }; | 36 | }; |
36 | 37 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 19f6b9d27e83..3e3cd3db7a0c 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -68,6 +68,7 @@ struct acpi_cpufreq_data { | |||
68 | unsigned int max_freq; | 68 | unsigned int max_freq; |
69 | unsigned int resume; | 69 | unsigned int resume; |
70 | unsigned int cpu_feature; | 70 | unsigned int cpu_feature; |
71 | u64 saved_aperf, saved_mperf; | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); | 74 | static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); |
@@ -152,7 +153,8 @@ struct drv_cmd { | |||
152 | u32 val; | 153 | u32 val; |
153 | }; | 154 | }; |
154 | 155 | ||
155 | static long do_drv_read(void *_cmd) | 156 | /* Called via smp_call_function_single(), on the target CPU */ |
157 | static void do_drv_read(void *_cmd) | ||
156 | { | 158 | { |
157 | struct drv_cmd *cmd = _cmd; | 159 | struct drv_cmd *cmd = _cmd; |
158 | u32 h; | 160 | u32 h; |
@@ -169,10 +171,10 @@ static long do_drv_read(void *_cmd) | |||
169 | default: | 171 | default: |
170 | break; | 172 | break; |
171 | } | 173 | } |
172 | return 0; | ||
173 | } | 174 | } |
174 | 175 | ||
175 | static long do_drv_write(void *_cmd) | 176 | /* Called via smp_call_function_many(), on the target CPUs */ |
177 | static void do_drv_write(void *_cmd) | ||
176 | { | 178 | { |
177 | struct drv_cmd *cmd = _cmd; | 179 | struct drv_cmd *cmd = _cmd; |
178 | u32 lo, hi; | 180 | u32 lo, hi; |
@@ -191,23 +193,18 @@ static long do_drv_write(void *_cmd) | |||
191 | default: | 193 | default: |
192 | break; | 194 | break; |
193 | } | 195 | } |
194 | return 0; | ||
195 | } | 196 | } |
196 | 197 | ||
197 | static void drv_read(struct drv_cmd *cmd) | 198 | static void drv_read(struct drv_cmd *cmd) |
198 | { | 199 | { |
199 | cmd->val = 0; | 200 | cmd->val = 0; |
200 | 201 | ||
201 | work_on_cpu(cpumask_any(cmd->mask), do_drv_read, cmd); | 202 | smp_call_function_single(cpumask_any(cmd->mask), do_drv_read, cmd, 1); |
202 | } | 203 | } |
203 | 204 | ||
204 | static void drv_write(struct drv_cmd *cmd) | 205 | static void drv_write(struct drv_cmd *cmd) |
205 | { | 206 | { |
206 | unsigned int i; | 207 | smp_call_function_many(cmd->mask, do_drv_write, cmd, 1); |
207 | |||
208 | for_each_cpu(i, cmd->mask) { | ||
209 | work_on_cpu(i, do_drv_write, cmd); | ||
210 | } | ||
211 | } | 208 | } |
212 | 209 | ||
213 | static u32 get_cur_val(const struct cpumask *mask) | 210 | static u32 get_cur_val(const struct cpumask *mask) |
@@ -241,28 +238,23 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
241 | return cmd.val; | 238 | return cmd.val; |
242 | } | 239 | } |
243 | 240 | ||
244 | struct perf_cur { | 241 | struct perf_pair { |
245 | union { | 242 | union { |
246 | struct { | 243 | struct { |
247 | u32 lo; | 244 | u32 lo; |
248 | u32 hi; | 245 | u32 hi; |
249 | } split; | 246 | } split; |
250 | u64 whole; | 247 | u64 whole; |
251 | } aperf_cur, mperf_cur; | 248 | } aperf, mperf; |
252 | }; | 249 | }; |
253 | 250 | ||
254 | 251 | /* Called via smp_call_function_single(), on the target CPU */ | |
255 | static long read_measured_perf_ctrs(void *_cur) | 252 | static void read_measured_perf_ctrs(void *_cur) |
256 | { | 253 | { |
257 | struct perf_cur *cur = _cur; | 254 | struct perf_pair *cur = _cur; |
258 | |||
259 | rdmsr(MSR_IA32_APERF, cur->aperf_cur.split.lo, cur->aperf_cur.split.hi); | ||
260 | rdmsr(MSR_IA32_MPERF, cur->mperf_cur.split.lo, cur->mperf_cur.split.hi); | ||
261 | |||
262 | wrmsr(MSR_IA32_APERF, 0, 0); | ||
263 | wrmsr(MSR_IA32_MPERF, 0, 0); | ||
264 | 255 | ||
265 | return 0; | 256 | rdmsr(MSR_IA32_APERF, cur->aperf.split.lo, cur->aperf.split.hi); |
257 | rdmsr(MSR_IA32_MPERF, cur->mperf.split.lo, cur->mperf.split.hi); | ||
266 | } | 258 | } |
267 | 259 | ||
268 | /* | 260 | /* |
@@ -281,52 +273,57 @@ static long read_measured_perf_ctrs(void *_cur) | |||
281 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, | 273 | static unsigned int get_measured_perf(struct cpufreq_policy *policy, |
282 | unsigned int cpu) | 274 | unsigned int cpu) |
283 | { | 275 | { |
284 | struct perf_cur cur; | 276 | struct perf_pair readin, cur; |
285 | unsigned int perf_percent; | 277 | unsigned int perf_percent; |
286 | unsigned int retval; | 278 | unsigned int retval; |
287 | 279 | ||
288 | if (!work_on_cpu(cpu, read_measured_perf_ctrs, &cur)) | 280 | if (smp_call_function_single(cpu, read_measured_perf_ctrs, &cur, 1)) |
289 | return 0; | 281 | return 0; |
290 | 282 | ||
283 | cur.aperf.whole = readin.aperf.whole - | ||
284 | per_cpu(drv_data, cpu)->saved_aperf; | ||
285 | cur.mperf.whole = readin.mperf.whole - | ||
286 | per_cpu(drv_data, cpu)->saved_mperf; | ||
287 | per_cpu(drv_data, cpu)->saved_aperf = readin.aperf.whole; | ||
288 | per_cpu(drv_data, cpu)->saved_mperf = readin.mperf.whole; | ||
289 | |||
291 | #ifdef __i386__ | 290 | #ifdef __i386__ |
292 | /* | 291 | /* |
293 | * We dont want to do 64 bit divide with 32 bit kernel | 292 | * We dont want to do 64 bit divide with 32 bit kernel |
294 | * Get an approximate value. Return failure in case we cannot get | 293 | * Get an approximate value. Return failure in case we cannot get |
295 | * an approximate value. | 294 | * an approximate value. |
296 | */ | 295 | */ |
297 | if (unlikely(cur.aperf_cur.split.hi || cur.mperf_cur.split.hi)) { | 296 | if (unlikely(cur.aperf.split.hi || cur.mperf.split.hi)) { |
298 | int shift_count; | 297 | int shift_count; |
299 | u32 h; | 298 | u32 h; |
300 | 299 | ||
301 | h = max_t(u32, cur.aperf_cur.split.hi, cur.mperf_cur.split.hi); | 300 | h = max_t(u32, cur.aperf.split.hi, cur.mperf.split.hi); |
302 | shift_count = fls(h); | 301 | shift_count = fls(h); |
303 | 302 | ||
304 | cur.aperf_cur.whole >>= shift_count; | 303 | cur.aperf.whole >>= shift_count; |
305 | cur.mperf_cur.whole >>= shift_count; | 304 | cur.mperf.whole >>= shift_count; |
306 | } | 305 | } |
307 | 306 | ||
308 | if (((unsigned long)(-1) / 100) < cur.aperf_cur.split.lo) { | 307 | if (((unsigned long)(-1) / 100) < cur.aperf.split.lo) { |
309 | int shift_count = 7; | 308 | int shift_count = 7; |
310 | cur.aperf_cur.split.lo >>= shift_count; | 309 | cur.aperf.split.lo >>= shift_count; |
311 | cur.mperf_cur.split.lo >>= shift_count; | 310 | cur.mperf.split.lo >>= shift_count; |
312 | } | 311 | } |
313 | 312 | ||
314 | if (cur.aperf_cur.split.lo && cur.mperf_cur.split.lo) | 313 | if (cur.aperf.split.lo && cur.mperf.split.lo) |
315 | perf_percent = (cur.aperf_cur.split.lo * 100) / | 314 | perf_percent = (cur.aperf.split.lo * 100) / cur.mperf.split.lo; |
316 | cur.mperf_cur.split.lo; | ||
317 | else | 315 | else |
318 | perf_percent = 0; | 316 | perf_percent = 0; |
319 | 317 | ||
320 | #else | 318 | #else |
321 | if (unlikely(((unsigned long)(-1) / 100) < cur.aperf_cur.whole)) { | 319 | if (unlikely(((unsigned long)(-1) / 100) < cur.aperf.whole)) { |
322 | int shift_count = 7; | 320 | int shift_count = 7; |
323 | cur.aperf_cur.whole >>= shift_count; | 321 | cur.aperf.whole >>= shift_count; |
324 | cur.mperf_cur.whole >>= shift_count; | 322 | cur.mperf.whole >>= shift_count; |
325 | } | 323 | } |
326 | 324 | ||
327 | if (cur.aperf_cur.whole && cur.mperf_cur.whole) | 325 | if (cur.aperf.whole && cur.mperf.whole) |
328 | perf_percent = (cur.aperf_cur.whole * 100) / | 326 | perf_percent = (cur.aperf.whole * 100) / cur.mperf.whole; |
329 | cur.mperf_cur.whole; | ||
330 | else | 327 | else |
331 | perf_percent = 0; | 328 | perf_percent = 0; |
332 | 329 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c index 0bd48e65a0ca..ce2ed3e4aad9 100644 --- a/arch/x86/kernel/cpu/cpufreq/longhaul.c +++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/timex.h> | 33 | #include <linux/timex.h> |
34 | #include <linux/io.h> | 34 | #include <linux/io.h> |
35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
36 | #include <linux/kernel.h> | ||
37 | 36 | ||
38 | #include <asm/msr.h> | 37 | #include <asm/msr.h> |
39 | #include <acpi/processor.h> | 38 | #include <acpi/processor.h> |
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 70a10ca100f6..18dfa30795c9 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | 20 | ||
21 | #include <trace/syscall.h> | ||
22 | |||
21 | #include <asm/cacheflush.h> | 23 | #include <asm/cacheflush.h> |
22 | #include <asm/ftrace.h> | 24 | #include <asm/ftrace.h> |
23 | #include <asm/nops.h> | 25 | #include <asm/nops.h> |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index fe9345c967de..23b7c8f017e2 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/audit.h> | 21 | #include <linux/audit.h> |
22 | #include <linux/seccomp.h> | 22 | #include <linux/seccomp.h> |
23 | #include <linux/signal.h> | 23 | #include <linux/signal.h> |
24 | #include <linux/ftrace.h> | ||
25 | 24 | ||
26 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
27 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
@@ -35,6 +34,8 @@ | |||
35 | #include <asm/proto.h> | 34 | #include <asm/proto.h> |
36 | #include <asm/ds.h> | 35 | #include <asm/ds.h> |
37 | 36 | ||
37 | #include <trace/syscall.h> | ||
38 | |||
38 | #include "tls.h" | 39 | #include "tls.h" |
39 | 40 | ||
40 | enum x86_regset { | 41 | enum x86_regset { |