From 2af392a099ed49b8a8d776f516137d5838c97eb9 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 12 Jan 2011 15:41:33 -0700 Subject: [PATCH 1/9] fix for bug 701673 at launchpad (wrong native element count for large arrays) --- src/rsrv/caserverio.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index 119ad5e3a..466e492f0 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -33,10 +33,6 @@ #define epicsExportSharedSymbols #include "server.h" -/* As an optimisation, any message allocated with a large header is resized to - * use a small header if the payload size is below this threshold. */ -#define SMALL_MESSAGE_THRESHOLD 65 - /* * cas_send_bs_msg() * @@ -357,19 +353,8 @@ void cas_commit_msg ( struct client *pClient, ca_uint32_t size ) if ( pMsg->m_postsize == htons ( 0xffff ) ) { ca_uint32_t * pLW = ( ca_uint32_t * ) ( pMsg + 1 ); assert ( size <= ntohl ( *pLW ) ); - if (size < SMALL_MESSAGE_THRESHOLD) { - /* If the message is sufficiently small it can be worth converting a - * large message header into a small header. This saves us all of 8 - * bytes over the wire, so it's not such a big deal. */ - pMsg->m_postsize = htons((ca_uint16_t) size); - pMsg->m_count = htons((ca_uint16_t) ntohl(pLW[1])); - memmove(pLW, pLW + 2, size); - size += sizeof(caHdr); - } - else { - pLW[0] = htonl ( size ); - size += sizeof ( caHdr ) + 2 * sizeof ( *pLW ); - } + pLW[0] = htonl ( size ); + size += sizeof ( caHdr ) + 2 * sizeof ( *pLW ); } else { assert ( size <= ntohs ( pMsg->m_postsize ) ); From a2c87268f54028121bd895ed38df0be5063a3781 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 14 Jan 2011 17:53:33 -0700 Subject: [PATCH 2/9] in disconnectAllChannels mark channels as unassigned to any list because in some unusual situations (abrupt shutdown) the channels are not immediately assigned to another list --- src/ca/tcpiiu.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index a38ee7ff3..9cf9f6f4d 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -1866,10 +1866,14 @@ void tcpiiu::unlinkAllChannels ( guard.assertIdenticalMutex ( this->mutex ); while ( nciu * pChan = this->createReqPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->createRespPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; // we dont yet know the server's id so we cant // send a channel delete request and will instead // trust that the server can do the proper cleanup @@ -1878,12 +1882,16 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->v42ConnCallbackPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); pChan->serviceShutdownNotify ( cbGuard, guard ); } while ( nciu * pChan = this->subscripReqPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); @@ -1891,6 +1899,8 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->connectedList.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); @@ -1898,6 +1908,8 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->unrespCircuit.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); // if we know that the circuit is unresponsive // then we dont send a channel delete request and @@ -1907,6 +1919,8 @@ void tcpiiu::unlinkAllChannels ( } while ( nciu * pChan = this->subscripUpdateReqPend.get () ) { + pChan->channelNode::listMember = + channelNode::cs_none; pChan->disconnectAllIO ( cbGuard, guard ); this->clearChannelRequest ( guard, pChan->getSID(guard), pChan->getCID(guard) ); From 793639f4da83b8139b4a9a6f64eb013d3c3fac2f Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 14 Jan 2011 17:56:49 -0700 Subject: [PATCH 3/9] fixed last time compare in PLL drift factor update loop --- src/libCom/osi/os/WIN32/osdTime.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index 5efdb2cbc..035c7308c 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -409,8 +409,8 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) EnterCriticalSection ( & this->mutex ); - LONGLONG perfCounterDiff = curPerfCounter.QuadPart - this->lastPerfCounterPLL; - if ( curPerfCounter.QuadPart >= this->lastPerfCounter ) { + LONGLONG perfCounterDiff; + if ( curPerfCounter.QuadPart >= this->lastPerfCounterPLL ) { perfCounterDiff = curPerfCounter.QuadPart - this->lastPerfCounterPLL; } else { From 253036c36ccc8c2b91b0c30b130052784b3ee4ff Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 14 Jan 2011 18:00:02 -0700 Subject: [PATCH 4/9] o committing merge of r3.14 trunk change o fixed spelling and other cosmetic changes --- src/libCom/osi/os/WIN32/osdThread.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index 8c3b54792..ff8b350ec 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -124,7 +124,7 @@ BOOL WINAPI DllMain ( #if _WIN32_WINNT >= 0x0501 /* * Only in WXP - * Thats a shame becaus ethis is probably much faster + * Thats a shame because this is probably much faster */ success = GetModuleHandleEx ( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, @@ -268,7 +268,8 @@ static void threadCleanupWIN32 ( void ) return; } - while ( ( pParm = ( win32ThreadParam * ) ellFirst ( & pGbl->threadList ) ) ) { + while ( ( pParm = ( win32ThreadParam * ) + ellFirst ( & pGbl->threadList ) ) ) { epicsParmCleanupWIN32 ( pParm ); } @@ -446,7 +447,8 @@ epicsShareFunc epicsThreadBooleanStatus epicsShareAPI epicsThreadHighestPriority /* * epicsThreadGetStackSize () */ -epicsShareFunc unsigned int epicsShareAPI epicsThreadGetStackSize ( epicsThreadStackSizeClass stackSizeClass ) +epicsShareFunc unsigned int epicsShareAPI + epicsThreadGetStackSize ( epicsThreadStackSizeClass stackSizeClass ) { static const unsigned stackSizeTable[epicsThreadStackBig+1] = {4000, 6000, 11000}; @@ -955,10 +957,17 @@ static void epicsThreadShowPrivate ( epicsThreadId id, unsigned level ) (void *) pParm, idForFormat, pParm->epicsPriority, epics_GetThreadPriorityAsString ( pParm->handle ), epicsThreadIsSuspended ( id ) ? "suspend" : "ok" ); + if ( level ) { + fprintf (epicsGetStdout(), " %-8p %-8p ", + (void *) pParm->handle, (void *) pParm->parm ); + } } else { fprintf (epicsGetStdout(), "NAME EPICS-ID WIN32-ID EPICS-PRI WIN32-PRI STATE " ); + if ( level ) { + fprintf (epicsGetStdout(), " HANDLE FUNCTION PARAMETER" ); + } } fprintf (epicsGetStdout(),"\n" ); } From 5a118664313c6b892d64d4774069dafd1b58ef66 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 14 Jan 2011 18:01:53 -0700 Subject: [PATCH 5/9] when finished waiting for a thread to exit, signal the event in case other threads are waiting also --- src/libCom/osi/epicsThread.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libCom/osi/epicsThread.cpp b/src/libCom/osi/epicsThread.cpp index 55f9e5872..ed016f47e 100644 --- a/src/libCom/osi/epicsThread.cpp +++ b/src/libCom/osi/epicsThread.cpp @@ -169,6 +169,8 @@ bool epicsThread::exitWait ( const double delay ) throw () "epicsThread::exitWait()\n" ); epicsThreadSleep ( epicsMin ( delay, 5.0 ) ); } + // the event mechanism is used for other purposes + this->event.signal (); return this->terminated; } From fd72cb63bf54c588293887bf80ec719712d5e5bc Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 11 Feb 2011 16:33:58 -0600 Subject: [PATCH 6/9] libCom/WIN32: Merged Jeff's fix for bug 717252 o Fixed race condition where win32 thread parm was not pushed onto the list before the thread was started, and so if the thread exits very quickly it can try to remove a non-existent thread parameter from the list. o This impacts only win32. --- src/libCom/osi/os/WIN32/osdThread.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index ff8b350ec..b7d63a787 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -630,18 +630,21 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (const char *pName, free ( pParmWIN32 ); return NULL; } + + EnterCriticalSection ( & pGbl->mutex ); + ellAdd ( & pGbl->threadList, & pParmWIN32->node ); + LeaveCriticalSection ( & pGbl->mutex ); wstat = ResumeThread ( pParmWIN32->handle ); if (wstat==0xFFFFFFFF) { + EnterCriticalSection ( & pGbl->mutex ); + ellDelete ( & pGbl->threadList, & pParmWIN32->node ); + LeaveCriticalSection ( & pGbl->mutex ); CloseHandle ( pParmWIN32->handle ); free ( pParmWIN32 ); return NULL; } - EnterCriticalSection ( & pGbl->mutex ); - ellAdd ( & pGbl->threadList, & pParmWIN32->node ); - LeaveCriticalSection ( & pGbl->mutex ); - return ( epicsThreadId ) pParmWIN32; } From 3d056f63e4f527c0b14e1c30df8488d0316a4364 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 15 Feb 2011 16:19:26 -0600 Subject: [PATCH 7/9] configure: Added vxWorks-mpc8548 target (MVME4100) Config files from Ernest Williams. --- configure/os/CONFIG.Common.vxWorks-mpc8540 | 9 ++++--- configure/os/CONFIG.Common.vxWorks-mpc8548 | 26 +++++++++++++++++++ .../os/CONFIG.Common.vxWorks-mpc8548-debug | 14 ++++++++++ .../os/CONFIG_SITE.Common.vxWorks-mpc8548 | 6 +++++ 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 configure/os/CONFIG.Common.vxWorks-mpc8548 create mode 100644 configure/os/CONFIG.Common.vxWorks-mpc8548-debug create mode 100644 configure/os/CONFIG_SITE.Common.vxWorks-mpc8548 diff --git a/configure/os/CONFIG.Common.vxWorks-mpc8540 b/configure/os/CONFIG.Common.vxWorks-mpc8540 index 057fd4c67..2b684417b 100644 --- a/configure/os/CONFIG.Common.vxWorks-mpc8540 +++ b/configure/os/CONFIG.Common.vxWorks-mpc8540 @@ -1,9 +1,10 @@ +# CONFIG.Common.vxWorks-mpc8540 +# # $Revision-Id$ +# This file is maintained by the build community. # -# Definitions for vxWorks-mpc8540 targets: MPC8540 CPU with >32MB RAM. -# Site-specific overrides go in CONFIG_SITE.Common.vxWorks-mpc8540 -# -# This file is maintained by the EPICS build community. +# Definitions for vxWorks-mpc8540 target archs +# Sites may override these definitions in CONFIG_SITE.Common.vxWorks-mpc8540 #------------------------------------------------------- # Include definitions common to all vxWorks target archs diff --git a/configure/os/CONFIG.Common.vxWorks-mpc8548 b/configure/os/CONFIG.Common.vxWorks-mpc8548 new file mode 100644 index 000000000..1dd6a1c3b --- /dev/null +++ b/configure/os/CONFIG.Common.vxWorks-mpc8548 @@ -0,0 +1,26 @@ +# CONFIG.Common.vxWorks-mpc8548 +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for vxWorks-mpc8548 target archs +# Sites may override these definitions in CONFIG_SITE.Common.vxWorks-mpc8548 +#------------------------------------------------------- + +# Include definitions common to all vxWorks target archs +include $(CONFIG)/os/CONFIG.Common.vxWorksCommon + +# Vx GNU cross compiler suffix +CMPLR_SUFFIX = ppc + +ARCH_CLASS = ppc + +# Architecture specific build flags +ARCH_DEP_CPPFLAGS = -DCPU=PPC32 +ARCH_DEP_CFLAGS = -DCPU_VARIANT=_ppc85XX_e500v2 +ARCH_DEP_CFLAGS += -mlongcall + +# This flag isn't present in early vxWorks 6.x versions +#ARCH_DEP_CFLAGS += -te500v2 + +GNU_TARGET = powerpc-wrs-vxworks diff --git a/configure/os/CONFIG.Common.vxWorks-mpc8548-debug b/configure/os/CONFIG.Common.vxWorks-mpc8548-debug new file mode 100644 index 000000000..d258a16e8 --- /dev/null +++ b/configure/os/CONFIG.Common.vxWorks-mpc8548-debug @@ -0,0 +1,14 @@ +# CONFIG.Common.vxWorks-mpc8548-debug +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for vxWorks-mpc8548-debug targets. +# Sites may override these definitions in CONFIG_SITE.Common.vxWorks-mpc8548-debug +#------------------------------------------------------- + +# Include definitions common to all vxWorks archs +include $(CONFIG)/os/CONFIG.Common.vxWorks-mpc8548 + +CROSS_OPT = NO + diff --git a/configure/os/CONFIG_SITE.Common.vxWorks-mpc8548 b/configure/os/CONFIG_SITE.Common.vxWorks-mpc8548 new file mode 100644 index 000000000..da8671436 --- /dev/null +++ b/configure/os/CONFIG_SITE.Common.vxWorks-mpc8548 @@ -0,0 +1,6 @@ +# $Revision-Id$ +# +# Site Specific definitions for the vxWorks-mpc8548 target +# +# Only the local epics system manager should modify this file +#------------------------------------------------------- From d73f466dbc02bc436d178650304de93024ddf1a2 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 28 Feb 2011 17:26:24 -0600 Subject: [PATCH 8/9] documentation: KnownProblems template Modified the empty template file to include GNU Patch usage instructions. --- documentation/KnownProblems.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/documentation/KnownProblems.html b/documentation/KnownProblems.html index 9a15e68c8..9a133dc11 100644 --- a/documentation/KnownProblems.html +++ b/documentation/KnownProblems.html @@ -4,11 +4,21 @@ - Known Problems in R3.14.12 + Known Problems in R3.14.13 -

