Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Remove some unnecessary locking. Mainly a leftover from ...
details: https://anonhg.NetBSD.org/src/rev/992bd1bb8c26
branches: trunk
changeset: 757073:992bd1bb8c26
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Aug 13 18:44:24 2010 +0000
description:
Remove some unnecessary locking. Mainly a leftover from previous revisions
where the dynamic maximum/minimum was used also when retrieving the current
state. The state-array itself changes only in C-states.
diffstat:
sys/arch/x86/acpi/acpi_cpu_md.c | 14 ++------------
sys/dev/acpi/acpi_cpu_pstate.c | 13 +++----------
sys/dev/acpi/acpi_cpu_tstate.c | 11 +++--------
3 files changed, 8 insertions(+), 30 deletions(-)
diffs (172 lines):
diff -r 6aef681014bc -r 992bd1bb8c26 sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c Fri Aug 13 18:29:40 2010 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c Fri Aug 13 18:44:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.10 2010/08/13 16:21:50 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.11 2010/08/13 18:44:24 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.10 2010/08/13 16:21:50 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.11 2010/08/13 18:44:24 jruoho Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -430,8 +430,6 @@
val = rdmsr(MSR_PERF_STATUS);
val = val & 0xffff;
- mutex_enter(&sc->sc_mtx);
-
for (i = 0; i < sc->sc_pstate_count; i++) {
ps = &sc->sc_pstate[i];
@@ -440,14 +438,11 @@
continue;
if (val == ps->ps_status) {
- mutex_exit(&sc->sc_mtx);
*freq = ps->ps_freq;
return 0;
}
}
- mutex_exit(&sc->sc_mtx);
-
return EIO;
default:
@@ -507,8 +502,6 @@
if (rv != 0)
return rv;
- mutex_enter(&sc->sc_mtx);
-
for (i = 0; i < sc->sc_tstate_count; i++) {
ts = &sc->sc_tstate[i];
@@ -517,14 +510,11 @@
continue;
if (val == ts->ts_control || val == ts->ts_status) {
- mutex_exit(&sc->sc_mtx);
*percent = ts->ts_percent;
return 0;
}
}
- mutex_exit(&sc->sc_mtx);
-
return EIO;
}
diff -r 6aef681014bc -r 992bd1bb8c26 sys/dev/acpi/acpi_cpu_pstate.c
--- a/sys/dev/acpi/acpi_cpu_pstate.c Fri Aug 13 18:29:40 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu_pstate.c Fri Aug 13 18:44:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_pstate.c,v 1.15 2010/08/13 16:21:50 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_pstate.c,v 1.16 2010/08/13 18:44:24 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.15 2010/08/13 16:21:50 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.16 2010/08/13 18:44:24 jruoho Exp $");
#include <sys/param.h>
#include <sys/evcnt.h>
@@ -241,11 +241,9 @@
sc = device_private(self);
mutex_enter(&sc->sc_mtx);
-
old = sc->sc_pstate_max;
acpicpu_pstate_change(sc);
new = sc->sc_pstate_max;
-
mutex_exit(&sc->sc_mtx);
if (old != new) {
@@ -595,8 +593,6 @@
goto fail;
}
- mutex_enter(&sc->sc_mtx);
-
for (i = 0; i < sc->sc_pstate_count; i++) {
if (sc->sc_pstate[i].ps_freq == 0)
@@ -608,8 +604,6 @@
}
}
- mutex_exit(&sc->sc_mtx);
-
if (__predict_false(ps == NULL)) {
rv = EIO;
goto fail;
@@ -727,9 +721,8 @@
goto fail;
}
+ mutex_enter(&sc->sc_mtx);
ps->ps_evcnt.ev_count++;
-
- mutex_enter(&sc->sc_mtx);
sc->sc_pstate_current = freq;
mutex_exit(&sc->sc_mtx);
diff -r 6aef681014bc -r 992bd1bb8c26 sys/dev/acpi/acpi_cpu_tstate.c
--- a/sys/dev/acpi/acpi_cpu_tstate.c Fri Aug 13 18:29:40 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu_tstate.c Fri Aug 13 18:44:24 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_tstate.c,v 1.1 2010/08/13 16:21:50 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_tstate.c,v 1.2 2010/08/13 18:44:24 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.1 2010/08/13 16:21:50 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.2 2010/08/13 18:44:24 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -655,8 +655,6 @@
val = (val >> offset) & 0x0F;
- mutex_enter(&sc->sc_mtx);
-
for (i = 0; i < sc->sc_tstate_count; i++) {
if (sc->sc_tstate[i].ts_percent == 0)
@@ -677,8 +675,6 @@
}
}
- mutex_exit(&sc->sc_mtx);
-
if (__predict_false(ts == NULL)) {
rv = EIO;
goto fail;
@@ -816,9 +812,8 @@
goto fail;
}
+ mutex_enter(&sc->sc_mtx);
ts->ts_evcnt.ev_count++;
-
- mutex_enter(&sc->sc_mtx);
sc->sc_tstate_current = percent;
mutex_exit(&sc->sc_mtx);
Home |
Main Index |
Thread Index |
Old Index