From 422769e85954f4ea8558c45569aa51b917a6a85b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 23 Apr 2016 14:27:32 -0600 Subject: [PATCH 1/2] Update README. Improve some debug output. --- configs/samv71-xult/README.txt | 13 ++++--- graphics/vnc/server/vnc_updater.c | 59 +++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/configs/samv71-xult/README.txt b/configs/samv71-xult/README.txt index 5cec12dc25..bbde3150da 100644 --- a/configs/samv71-xult/README.txt +++ b/configs/samv71-xult/README.txt @@ -2498,9 +2498,13 @@ Configuration sub-directories 2106-04-23: Configuration created. See status up to this data in the vnc configuration. That probably all applies here as well. - Only some initial testing has been performed: The configuration - does not work. The NuttX VNC server is crashing because of this - assertion: + Only some initial testing has been performed: The configuration + is partially functional. Menus do appear and mouse input is + probably working correctly. + + But there are a lot of instabilities. I see assertions of + various kinds and the RealVNC client often crashes as well. + Some of the assertions I see are: while (sem_wait(&session->queuesem) < 0) ... @@ -2510,4 +2514,5 @@ Configuration sub-directories I would think that could mean only that the semaphore counting is out of sync with the number of updates in the queue. - \ No newline at end of file + But also the assertion at devif/devif_iobsend.c line: 102 which + probably means some kind of memory corruption. diff --git a/graphics/vnc/server/vnc_updater.c b/graphics/vnc/server/vnc_updater.c index 0368e46f42..e1db02f040 100644 --- a/graphics/vnc/server/vnc_updater.c +++ b/graphics/vnc/server/vnc_updater.c @@ -64,7 +64,8 @@ * Pre-processor Definitions ****************************************************************************/ -#undef VNCSERVER_SEM_DEBUG +#undef VNCSERVER_SEM_DEBUG /* Define to dump queue/semaphore state */ +#undef VNCSERVER_SEM_DEBUG_SILENT /* Define to dump only suspicious conditions */ /**************************************************************************** * Private Data @@ -112,8 +113,14 @@ static void vnc_sem_debug(FAR struct vnc_session_s *session, FAR const char *msg, unsigned int unattached) { FAR struct vnc_fbupdate_s *update; - unsigned int nqueued; - unsigned int nfree; + int nqueued; + int nfree; + int freesem; + int queuesem; + int freecount; + int queuecount; + int freewaiting; + int queuewaiting; while (sem_wait(&g_dbgsem) < 0) { @@ -122,19 +129,40 @@ static void vnc_sem_debug(FAR struct vnc_session_s *session, /* Count structures in the list */ - for (nqueued = 0, update = (FAR struct vnc_fbupdate_s *)session->updqueue.head; - update != NULL; - nqueued++, update = update->flink); + nqueued = sq_count(&session->updqueue); + nfree = sq_count(&session->updfree); - for (nfree = 0, update = (FAR struct vnc_fbupdate_s *)session->updfree.head; - update != NULL; - nfree++, update = update->flink); + freesem = session->freesem.semcount; + queuesem = session->queuesem.semcount; - syslog(LOG_INFO, "FREESEM DEBUG: %s\n", msg); - syslog(LOG_INFO, " freesem: %d\n", session->freesem.semcount); - syslog(LOG_INFO, " queued: %u\n", nqueued); - syslog(LOG_INFO, " free: %u\n", nfree); - syslog(LOG_INFO, " unattached: %u\n", unattached); + freecount = freesem > 0 ? freesem : 0; + queuecount = queuesem > 0 ? queuesem : 0; + + freewaiting = freesem < 0 ? -freesem : 0; + queuewaiting = queuesem < 0 ? -queuesem : 0; + +#ifdef VNCSERVER_SEM_DEBUG_SILENT + /* This dumps most false alarms in the case where: + * + * - Updater was waiting on a semaphore (count is -1) + * - New update added to the queue (queue count is 1) + * - queuesem posted. Wakes up Updater and the count is 0. + */ + + if ((nqueued + nfree) != (freecount + queuecount)) +#endif + { + syslog(LOG_INFO, "FREESEM DEBUG: %s\n", msg); + syslog(LOG_INFO, " Free list:\n"); + syslog(LOG_INFO, " semcount: %d\n", freecount); + syslog(LOG_INFO, " queued nodes: %u\n", nfree); + syslog(LOG_INFO, " waiting: %u\n", freewaiting); + syslog(LOG_INFO, " Qeued Updates:\n"); + syslog(LOG_INFO, " semcount: %d\n", queuecount); + syslog(LOG_INFO, " queued nodes: %u\n", nqueued); + syslog(LOG_INFO, " waiting: %u\n", queuewaiting); + syslog(LOG_INFO, " Unqueued: %u\n", unattached); + } sem_post(&g_dbgsem); } @@ -262,6 +290,8 @@ vnc_remove_queue(FAR struct vnc_session_s *session) /* It is reserved.. go get it */ rect = (FAR struct vnc_fbupdate_s *)sq_remfirst(&session->updqueue); + + vnc_sem_debug(session, "After remove", 0); DEBUGASSERT(rect != NULL); /* Check if we just removed the whole screen update from the queue */ @@ -272,7 +302,6 @@ vnc_remove_queue(FAR struct vnc_session_s *session) updvdbg("Whole screen update: nwhupd=%d\n", session->nwhupd); } - vnc_sem_debug(session, "After remove", 0); sched_unlock(); return rect; } From 533aa4d97d7b7c265acd041c44e9df58a1193f3f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 24 Apr 2016 15:33:59 -0600 Subject: [PATCH 2/2] Update README and NuttX.html --- Documentation/NuttX.html | 8 ++++++-- README.txt | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 03b8fc720a..9910e4c275 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -680,7 +680,10 @@

-

  • Graphics: framebuffer drivers, graphic- and segment-LCD drivers.
  • +
  • + Graphics: framebuffer drivers, graphic- and segment-LCD drivers. + VNC server. +
  • @@ -831,7 +834,8 @@

  • Networking utilities (DHCP server and client, SMTP client, TELNET client, FTP server and client, TFTP client, HTTP server and client, PPPD, NTP client). - Inheritable TELNET sessions (as "controlling terminal")
  • + Inheritable TELNET sessions (as "controlling terminal"). + VNC server.

    diff --git a/README.txt b/README.txt index 570cf1478d..cbba0da1d0 100644 --- a/README.txt +++ b/README.txt @@ -833,14 +833,29 @@ Re-building a file in one of the linked (i.e., copied) directories, re-build NuttX, and then not see your changes when you run the program. That is because build is still using the version of the file in the copied directory, not - your modified file! To work around this annoying behavior, do the - following when you re-build: + your modified file! + + Older versions of NuttX did not support dependiencies in this + configuration. So a simple work around this annoying behavior in this + case was the following when you re-build: make clean_context all This 'make' command will remove of the copied directories, re-copy them, then make NuttX. + However, more recent versions of NuttX do support dependencies for the + Cygwin build. As a result, the above command will cause everything to be + rebuilt (beause it removes and will cause recreating the + include/nuttx/config.h header file). A much less gracefully but still + effective command in this case is the following for the ARM configuration: + + rm -rf arch/arm/src/chip arch/arm/src/board + + This "kludge" simple removes the copied directories. These directories + will be re-created when you do a normal 'make' and your edits will then be + effective. + Build Targets and Options -------------------------