Date: Fri, 3 Dec 2010 10:05:02 -0800 From: mdf@FreeBSD.org To: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: coretemp(4)/amdtemp(4) and sysctl nodes Message-ID: <AANLkTikNJ29AcE1fBXqq_atUU8PQBz9VUos0V%2BwBFQJs@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
There are very few uses in FreeBSD mainline code of sysctl_remove_oid(), and I was looking at potentially removing them. However, the use in coretemp/amdtemp has me slightly stumped. Each device provides a device_get_sysctl_ctx sysctl_ctx that is automatically cleaned up when the device goes away. Yet the sysctl nodes for both amdtemp and coretemp use the context of other devices, rather than their own. I can't quite figure out why, though the two are slightly different enough that they may have different reasons. For coretmp(4) I don't see how the parent device can be removed first, since we are a child device. So from my understanding it makes no sense to have an explicit sysctl_remove_oid() and attach in the parent's sysctl_ctx. For amdtemp, the "temperature" sysctl is added to the nexus.acpi.cpu device, which I suppose it's possible could be removed while the amdtemp sysctl was still present, causing errors. This case could be dealt with by orphaning sysctl nodes at sysctl_ctx_free if there were any not removed, presuming that whoever created them will clean them up (or leak the memory). Thoughts and explanations of the use of the parent's sysctl context? Thanks, matthew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikNJ29AcE1fBXqq_atUU8PQBz9VUos0V%2BwBFQJs>