Discussion:
[pcp] pcp updates: PMNS locking changes in libpcp
Ken McDonell
2017-07-18 22:24:58 UTC
Permalink
With the last commit I think I've fixed the problem I reported
to pcp-masters ... so this is good to merge, subject to review.

Cheers, Ken.

Changes committed to https://github.com/kmcdonell/pcp master

Ken McDonell (12):
src/include/pcp/impl.h: add PM_IS_LOCKED() and always include __pmIsLocked() in libpcp
src/libpcp/doc: update mk.cgraph and document planned PMNS locking and other recent changes
src/pmlogcheck/pass3.c: cosmetic change
src/pmlogger/src/fetch.c: remove extra c_lock unlocks in myFetch
src/pmlogextract/pmlogextract.c: need to hold c_lock a bit longer for log I/O
libpcp: refactor PMNS locking
qa/check: defer removal of .bad file until the associated test is run to completion
qa/451 and 998: change filter to accommodate different libpcp behaviour
qa/src/multithread4.c: add support for -D... command line args
qa/group: update some group membership and some comment editing
libpcp: change pmns_lock from default to ERRORCHECK pthread_mutex
src/libpcp/pmns.c: fix lock inversion

qa/451 | 24 +
qa/998 | 31 +
qa/check | 3
qa/group | 5
qa/src/multithread4.c | 27 +
src/include/pcp/impl.h | 3
src/libpcp/doc/libpcp-locking.odt |binary
src/libpcp/doc/mk.cgraph | 14
src/libpcp/src/check-statics | 41 -
src/libpcp/src/context.c | 40 -
src/libpcp/src/internal.h | 10
src/libpcp/src/lock.c | 294 ++++++++-----
src/libpcp/src/pmns.c | 823 ++++++++++++++++++++++++++------------
src/pmlogcheck/pass3.c | 4
src/pmlogextract/pmlogextract.c | 10
src/pmlogger/src/fetch.c | 4
16 files changed, 871 insertions(+), 462 deletions(-)

Details ...

commit fa2519113269d2837239ba48aa7bbdfac7a2d1e5
Author: Ken McDonell <***@internode.on.net>
Date: Wed Jul 19 07:12:13 2017 +1000

src/libpcp/pmns.c: fix lock inversion

The recent pmns_lock changes introduced a lock inversion with the
registered mutex ... fix that, because at the time we are exploring
derived metrics we don't need the pmns_lock any more.

This was causing pmmgr to lock up early in its life.

commit 330446ab54bf9bcd33d2883a3331cf9da06a3883
Author: Ken McDonell <***@internode.on.net>
Date: Tue Jul 18 20:24:29 2017 +1000

libpcp: change pmns_lock from default to ERRORCHECK pthread_mutex

commit d94cd45a3724374b30c24d1f99809fc70c9c3bba
Author: Ken McDonell <***@internode.on.net>
Date: Sun Jul 16 07:23:48 2017 +1000

qa/group: update some group membership and some comment editing

commit 7cd417da3c74bab4321968e387d89d66275448ef
Author: Ken McDonell <***@internode.on.net>
Date: Sun Jul 16 07:22:54 2017 +1000

qa/src/multithread4.c: add support for -D... command line args

commit e939ee0f61f3cb71f281e2d79022e490819ff1df
Author: Ken McDonell <***@internode.on.net>
Date: Sun Jul 16 07:19:39 2017 +1000

qa/451 and 998: change filter to accommodate different libpcp behaviour

If libpcp is compiled with -DBUILD_WITH_LOCK_ASSERTS (not the default,
but I use it a lot in testing), then failures in __pmLock() and
__pmUnlock() trip an assert rather than returning an error.

Work around this for some corner cases in these tests.

commit 0f65209dc4ef003fa40d19ab188a78329c92e5a9
Author: Ken McDonell <***@internode.on.net>
Date: Sat Jul 15 20:10:41 2017 +1000

qa/check: defer removal of .bad file until the associated test is run to completion

commit 716802c8983a998b9c840025bd500d1e3563f8f0
Author: Ken McDonell <***@internode.on.net>
Date: Sat Jul 15 20:06:58 2017 +1000

libpcp: refactor PMNS locking

Avoid the big libpcp lock altogether, but a number of messy issues,
especially associated with libpcp re-entrancy from the pmTraversePMNS()
and pmTraverse_r() interfaces caused some major refactoring.

The new pmns_lock can only be acquired after any context lock is
acquired (there is none for apps using pmLoadNameSpace() outside a
current context), and once the pmns_lock is acquired, no subsequent
context locking is allowed until the pmns_lock is released.

commit 3250dfda7b242501b49bf1cb79826a20d4569f0c
Author: Ken McDonell <***@internode.on.net>
Date: Sat Jul 15 20:06:00 2017 +1000

src/pmlogextract/pmlogextract.c: need to hold c_lock a bit longer for log I/O

commit 2b18d96fd118f49e6b3c77fb6901977c69a53444
Author: Ken McDonell <***@internode.on.net>
Date: Sat Jul 15 20:04:44 2017 +1000

src/pmlogger/src/fetch.c: remove extra c_lock unlocks in myFetch

commit 9e33f06f04885d0c630c38a1fc44d1e6477f6934
Author: Ken McDonell <***@internode.on.net>
Date: Wed Jul 12 09:35:41 2017 +1000

src/pmlogcheck/pass3.c: cosmetic change

Picked up from Dave's review ... the code makes more sense if we
use the same __pmContext * for the PM_LOCK(), the call to
__pmLogRead_ctx() and the PM_UNLOCK(). The change is cosmetic
because ctxp and l_ctxp are identical at this point in the code.

commit a17681837783d3be5a77e9bc9c767bb44fef5911
Author: Ken McDonell <***@internode.on.net>
Date: Tue Jul 11 06:51:49 2017 +1000

src/libpcp/doc: update mk.cgraph and document planned PMNS locking and other recent changes

commit 49cf16fddc831c992a38400d1ce0e21ef972a908
Author: Ken McDonell <***@internode.on.net>
Date: Tue Jul 11 06:48:24 2017 +1000

src/include/pcp/impl.h: add PM_IS_LOCKED() and always include __pmIsLocked() in libpcp


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#16234): https://groups.io/g/pcp/message/16234
View All Messages In Topic (1): https://groups.io/g/pcp/topic/5583681
Mute This Topic: https://groups.io/mt/5583681/174549
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
***@groups.io
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub/174549
Group Home: https://groups.io/g/pcp
Contact Group Owner: pcp+***@groups.io
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354206/1187008340/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-

Loading...