NetBSD Problem Report #36226

From juan@xtrarom.org  Thu Apr 26 21:17:46 2007
Return-Path: <juan@xtrarom.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 5F72363B960
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 26 Apr 2007 21:17:46 +0000 (UTC)
Message-Id: <20070426211754.D2B2916A8E@nocturno>
Date: Thu, 26 Apr 2007 23:17:54 +0200 (CEST)
From: juan@xtrarom.org
Reply-To: juan@xtrarom.org
To: gnats-bugs@NetBSD.org
Subject: envsys(4) drivers shouldn't refresh all sensors in gtredata
X-Send-Pr-Version: 3.95

>Number:         36226
>Category:       kern
>Synopsis:       envsys(4) drivers shouldn't refresh all sensors in gtredata
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 26 21:20:00 +0000 2007
>Closed-Date:    Sun Jul 01 08:12:43 +0000 2007
>Last-Modified:  Sun Jul 01 08:30:01 +0000 2007
>Originator:     Juan RP
>Release:        NetBSD 4.99.18
>Organization:
>Environment:
System: NetBSD nocturno 4.99.18 NetBSD 4.99.18 (Nocturno) #126: Thu Apr 26 23:01:01 CEST 2007 juan@nocturno:/home/juan/build/src/obj/sys/arch/amd64/compile/Nocturno amd64
Architecture: x86_64
Machine: amd64
>Description:
	Many envsys(4) drivers assume that in foo_gtredata they should
	update all sensors (ignoring sensor's index), but this is wrong
	because only one sensor should be updated by this function callback,
	the index is set in envsys_tre_data_t->sensor.

	That means that if a driver updates 12 sensors in gtredata, will
	update the sensors n^2. I verified this behaviour with aiboost(4)
	and lm(4), and I fixed them to only update onse sensor per gtredata
	call.

>How-To-Repeat:
	Code inspection.
>Fix:
	I have fixed aiboost(4) and lm(4), more drivers to follow.


>Release-Note:

>Audit-Trail:
From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src/sys/dev/isa
Date: Mon,  7 May 2007 07:48:28 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Mon May  7 07:48:28 UTC 2007

 Modified Files:
 	src/sys/dev/isa: ug.c ugvar.h

 Log Message:
 Don't refresh all sensors in the gtredata function, just the sensor
 that was requested. This is related to PR kern/36226.

 Patch from Mihai Chelaru in private email.


 To generate a diff of this commit:
 cvs rdiff -r1.3 -r1.4 src/sys/dev/isa/ug.c src/sys/dev/isa/ugvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src/sys/dev/isa
Date: Mon,  7 May 2007 10:54:45 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Mon May  7 10:54:45 UTC 2007

 Modified Files:
 	src/sys/dev/isa: it.c

 Log Message:
 Don't refresh all sensors in the gtredata function, just the sensor
 that was requested. This is related to PR kern/36226.


 To generate a diff of this commit:
 cvs rdiff -r1.7 -r1.8 src/sys/dev/isa/it.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: [netbsd-4] src/sys/dev/isa
Date: Sat, 12 May 2007 17:28:39 +0000 (UTC)

 Module Name:	src
 Committed By:	snj
 Date:		Sat May 12 17:28:38 UTC 2007

 Modified Files:
 	src/sys/dev/isa [netbsd-4]: ug.c ugvar.h

 Log Message:
 Pull up following revision(s) (requested by xtraeme in ticket #620):
 	sys/dev/isa/ug.c: revision 1.4
 	sys/dev/isa/ugvar.h: revision 1.4
 Don't refresh all sensors in the gtredata function, just the sensor
 that was requested. This is related to PR kern/36226.
 Patch from Mihai Chelaru in private email.


 To generate a diff of this commit:
 cvs rdiff -r1.1.4.2 -r1.1.4.3 src/sys/dev/isa/ug.c src/sys/dev/isa/ugvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: [netbsd-4] src/sys/dev/isa
Date: Sat, 12 May 2007 17:32:23 +0000 (UTC)

 Module Name:	src
 Committed By:	snj
 Date:		Sat May 12 17:32:23 UTC 2007

 Modified Files:
 	src/sys/dev/isa [netbsd-4]: it.c

 Log Message:
 Pull up following revision(s) (requested by xtraeme in ticket #622):
 	sys/dev/isa/it.c: revision 1.8
 Don't refresh all sensors in the gtredata function, just the sensor
 that was requested. This is related to PR kern/36226.


 To generate a diff of this commit:
 cvs rdiff -r1.6.2.1 -r1.6.2.2 src/sys/dev/isa/it.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src/sys
Date: Sun,  1 Jul 2007 07:37:02 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Sun Jul  1 07:37:01 UTC 2007

 Modified Files:
 	src/sys/dev/sysmon: files.sysmon sysmon_envsys.c sysmon_power.c
 	    sysmonvar.h
 	src/sys/kern: init_main.c
 	src/sys/sys: envsys.h power.h
 Added Files:
 	src/sys/dev/sysmon: sysmon_envsys_events.c sysmon_envsysvar.h

 Log Message:
 Imported envsys 2, a brief description of the new features:
 (Part 1: API)

 * Support for detachable sensors.
 * Cleaned up the API for simplicity and efficiency.
 * Ability to send capacity/critical/warning events to powerd(8).
 * Adapted all the code to the new locking order.
 * Compatibility with the old envsys API: the ENVSYS_GTREINFO
   and ENVSYS_GTREDATA ioctl(2)s are supported.
 * Added support for a 'dictionary based communication channel' between
   sysmon_power(9) and powerd(8), that means there is no 32 bytes event
   size restriction anymore.
 * Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
 * All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

 Tested by:

 blymn: smsc(4).
 bouyer: ipmi(4), mfi(4).
 kefren: ug(4).
 njoly: viaenv(4), adt7463.c.
 riz: owtemp(4).
 xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).


 To generate a diff of this commit:
 cvs rdiff -r1.5 -r1.6 src/sys/dev/sysmon/files.sysmon
 cvs rdiff -r1.17 -r1.18 src/sys/dev/sysmon/sysmon_envsys.c \
     src/sys/dev/sysmon/sysmon_power.c
 cvs rdiff -r0 -r1.1 src/sys/dev/sysmon/sysmon_envsys_events.c \
     src/sys/dev/sysmon/sysmon_envsysvar.h
 cvs rdiff -r1.14 -r1.15 src/sys/dev/sysmon/sysmonvar.h
 cvs rdiff -r1.304 -r1.305 src/sys/kern/init_main.c
 cvs rdiff -r1.11 -r1.12 src/sys/sys/envsys.h
 cvs rdiff -r1.4 -r1.5 src/sys/sys/power.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src/sys
Date: Sun,  1 Jul 2007 07:37:21 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Sun Jul  1 07:37:21 UTC 2007

 Modified Files:
 	src/sys/arch/powerpc/oea: cpu_subr.c
 	src/sys/arch/sparc/dev: tctrl.c
 	src/sys/arch/sparc64/dev: envctrl.c
 	src/sys/arch/x86/include: ipmivar.h
 	src/sys/arch/x86/x86: ipmi.c
 	src/sys/dev/acpi: acpi_acad.c acpi_bat.c acpi_tz.c aiboost.c
 	src/sys/dev/i2c: adm1030.c adt7463.c adt7463reg.h adt7467.c lm75.c
 	    pic16lc.c
 	src/sys/dev/ic: mfi.c mfivar.h
 	src/sys/dev/isa: it.c itvar.h nsclpcsio_isa.c smsc.c ug_isa.c
 	src/sys/dev/onewire: owtemp.c
 	src/sys/dev/pci: viaenv.c
 	src/sys/dev/spi: tmp121.c

 Log Message:
 Imported envsys 2, a brief description of the new features:
 (Part 2: drivers)

 * Support for detachable sensors.
 * Cleaned up the API for simplicity and efficiency.
 * Ability to send capacity/critical/warning events to powerd(8).
 * Adapted all the code to the new locking order.
 * Compatibility with the old envsys API: the ENVSYS_GTREINFO
   and ENVSYS_GTREDATA ioctl(2)s are supported.
 * Added support for a 'dictionary based communication channel' between
   sysmon_power(9) and powerd(8), that means there is no 32 bytes event
   size restriction anymore.
 * Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
 * All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

 Tested by:

 blymn: smsc(4).
 bouyer: ipmi(4), mfi(4).
 kefren: ug(4).
 njoly: viaenv(4), adt7463.c.
 riz: owtemp(4).
 xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).


 To generate a diff of this commit:
 cvs rdiff -r1.31 -r1.32 src/sys/arch/powerpc/oea/cpu_subr.c
 cvs rdiff -r1.38 -r1.39 src/sys/arch/sparc/dev/tctrl.c
 cvs rdiff -r1.3 -r1.4 src/sys/arch/sparc64/dev/envctrl.c
 cvs rdiff -r1.2 -r1.3 src/sys/arch/x86/include/ipmivar.h
 cvs rdiff -r1.5 -r1.6 src/sys/arch/x86/x86/ipmi.c
 cvs rdiff -r1.22 -r1.23 src/sys/dev/acpi/acpi_acad.c
 cvs rdiff -r1.45 -r1.46 src/sys/dev/acpi/acpi_bat.c
 cvs rdiff -r1.21 -r1.22 src/sys/dev/acpi/acpi_tz.c
 cvs rdiff -r1.5 -r1.6 src/sys/dev/acpi/aiboost.c
 cvs rdiff -r1.7 -r1.8 src/sys/dev/i2c/adm1030.c
 cvs rdiff -r1.8 -r1.9 src/sys/dev/i2c/adt7463.c
 cvs rdiff -r1.5 -r1.6 src/sys/dev/i2c/adt7463reg.h
 cvs rdiff -r1.6 -r1.7 src/sys/dev/i2c/adt7467.c src/sys/dev/i2c/pic16lc.c
 cvs rdiff -r1.11 -r1.12 src/sys/dev/i2c/lm75.c
 cvs rdiff -r1.5 -r1.6 src/sys/dev/ic/mfi.c
 cvs rdiff -r1.4 -r1.5 src/sys/dev/ic/mfivar.h
 cvs rdiff -r1.8 -r1.9 src/sys/dev/isa/it.c
 cvs rdiff -r1.3 -r1.4 src/sys/dev/isa/itvar.h
 cvs rdiff -r1.16 -r1.17 src/sys/dev/isa/nsclpcsio_isa.c
 cvs rdiff -r1.1 -r1.2 src/sys/dev/isa/smsc.c src/sys/dev/isa/ug_isa.c
 cvs rdiff -r1.6 -r1.7 src/sys/dev/onewire/owtemp.c
 cvs rdiff -r1.20 -r1.21 src/sys/dev/pci/viaenv.c
 cvs rdiff -r1.1 -r1.2 src/sys/dev/spi/tmp121.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src/usr.sbin
Date: Sun,  1 Jul 2007 07:39:48 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Sun Jul  1 07:39:47 UTC 2007

 Modified Files:
 	src/usr.sbin/envstat: Makefile envstat.8 envstat.c
 	src/usr.sbin/powerd: Makefile powerd.8 powerd.c

 Log Message:
 Imported envsys 2, a brief description of the new features:
 (Part 3: userland)

 * Support for detachable sensors.
 * Cleaned up the API for simplicity and efficiency.
 * Ability to send capacity/critical/warning events to powerd(8).
 * Adapted all the code to the new locking order.
 * Compatibility with the old envsys API: the ENVSYS_GTREINFO
   and ENVSYS_GTREDATA ioctl(2)s are supported.
 * Added support for a 'dictionary based communication channel' between
   sysmon_power(9) and powerd(8), that means there is no 32 bytes event
   size restriction anymore.
 * Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
 * All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

 Tested by:

 blymn: smsc(4).
 bouyer: ipmi(4), mfi(4).
 kefren: ug(4).
 njoly: viaenv(4), adt7463.c.
 riz: owtemp(4).
 xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).


 To generate a diff of this commit:
 cvs rdiff -r1.1 -r1.2 src/usr.sbin/envstat/Makefile
 cvs rdiff -r1.15 -r1.16 src/usr.sbin/envstat/envstat.8
 cvs rdiff -r1.24 -r1.25 src/usr.sbin/envstat/envstat.c
 cvs rdiff -r1.3 -r1.4 src/usr.sbin/powerd/Makefile
 cvs rdiff -r1.9 -r1.10 src/usr.sbin/powerd/powerd.8
 cvs rdiff -r1.7 -r1.8 src/usr.sbin/powerd/powerd.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src
