pcp
[Top] [All Lists]

pcp updates for PCP 4.0

To: pcp@xxxxxxxxxxx
Subject: pcp updates for PCP 4.0
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Sun, 17 Jul 2011 16:04:30 +1000
Another milestone - context management and use of pointers to
__pmContext is now thread-safe and PDU buffer management is now
thread-safe.

Remaining "biggie" work item is mutex on IPC channel to pmcd below the
(already) locked context during synchronous PDU exchanges.

Changes committed to git://oss.sgi.com/kenj/pcp.git pcp4
(note this is the pcp4 branch)

 src/dbpmda/src/gram.y           |    2 
 src/dbpmda/src/pmda.c           |   88 +++++++++++++----
 src/dbpmda/src/util.c           |   18 +++
 src/include/impl.h              |   13 ++
 src/libpcp/src/GNUmakefile      |    4 
 src/libpcp/src/auxconnect.c     |    2 
 src/libpcp/src/connect.c        |   18 ++-
 src/libpcp/src/context.c        |  197 +++++++++++++++++++++++++++++++---------
 src/libpcp/src/derive.c         |   10 +-
 src/libpcp/src/desc.c           |   54 ++++------
 src/libpcp/src/err.c            |   13 ++
 src/libpcp/src/fetch.c          |   54 ++++++----
 src/libpcp/src/fetchlocal.c     |   12 +-
 src/libpcp/src/help.c           |   23 ++--
 src/libpcp/src/instance.c       |   56 +++++++----
 src/libpcp/src/internal.h       |    2 
 src/libpcp/src/interp.c         |    5 -
 src/libpcp/src/lock.c           |    6 +
 src/libpcp/src/logconnect.c     |    6 +
 src/libpcp/src/logcontrol.c     |    5 -
 src/libpcp/src/logmeta.c        |   33 +++++-
 src/libpcp/src/logutil.c        |   17 ++-
 src/libpcp/src/p_creds.c        |    6 +
 src/libpcp/src/p_desc.c         |   11 +-
 src/libpcp/src/p_error.c        |   10 +-
 src/libpcp/src/p_fetch.c        |    6 +
 src/libpcp/src/p_instance.c     |   10 +-
 src/libpcp/src/p_lcontrol.c     |    5 -
 src/libpcp/src/p_lrequest.c     |    6 +
 src/libpcp/src/p_lstatus.c      |    6 +
 src/libpcp/src/p_pmns.c         |   27 +++--
 src/libpcp/src/p_profile.c      |    5 -
 src/libpcp/src/p_result.c       |   64 +++++++++---
 src/libpcp/src/p_text.c         |   10 +-
 src/libpcp/src/pdu.c            |   29 +++++
 src/libpcp/src/pdubuf.c         |   10 ++
 src/libpcp/src/pmns.c           |   85 ++++++++++++-----
 src/libpcp/src/profile.c        |    4 
 src/libpcp/src/store.c          |   27 +++--
 src/libpcp/src/tz.c             |    7 +
 src/libpcp/src/util.c           |   35 ++++---
 src/libpcp_import/src/archive.c |   13 ++
 src/libpcp_pmda/src/mainloop.c  |    7 +
 src/libpcp_pmda/src/open.c      |    7 +
 src/pmcd/src/config.c           |    4 
 src/pmcd/src/dofetch.c          |    7 +
 src/pmcd/src/dopdus.c           |   35 +++++--
 src/pmcd/src/dostore.c          |    6 +
 src/pmcd/src/pmcd.c             |   12 +-
 src/pmdas/summary/mainloop.c    |   16 +--
 src/pmdumplog/pmdumplog.c       |    8 +
 src/pmlc/actions.c              |   21 +++-
 src/pmlogextract/logio.c        |    2 
 src/pmlogextract/pmlogextract.c |   16 +--
 src/pmlogger/callback.c         |    2 
 src/pmlogger/dopdu.c            |    5 -
 src/pmlogger/fetch.c            |   23 +++-
 src/pmlogger/pmlogger.c         |    7 +
 src/pmlogger/preamble.c         |    4 
 src/pmlogreduce/logio.c         |    2 
 src/pmlogreduce/pmlogreduce.c   |    4 
 src/pmproxy/pmproxy.c           |    2 
 62 files changed, 875 insertions(+), 329 deletions(-)

commit d20cdfd94857b0f7801b774594e41f7c3965336d
Author: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date:   Sun Jul 17 15:56:30 2011 +1000

    thread-safe libpcp - PDU buffer pinning changes
    
    The PDU buffer pinning protocol has to be changed from the optimisitic
    and lazy pinning that worked fine for single-threaded use to a more
    rigorous protocol that pins a PDU buffer as soon as it is allocated
    and the caller is required to unpin the buffer when it is safe to do
    so.

commit a0886dccd074b65c6cda6c0240a253e12acd372d
Author: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date:   Sat Jul 16 07:36:01 2011 +1000

    Thread-safe libpcp
    
    A mixed bag of changes here ...
    
    - Buffer pinning changes ... the old regime of optimistic delayed buffer
      pinning does not work in a multi-threaded environment, we've changed to
      pinning PDU buffers when they are allocated and moving the responsibility
      for unpinning "up stream" when the buffer is no longer required.
      Initial change was to __pmFindPDUBuf() and its callers, but this
      quickly spread to __pmGetPDU() and its callers.  More work is needed
      in __pmEncodeResult() and __pmDecodeResult() to prevent memory leaks.
    
    - Initial work to lock the IPC channel to pmcd to ensure the PDU exchange
      remains synchronous, even when more than one context is sharing the same
      IPC channel ... initial change just for DESC_REQ and DESC PDUs as a
      proof of concept.
    
    - Add re-entrant safe __pmEventTrace_r() to be used in place of
      __pmEventTrace() in multi-threaded applications
    
    - A number of small cosmetic changes to improve source readability
      and consistency.

commit d4d7a500ab5e88c5afb72e19b0f98ad50fac0265
Author: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date:   Wed Jul 13 10:41:39 2011 +1000

    Make libpcp context use thread-safe
    
    Changes here include
    - "current" context is a private-thread data item
    - context control structures protected by global locking and the
      data structure changed so that a __pmContext is never moved by
      realloc(), so pointers to a _pmContext remain valid in the presence
      of contexts being created and destroyed
    - context-locking implemented by __pmHandleToPtr() locking the context
      before returning, and the caller is responsible for unlocking the
      context when done with a PM_UNLOCK(ctxp->c_lock) or similar
    - clean up the PM_LOCK() and PM_UNLOCK() macros to make them safer
      in terms of namespace collisions
    - rework the optional run-time initialization of the global lock



<Prev in Thread] Current Thread [Next in Thread>
  • pcp updates for PCP 4.0, Ken McDonell <=