From: Sepherosa Ziehau Date: Mon, 4 May 2015 13:04:33 +0000 (+0800) Subject: coretemp: Enhance data of devctl notify event. X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/3f8829e82b7f4e633cff46b06a05e1eb6c02d46f coretemp: Enhance data of devctl notify event. --- diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5 index 0a33b46cd4..c45c6fad01 100644 --- a/sbin/devd/devd.conf.5 +++ b/sbin/devd/devd.conf.5 @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd February 14, 2015 +.Dd May 4, 2015 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -252,6 +252,8 @@ CIS-product. CIS-vendor. .It Li class Device class. +.It Li core +CPU core (coretemp). .It Li device Device ID. .It Li devclass @@ -282,14 +284,14 @@ Peripheral mode (USB) Match the value of the .Dq Li notify variable. +.It Li node +CPU node (coretemp/memtemp). .It Li parent Parent device .It Li port Hub port number (USB) .It Li product Product ID (pccard/USB). -.It Li node -Node of the DIMM (memtemp). .It Li release Hardware revision (USB) .It Li sernum diff --git a/share/man/man4/coretemp.4 b/share/man/man4/coretemp.4 index 3de96ee2d2..c34551d72d 100644 --- a/share/man/man4/coretemp.4 +++ b/share/man/man4/coretemp.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.5 2011/05/22 14:03:30 uqs Exp $ .\" -.Dd April 12, 2015 +.Dd May 4, 2015 .Dt CORETEMP 4 .Os .Sh NAME @@ -64,9 +64,15 @@ hw.sensors.cpu2.temp0: 47.00 degC (node0 core1), OK hw.sensors.cpu3.temp0: 47.00 degC (node0 core1), OK hw.sensors.cpu_node0.temp0: 50.00 degC (node0), OK .Ed +.Pp +If the core or package temperature reaches critical level, +a notify event will be sent using +.Xr devctl 4 . .Sh SEE ALSO .Xr systat 1 , .Xr sysctl 3 , +.Xr devctl 4 , +.Xr devd 8 , .Xr sensorsd 8 , .Xr sysctl 8 .Sh HISTORY diff --git a/sys/dev/powermng/coretemp/coretemp.c b/sys/dev/powermng/coretemp/coretemp.c index a0bea99eae..2698def219 100644 --- a/sys/dev/powermng/coretemp/coretemp.c +++ b/sys/dev/powermng/coretemp/coretemp.c @@ -534,14 +534,17 @@ coretemp_msr_temp(struct coretemp_softc *sc, uint64_t msr) */ if (MSR_THERM_STATUS_IS_CRITICAL(msr)) { if ((sc->sc_flags & CORETEMP_FLAG_CRIT) == 0) { - char stemp[16]; + char stemp[16], data[64]; device_printf(sc->sc_dev, "critical temperature detected, " "suggest system shutdown\n"); ksnprintf(stemp, sizeof(stemp), "%d", temp); - devctl_notify("coretemp", "Thermal", stemp, - "notify=0xcc"); /* TODO: add node and core */ + ksnprintf(data, sizeof(data), + "notify=0xcc node=%d core=%d", + get_chip_ID(sc->sc_cpu), + get_core_number_within_chip(sc->sc_cpu)); + devctl_notify("coretemp", "Thermal", stemp, data); atomic_set_int(&sc->sc_flags, CORETEMP_FLAG_CRIT); } } else if (sc->sc_flags & CORETEMP_FLAG_CRIT) { @@ -577,14 +580,15 @@ coretemp_pkg_msr_temp(struct coretemp_softc *sc, uint64_t msr) */ if (MSR_PKGTM_STATUS_IS_CRITICAL(msr)) { if ((sc->sc_flags & CORETEMP_FLAG_PKGCRIT) == 0) { - char stemp[16]; + char stemp[16], data[64]; device_printf(sc->sc_dev, "critical temperature detected, " "suggest system shutdown\n"); ksnprintf(stemp, sizeof(stemp), "%d", temp); - devctl_notify("coretemp", "Thermal", stemp, - "notify=0xcc"); /* TODO: add node */ + ksnprintf(data, sizeof(data), "notify=0xcc node=%d", + get_chip_ID(sc->sc_cpu)); + devctl_notify("coretemp", "Thermal", stemp, data); atomic_set_int(&sc->sc_flags, CORETEMP_FLAG_PKGCRIT); } } else if (sc->sc_flags & CORETEMP_FLAG_PKGCRIT) {