Date: Sun,  1 Jul 2007 07:55:54 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Sun Jul  1 07:55:54 UTC 2007

 Modified Files:
 	src/distrib/sets/lists/comp: mi
 	src/distrib/sets/lists/etc: mi
 	src/etc/defaults: rc.conf
 	src/etc/mtree: special
 	src/etc/powerd/scripts: Makefile
 	src/share/man/man4: envsys.4
 	src/share/man/man9: Makefile
 Added Files:
 	src/etc: envsys.conf
 	src/etc/powerd/scripts: sensor_battery sensor_drive sensor_fan
 	    sensor_power sensor_resistance sensor_temperature sensor_voltage
 	src/share/man/man9: sysmon_envsys.9

 Log Message:
 Imported envsys 2, a brief description of the new features:
 (Part 4: documentation and configuration files)

 * Support for detachable sensors.
 * Cleaned up the API for simplicity and efficiency.
 * Ability to send capacity/critical/warning events to powerd(8).
 * Adapted all the code to the new locking order.
 * Compatibility with the old envsys API: the ENVSYS_GTREINFO
   and ENVSYS_GTREDATA ioctl(2)s are supported.
 * Added support for a 'dictionary based communication channel' between
   sysmon_power(9) and powerd(8), that means there is no 32 bytes event
   size restriction anymore.
 * Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
 * All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

 Tested by:

 blymn: smsc(4).
 bouyer: ipmi(4), mfi(4).
 kefren: ug(4).
 njoly: viaenv(4), adt7463.c.
 riz: owtemp(4).
 xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).


 To generate a diff of this commit:
 cvs rdiff -r1.1037 -r1.1038 src/distrib/sets/lists/comp/mi
 cvs rdiff -r1.190 -r1.191 src/distrib/sets/lists/etc/mi
 cvs rdiff -r0 -r1.1 src/etc/envsys.conf
 cvs rdiff -r1.86 -r1.87 src/etc/defaults/rc.conf
 cvs rdiff -r1.111 -r1.112 src/etc/mtree/special
 cvs rdiff -r1.5 -r1.6 src/etc/powerd/scripts/Makefile
 cvs rdiff -r0 -r1.1 src/etc/powerd/scripts/sensor_battery \
     src/etc/powerd/scripts/sensor_drive src/etc/powerd/scripts/sensor_fan \
     src/etc/powerd/scripts/sensor_power \
     src/etc/powerd/scripts/sensor_resistance \
     src/etc/powerd/scripts/sensor_temperature \
     src/etc/powerd/scripts/sensor_voltage
 cvs rdiff -r1.27 -r1.28 src/share/man/man4/envsys.4
 cvs rdiff -r1.236 -r1.237 src/share/man/man9/Makefile
 cvs rdiff -r0 -r1.1 src/share/man/man9/sysmon_envsys.9

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: xtraeme@netbsd.org
State-Changed-When: Sun, 01 Jul 2007 08:12:43 +0000
State-Changed-Why:
envsys2 has been merged, fixed.


