Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sysmon Fixes a problem that some driver(e.g. acpitz(...
details: https://anonhg.NetBSD.org/src/rev/646291b84766
branches: trunk
changeset: 356148:646291b84766
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Sep 06 11:08:53 2017 +0000
description:
Fixes a problem that some driver(e.g. acpitz(4) or coretemp(5)) which
use sysmon_envsys sleep waiting at "rndsrc" when "drvctl -d".
Don't call rnd_detach_source() in sme_remove_event() which is called
from sme_event_unregister_all(). Instead, call rnd_detach_source() in
sysmon_envsys_sensor_detach() and call sysmon_envsys_sensor_detach()
before sme_event_unregister_sensor(). Each sensor(envsys_data) has each
rnd_src, but some sme_events point to the same rnd_src in a sensor.
Calling rnd_detach_souce() twice with the same rnd_src brokes a reference
count in rnd_src. OK'd by pgoyette@.
diffstat:
sys/dev/sysmon/sysmon_envsys.c | 11 +++++++++--
sys/dev/sysmon/sysmon_envsys_events.c | 6 ++----
2 files changed, 11 insertions(+), 6 deletions(-)
diffs (73 lines):
diff -r fd3450bb9027 -r 646291b84766 sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c Wed Sep 06 06:05:23 2017 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c Wed Sep 06 11:08:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys.c,v 1.139 2015/12/14 01:08:47 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys.c,v 1.140 2017/09/06 11:08:53 msaitoh Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.139 2015/12/14 01:08:47 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.140 2017/09/06 11:08:53 msaitoh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -650,6 +650,8 @@
/*
* remove it, unhook from rnd(4), and decrement the sensors count.
*/
+ if (oedata->flags & ENVSYS_FHAS_ENTROPY)
+ rnd_detach_source(&oedata->rnd_src);
sme_event_unregister_sensor(sme, edata);
if (LIST_EMPTY(&sme->sme_events_list)) {
sme_events_halt_callout(sme);
@@ -970,6 +972,7 @@
{
prop_array_t array;
struct sysmon_envsys *osme;
+ envsys_data_t *edata;
KASSERT(sme != NULL);
@@ -987,6 +990,10 @@
LIST_REMOVE(sme, sme_list);
mutex_exit(&sme_global_mtx);
+ TAILQ_FOREACH(edata, &sme->sme_sensors_list, sensors_head) {
+ sysmon_envsys_sensor_detach(sme, edata);
+ }
+
/*
* Unregister all events associated with device.
*/
diff -r fd3450bb9027 -r 646291b84766 sys/dev/sysmon/sysmon_envsys_events.c
--- a/sys/dev/sysmon/sysmon_envsys_events.c Wed Sep 06 06:05:23 2017 +0000
+++ b/sys/dev/sysmon/sysmon_envsys_events.c Wed Sep 06 11:08:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_events.c,v 1.119 2017/06/01 02:45:11 chs Exp $ */
+/* $NetBSD: sysmon_envsys_events.c,v 1.120 2017/09/06 11:08:53 msaitoh Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.119 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.120 2017/09/06 11:08:53 msaitoh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -480,8 +480,6 @@
KASSERT(mutex_owned(&sme->sme_mtx));
- if (see->see_edata->flags & ENVSYS_FHAS_ENTROPY)
- rnd_detach_source(&see->see_edata->rnd_src);
LIST_REMOVE(see, see_list);
kmem_free(see, sizeof(*see));
}
Home |
Main Index |
Thread Index |
Old Index