EPICS Base R3.14.12: Known Problems

+

EPICS Base R3.14.13: Known Problems

+ +

Any patch files linked below should be applied at the root of the +base-3.14.12 tree. Download them, then use the GNU Patch program as +follows:

+ +
% cd /path/to/base-3.14.13
+% patch -p0 < /path/to/file.patch
+ +

The following significant problems have been reported with this +version of EPICS Base:

    From f4528ff5e189e6e52054634b0ac396a5685b5c9d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 1 Mar 2011 15:03:33 -0600 Subject: [PATCH 9/9] libCom: Fix msgbufGetNode() in errlog.c Systems that generate large numbers of errlog messages or have a slow message listener could overwrite older messages in the message buffer after the buffer wraps. This also corrects and annotates the test code to describe what's being checked. --- src/libCom/error/errlog.c | 6 ++++-- src/libCom/test/epicsErrlogTest.c | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/libCom/error/errlog.c b/src/libCom/error/errlog.c index 36399a119..322eb9c4f 100644 --- a/src/libCom/error/errlog.c +++ b/src/libCom/error/errlog.c @@ -534,8 +534,10 @@ static msgNode *msgbufGetNode(void) char *plimit = pbuffer + pvtData.buffersize; pnextFree = plast->message + adjustToWorstCaseAlignment(plast->length); - if (pfirst <= plast && - pnextFree + pvtData.msgNeeded > plimit) { + if (pfirst > plast) { + plimit = (char *)pfirst; + } + else if (pnextFree + pvtData.msgNeeded > plimit) { pnextFree = pbuffer; /* Hit end, wrap to start */ plimit = (char *)pfirst; } diff --git a/src/libCom/test/epicsErrlogTest.c b/src/libCom/test/epicsErrlogTest.c index c96013313..08389e438 100644 --- a/src/libCom/test/epicsErrlogTest.c +++ b/src/libCom/test/epicsErrlogTest.c @@ -260,29 +260,31 @@ MAIN(epicsErrlogTest) for (i = 0; i < N; i++) { errlogPrintfNoConsole(msg); } + epicsThreadSleep(0.1); /* should really be a second Event */ testOk1(pvt.count == 0); - epicsThreadSleep(0.1); /* should really be a second Event */ - - pvt.jam = -2; /* Block before #th message */ + /* Extract the first 2 messages, 2*(sizeof(msgNode) + 128) bytes */ + pvt.jam = -2; epicsEventSignal(pvt.jammer); epicsThreadSleep(0.1); - testDiag("Drain %u messages", pvt.count); + testDiag("Drained %u messages", pvt.count); testOk1(pvt.count == 2); - testDiag("Add two more (%d total)", (int) N+2); - errlogPrintfNoConsole(msg); + /* The buffer has space for 1 more message: sizeof(msgNode) + 256 bytes */ + errlogPrintfNoConsole(msg); /* Use up that space */ + + testDiag("Overflow the buffer"); errlogPrintfNoConsole(msg); testOk1(pvt.count == 2); - epicsEventSignal(pvt.jammer); + epicsEventSignal(pvt.jammer); /* Empty */ errlogFlush(); - testDiag("Logged %u messages", pvt.count); - testOk1(pvt.count == N+2); + testDiag("Logged %u messages", pvt.count); + testOk1(pvt.count == N+1); /* Clean up */ errlogRemoveListener(&logClient);