From: Juan Romero Pardines <xtraeme@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36226 CVS commit: src/sys/dev/ic
Date: Sun,  1 Jul 2007 08:29:48 +0000 (UTC)

 Module Name:	src
 Committed By:	xtraeme
 Date:		Sun Jul  1 08:29:48 UTC 2007

 Modified Files:
 	src/sys/dev/ic: nslm7x.c nslm7xvar.h ug.c ugvar.h

 Log Message:
 Imported envsys 2, a brief description of the new features:
 (Part 2: drivers)

 * Support for detachable sensors.
 * Cleaned up the API for simplicity and efficiency.
 * Ability to send capacity/critical/warning events to powerd(8).
 * Adapted all the code to the new locking order.
 * Compatibility with the old envsys API: the ENVSYS_GTREINFO
   and ENVSYS_GTREDATA ioctl(2)s are supported.
 * Added support for a 'dictionary based communication channel' between
   sysmon_power(9) and powerd(8), that means there is no 32 bytes event
   size restriction anymore.
 * Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
 * All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

 Tested by:

 blymn: smsc(4).
 bouyer: ipmi(4), mfi(4).
 kefren: ug(4).
 njoly: viaenv(4), adt7463.c.
 riz: owtemp(4).
 xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).


 To generate a diff of this commit:
 cvs rdiff -r1.36 -r1.37 src/sys/dev/ic/nslm7x.c
 cvs rdiff -r1.19 -r1.20 src/sys/dev/ic/nslm7xvar.h
 cvs rdiff -r1.2 -r1.3 src/sys/dev/ic/ug.c
 cvs rdiff -r1.1 -r1.2 src/sys/dev/ic/ugvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.