Mon Aug 9 05:00:24 2010 UTC ()
Downgrade the currently supported maximum C-state to C1. There appears to be
timer-related interrupt issues also in C2. With C1 it is guaranteed that
acpicpu(4) will not cause any slowdowns due stalled local APIC timer.


(jruoho)
diff -r1.16 -r1.17 src/sys/dev/acpi/acpi_cpu_cstate.c

cvs diff -r1.16 -r1.17 src/sys/dev/acpi/acpi_cpu_cstate.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_cpu_cstate.c 2010/08/08 18:25:06 1.16
+++ src/sys/dev/acpi/acpi_cpu_cstate.c 2010/08/09 05:00:24 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_cpu_cstate.c,v 1.16 2010/08/08 18:25:06 jruoho Exp $ */ 1/* $NetBSD: acpi_cpu_cstate.c,v 1.17 2010/08/09 05:00:24 jruoho Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> 4 * Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.16 2010/08/08 18:25:06 jruoho Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.17 2010/08/09 05:00:24 jruoho Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/cpu.h> 33#include <sys/cpu.h>
34#include <sys/device.h> 34#include <sys/device.h>
35#include <sys/kernel.h> 35#include <sys/kernel.h>
36#include <sys/once.h> 36#include <sys/once.h>
37#include <sys/mutex.h> 37#include <sys/mutex.h>
38#include <sys/timetc.h> 38#include <sys/timetc.h>
39 39
40#include <dev/pci/pcivar.h> 40#include <dev/pci/pcivar.h>
41#include <dev/pci/pcidevs.h> 41#include <dev/pci/pcidevs.h>
42 42
43#include <dev/acpi/acpireg.h> 43#include <dev/acpi/acpireg.h>
@@ -55,33 +55,35 @@ static ACPI_STATUS acpicpu_cstate_cst(s @@ -55,33 +55,35 @@ static ACPI_STATUS acpicpu_cstate_cst(s
55static ACPI_STATUS acpicpu_cstate_cst_add(struct acpicpu_softc *, 55static ACPI_STATUS acpicpu_cstate_cst_add(struct acpicpu_softc *,
56 ACPI_OBJECT *); 56 ACPI_OBJECT *);
57static void acpicpu_cstate_cst_bios(void); 57static void acpicpu_cstate_cst_bios(void);
58static void acpicpu_cstate_fadt(struct acpicpu_softc *); 58static void acpicpu_cstate_fadt(struct acpicpu_softc *);
59static void acpicpu_cstate_quirks(struct acpicpu_softc *); 59static void acpicpu_cstate_quirks(struct acpicpu_softc *);
60static int acpicpu_cstate_quirks_piix4(struct pci_attach_args *); 60static int acpicpu_cstate_quirks_piix4(struct pci_attach_args *);
61static int acpicpu_cstate_latency(struct acpicpu_softc *); 61static int acpicpu_cstate_latency(struct acpicpu_softc *);
62static bool acpicpu_cstate_bm_check(void); 62static bool acpicpu_cstate_bm_check(void);
63static void acpicpu_cstate_idle_enter(struct acpicpu_softc *,int); 63static void acpicpu_cstate_idle_enter(struct acpicpu_softc *,int);
64 64
65extern struct acpicpu_softc **acpicpu_sc; 65extern struct acpicpu_softc **acpicpu_sc;
66 66
67/* 67/*
68 * XXX: The local APIC timer (as well as TSC) is typically 68 * XXX: The local APIC timer (as well as TSC) is typically stopped in C3.
69 * stopped in C3. For now, we cannot but disable C3. 69 * For now, we cannot but disable C3. But there appears to be timer-
 70 * related interrupt issues also in C2. The only entirely safe option
 71 * at the moment is to use C1.
70 */ 72 */
71#ifdef ACPICPU_ENABLE_C3 73#ifdef ACPICPU_ENABLE_C3
72static int cs_state_max = ACPI_STATE_C3; 74static int cs_state_max = ACPI_STATE_C3;
73#else 75#else
74static int cs_state_max = ACPI_STATE_C2; 76static int cs_state_max = ACPI_STATE_C1;
75#endif 77#endif
76 78
77void 79void
78acpicpu_cstate_attach(device_t self) 80acpicpu_cstate_attach(device_t self)
79{ 81{
80 struct acpicpu_softc *sc = device_private(self); 82 struct acpicpu_softc *sc = device_private(self);
81 ACPI_STATUS rv; 83 ACPI_STATUS rv;
82 84
83 /* 85 /*
84 * Either use the preferred _CST or resort to FADT. 86 * Either use the preferred _CST or resort to FADT.
85 */ 87 */
86 rv = acpicpu_cstate_cst(sc); 88 rv = acpicpu_cstate_cst(sc);
87 89