android_kernel_motorola_sm6225/arch/x86/kernel/cpu
Aristeu Rozanski b3e15bdef6 x86, NMI watchdog: setup before enabling NMI watchdog
There's a small window when NMI watchdog is being set up that if any NMIs
are triggered, the NMI code will make make use of not initalized wd_ops
elements:
	void setup_apic_nmi_watchdog(void *unused)
	{
		if (__get_cpu_var(wd_enabled))
			return;

		/* cheap hack to support suspend/resume */
		/* if cpu0 is not active neither should the other cpus */
		if (smp_processor_id() != 0 && atomic_read(&nmi_active) <= 0)
			return;

		switch (nmi_watchdog) {
		case NMI_LOCAL_APIC:
			/* enable it before to avoid race with handler */
-->			__get_cpu_var(wd_enabled) = 1;
-->			if (lapic_watchdog_init(nmi_hz) < 0) {
(...)
	asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
	{
	(...)
			if (nmi_watchdog_tick(regs, reason))
				return;
(...)
	notrace __kprobes int
	nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
	{
	(...)
		if (!__get_cpu_var(wd_enabled))
			return rc;
		switch (nmi_watchdog) {
		case NMI_LOCAL_APIC:
			rc |= lapic_wd_event(nmi_hz);
(...)
int lapic_wd_event(unsigned nmi_hz)
{
	struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
	u64 ctr;

-->	rdmsrl(wd->perfctr_msr, ctr);

and wd->*_msr will be initialized on each processor type specific setup, after
enabling NMIs for PMIs. Since the counter was just set, the chances of an
performance counter generated NMI is minimal, but any other unknown NMI would
trigger the problem. This patch fixes the problem by setting everything up
before enabling performance counter generated NMIs and will set wd_enabled
using a callback function.

Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Acked-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-22 19:48:19 +02:00
..
cpufreq Revert "[CPUFREQ][2/2] preregister support for powernow-k8" 2008-08-19 13:34:59 -07:00
mcheck x86 MCE: Fix CPU hotplug problem with multiple multicore AMD CPUs 2008-08-23 17:49:19 +02:00
mtrr x86: work around MTRR mask setting, v2 2008-08-22 14:12:31 +02:00
addon_cpuid_features.c x86: PAT Update validate_pat_support for intel CPUs 2008-08-21 13:27:34 +02:00
amd.c x86: move mtrr cpu cap setting early in early_init_xxxx 2008-09-06 17:50:55 +02:00
amd_64.c x86_64: further cleanup of 32-bit compat syscall mechanisms 2008-07-16 11:08:27 +02:00
bugs.c x86: fdiv bug detection fix 2008-07-31 23:56:27 +02:00
bugs_64.c x86: move bugs_64.c to cpu/bugs_64.c 2008-06-03 14:43:00 -07:00
centaur.c x86: move mtrr cpu cap setting early in early_init_xxxx 2008-09-06 17:50:55 +02:00
centaur_64.c x86: get x86_phys_bits early 2008-07-14 09:24:16 +02:00
common.c x86: completely disable NOPL on 32 bits 2008-09-16 09:33:57 -07:00
common_64.c x86: cpu_init(): fix memory leak when using CPU hotplug 2008-09-06 20:48:16 +02:00
cpu.h x86: make 64-bit identify_cpu use cpu_dev 2008-07-08 07:47:39 +02:00
cyrix.c x86: move mtrr cpu cap setting early in early_init_xxxx 2008-09-06 17:50:55 +02:00
feature_names.c x86: add NOPL as a synthetic CPU feature bit 2008-09-05 16:13:52 -07:00
intel.c x86: APIC: remove apic_write_around(); use alternatives 2008-07-18 12:51:21 +02:00
intel_64.c x86: get x86_phys_bits early 2008-07-14 09:24:16 +02:00
intel_cacheinfo.c cpumask: change cpumask_of_cpu_ptr to use new cpumask_of_cpu 2008-07-26 16:40:33 +02:00
Makefile x86: seperate funcs from setup_64 to cpu common_64.c 2008-07-08 12:48:34 +02:00
perfctr-watchdog.c x86, NMI watchdog: setup before enabling NMI watchdog 2008-09-22 19:48:19 +02:00
proc.c NR_CPUS: Replace NR_CPUS in arch/x86/kernel/cpu/proc.c 2008-07-20 10:21:09 +02:00
transmeta.c x86: clean up cpu capabilities accesses, transmeta.c 2008-04-17 17:40:51 +02:00
umc.c x86: coding style fixes to arch/x86/kernel/cpu/umc.c 2008-04-17 17:40:49 +02:00