coretemp(4)/amdtemp(4) and sysctl nodes
John Baldwin
jhb at freebsd.org
Mon Dec 6 16:18:53 UTC 2010
On Friday, December 03, 2010 1:05:02 pm mdf at freebsd.org wrote:
> 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.
Well, you would want 'kldunload coretemp.ko' to remove the sysctl node even
though the parent device is still around. I suspect the same case is true
for amdtemp. Probably these drivers should use a separate sysctl context.
I'm not sure how the sysctl code handles removing a node that has an active
context though.
--
John Baldwin
More information about the freebsd-hackers
mailing list