As part of 
  4761239 Customer requests a method to clear IOSTAT statistics
a kstat_delete_persistent(9F) interface was proposed.

I wrote up a fasttrack for this, and had discussed this with the
sd target driver group.  This got pushed down on the stack, and has 
not poped back up yet.  There may already be a prototype from
the sd target driver folks,  I would need to check.

Any comments on this approach?

-Chris Horne

#pragma ident   "@(#)kstat_delete_persistent.fasttrack  1.1     06/10/09 SMI"

Deletion of a KSTAT_FLAG_PERSISTENT kstat

   Chris Horne

When a kstat is created by using kstat_create(9F) with the
KSTAT_FLAG_PERSISTENT flag, a kstat_delete(9F) call does not completely
destroy the kstat and utilities, like iostat(1M), will still find and
display the statistic.  This fasttrack defines, and requests patch
binding, for a new kstat_destroy_persistent(9F) interface that can be
used to completely destroy a kstat created with KSTAT_FLAG_PERSISTENT:

Some use cases for this interface are

  o When the association of a disk partition to a region of storage
    undergoes a fundamental change, the driver needs a way to
    completely delete kstats associated with the old partition.
    Examples of such a change are a change in the base block associated
    of a partition, or conversion of a disk from SUN label to/from an
    EFI label.  http://monaco.sfbay.sun.com/detail.jsp?cr=6476952

  o We have requests to support 'reset' of kstat data.  In general the
    the kstat implementation does not knows enough to perform the reset
    operation itself:  not all initial values are guaranteed to be zero
    - esp for strings.  A simple implementation of reset would be for a
    target driver to completely delete its kstats, and then use common
    code recreate them.
    http://monaco.sfbay.sun.com/detail.jsp?cr=4761239

----------------------------------------------------------------------------
Interface                 Level                 Comments
----------------------------------------------------------------------------

kstat_delete_persistent() Evolving              delete a
KSTAT_FLAG_PERSISTENT
kstat 


Kstat References

   [0]  The kstat stability "best practice"
        http://sac.sfbay.sun.com/cgi-bin/bp.cgi?NAME=kstat.bp

   [1]  PSARC 1992/085 /dev/statistics
http://sac.sfbay/PSARC/1992/085

   [2]  PSARC 1996/273 64-bit neutral kstat
http://sac.sfbay/PSARC/1996/273

   [3]  PSARC 1997/285 64-bit kstat revisited
http://sac.sfbay/PSARC/1997/285

   [4]  PSARC 1999/495 kstat(1M)
http://sac.sfbay/PSARC/1999/495

   [5]  PSARC 2000/053 ECC and Memory Configuration kstats
        http://sac.sfbay/PSARC/2000/053

   [6]  PSARC 2000/468 Optionally disable per-partition kstats
        http://sac.sfbay/PSARC/2000/468/

   [7]  PSARC/2001/239 KSTAT_DATA_STRING
        http://sac.sfbay/PSARC/2001/239/



Proposed kstat_delete() man page changes:

  Kernel Functions for Drivers                     kstat_delete(9F)
  
  
  
  NAME
|      kstat_delete, kstat_delete_persistent -
       remove a kstat from the system
  
  SYNOPSIS
       #include <sys/types.h>
       #include <sys/kstat.h>
  
       void kstat_delete(kstat_t *ksp);
|      void kstat_delete_persistent(kstat_t *ksp);
  
  INTERFACE LEVEL
       Solaris DDI specific (Solaris DDI)
  
  PARAMETERS
       ksp      Pointer to a currently installed  kstat(9S)  struc-
                ture.
  
  DESCRIPTION

|      A kstat is either persistent or non-persistent depending on
|      whether kstat_create(9F) used the KSTAT_FLAG_PERSISTENT.
|
|      For non-persistent kstats, kstat_delete() removes ksp from the
|      kstat  chain  and  frees all associated system resources.
|
|      For persistent kstats,  kstat_delete(9F) simply marks the kstat
|      as  dormant;  a  subsequent kstat_create()  reactivates the
|      kstat.  To fully delete a persistent kstat, use
|      kstat_delete_persistent.

  
  RETURN VALUES
       None.
  
  CONTEXT
|      kstat_delete() and kstat_delete_persistent() can be called from any
|      context.

  SEE ALSO kstat_create(9F),  kstat_install(9F),  kstat_named_init(9F),
       kstat(9S)

       Writing Device Drivers

| NOTES When calling kstat_delete() or kstat_delete_persistent(),
       the driver must not be  holding
       that  kstat's  ks_lock.  Otherwise,  it  may deadlock with a
       kstat reader.
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to