diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-02-08 04:41:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-02-08 04:41:49 +0000 |
commit | 79f6c68af24640eaebf43363cea9fd301b83a624 (patch) | |
tree | d32e0d2189599e7fbaa47e6abcce812a5055f930 | |
parent | 250038d786eeb7594fe1d327631930d8e40d9d09 (diff) |
Only attach cpu-based sensors on the primary cpu, for two reasons
- The sensor framework cannot fetch values on the right cpu
- sensor_task_register() calls malloc, and calling it is inapproapriate
ok guenther
-rw-r--r-- | sys/arch/amd64/amd64/identcpu.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c index fd5fd9108f4..4135c54ee0c 100644 --- a/sys/arch/amd64/amd64/identcpu.c +++ b/sys/arch/amd64/amd64/identcpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: identcpu.c,v 1.59 2015/02/08 03:01:29 mlarkin Exp $ */ +/* $OpenBSD: identcpu.c,v 1.60 2015/02/08 04:41:48 deraadt Exp $ */ /* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /* @@ -562,7 +562,8 @@ identifycpu(struct cpu_info *ci) ci->ci_cflushsz = ((cflushsz >> 8) & 0xff) * 8; } - if (!strcmp(cpu_vendor, "GenuineIntel") && cpuid_level >= 0x06 ) { + if (CPU_IS_PRIMARY(ci) && !strcmp(cpu_vendor, "GenuineIntel") && + cpuid_level >= 0x06 ) { CPUID(0x06, val, dummy, dummy, dummy); if (val & 0x1) { strlcpy(ci->ci_sensordev.xname, ci->ci_dev->dv_xname, @@ -579,7 +580,7 @@ identifycpu(struct cpu_info *ci) if (!strcmp(cpu_vendor, "AuthenticAMD")) amd64_errata(ci); - if (!strcmp(cpu_vendor, "CentaurHauls")) { + if (CPU_IS_PRIMARY(ci) && !strcmp(cpu_vendor, "CentaurHauls")) { ci->cpu_setup = via_nano_setup; #ifndef SMALL_KERNEL strlcpy(ci->ci_sensordev.xname, ci->ci_dev->dv_xname, diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 4c45ad25921..afa02af241a 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.566 2015/02/07 03:29:27 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.567 2015/02/08 04:41:48 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -1159,7 +1159,8 @@ cyrix3_cpu_setup(struct cpu_info *ci) case 13: /* C7-M Type D */ case 15: /* Nano */ #if !defined(SMALL_KERNEL) - if (model == 10 || model == 13 || model == 15) { + if (CPU_IS_PRIMARY(ci) && + (model == 10 || model == 13 || model == 15)) { /* Setup the sensors structures */ strlcpy(ci->ci_sensordev.xname, ci->ci_dev.dv_xname, sizeof(ci->ci_sensordev.xname)); @@ -1481,7 +1482,7 @@ intel686_cpusensors_setup(struct cpu_info *ci) { u_int regs[4]; - if (cpuid_level < 0x06) + if (!CPU_IS_PRIMARY(ci) || cpuid_level < 0x06) return; /* CPUID.06H.EAX[0] = 1 tells us if we have on-die sensor */ |