A number of drivers export kstats with a special flag, KSTAT_FLAG_PERSISTENT.

This flag means that the associated kstats live "forever" in the kernel after creation, they can never be deleted or destroyed.

The upshot of this is that those stats are viewable long after a device has departed the system. Some might consider this a useful property. At one point, it was intended for use in Dynamic Reconfiguration with Alternate Pathing. But it never was used as so intended.

The downside on this, is that when detaching and reattaching a new driver (say with update_drv), the old kstat is _only_ re-used if there are no changes in the size/structure/type of the previously instantiated kstat.

This, for example, means that attaching a new version of a driver which adds another named statistic, will result in the new kstat failing creation (name collision with the old persistent kstat!), and no statistics for said driver will be reported, except for the now stale (and therefore misleading!) persistent kstat.

The only way to clear this condition is to reboot the system.

I'd like to draft a proposal to EOF/eliminate the handling of persistent kstats. IMO, a kstat should be cleaned up once kstat_destroy() is called, unconditionally. (The definition of KSTAT_FLAG_PERSISTENT should be left alone, with admonishments against its use.) This does mean that update_drv and driver detaches will result in loss of historical information.

This ultimately would eliminate one additional source of complexity in the code, as well. (Including a few #ifdef kstat in several drivers.)

I'm interested to hear any counter arguments.

   -- Garrett


_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to