Browse Source

Merge tag 'bfgminer-3.1.3' into bigpic

BFGMiner version 3.1.3
Luke Dashjr 12 years ago
parent
commit
4118573804
12 changed files with 87 additions and 39 deletions
  1. 1 0
      .gitignore
  2. 1 1
      Makefile.am
  3. 11 0
      NEWS
  4. 22 2
      configure.ac
  5. 9 0
      debian/changelog
  6. 1 1
      debian/control
  7. 3 3
      fpgautils.c
  8. 1 17
      iospeeds.h
  9. 17 0
      iospeeds_posix.h
  10. 14 13
      miner.c
  11. 1 1
      openwrt/bfgminer/Makefile
  12. 6 1
      util.h

+ 1 - 0
.gitignore

@@ -49,6 +49,7 @@ lib/signal.h
 lib/string.h
 lib/stdint.h
 lib/warn-on-use.h
+iospeeds_local.h
 
 mkinstalldirs
 

+ 1 - 1
Makefile.am

@@ -158,7 +158,7 @@ if NEED_FPGAUTILS
 bfgminer_SOURCES += fpgautils.c fpgautils.h
 if HAVE_WINDOWS
 else
-bfgminer_SOURCES += iospeeds.h
+bfgminer_SOURCES += iospeeds.h iospeeds_posix.h
 endif
 endif
 

+ 11 - 0
NEWS

@@ -1,3 +1,14 @@
+BFGMiner Version 3.1.3 - July 11, 2013
+- Bugfix: Reset staged_full flag when discarding (stale) popped work, or
+increasing the queue minimum
+- Bugfix: Only trigger staged work underrun if a mining thread was actually
+waiting for it (and do so sooner, before it has the work made)
+- bytes_cpy: avoid malloc and memcpy when size is zero
+- fix infinite loop in bytes_cpy when size is zero
+- Bugfix: Generate iospeeds_local.h based on termios.h defines, and only try to
+use POSIX standard if that fails
+
+
 BFGMiner Version 3.1.2 - July 8, 2013
 - When not compiling with optimizations, initialize unused nonce2 space to avoid
 warnings from memory checking tools

+ 22 - 2
configure.ac

@@ -14,7 +14,7 @@ dnl * any later version.  See COPYING for more details.
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 m4_define([v_maj], [3])
 m4_define([v_min], [1])
-m4_define([v_mic], [2])
+m4_define([v_mic], [3])
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 m4_define([v_ver], [v_maj.v_min.v_mic])
 m4_define([lt_rev], m4_eval(v_maj + v_min))
@@ -442,6 +442,26 @@ if test "x$scrypt" = xyes; then
 fi
 
 
+need_fpgautils=no
+if test x$avalon$icarus$bitforce$modminer$opencl$x6500$ztex != xnonononononono; then
+	need_fpgautils=yes
+	
+	if $have_win32; then
+		echo '#include <iospeeds.h>' >iospeeds_local.h
+	else
+		AC_PROG_CPP
+		AC_MSG_CHECKING([what baud rates your system supports])
+		echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.* B\([0-9]\+\) .*/IOSPEED(\1)/;t;d' >iospeeds_local.h
+		if grep -q IOSPEED iospeeds_local.h; then
+			AC_MSG_RESULT([done])
+		else
+			AC_MSG_RESULT([failed, using standard POSIX])
+			echo '#include <iospeeds_posix.h>' >iospeeds_local.h
+		fi
+	fi
+fi
+
+
 curses="auto"
 
 AC_ARG_WITH([curses],
@@ -548,7 +568,7 @@ AC_SUBST(libblkmaker_LIBS)
 
 AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
 AM_CONDITIONAL([NEED_DYNCLOCK], [test x$icarus$modminer$x6500$ztex != xnonono])
-AM_CONDITIONAL([NEED_FPGAUTILS], [test x$avalon$icarus$bitforce$modminer$opencl$x6500$ztex != xnonononononono])
+AM_CONDITIONAL([NEED_FPGAUTILS], [test x$need_fpgautils = xyes])
 AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
 AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
 AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])

+ 9 - 0
debian/changelog

@@ -1,3 +1,12 @@
+bfgminer (3.1.3-0precise1) precise; urgency=low
+
+  * Fix 100% CPU usage hang with GBT/getwork pools.
+  * Make staged work underrun detection less overly aggressive.
+  * Generate baud rate list from OS on *nix (fixes Mac/BSD build).
+
+ -- Luke Dashjr <luke+bfgminer@dashjr.org>  Thu, 11 Jul 2013 18:52:25 -0000
+
+
 bfgminer (3.1.2-0precise1) precise; urgency=low
 
   * TUI: The "GPU management" interface has been replaced with a new generic "Manage devices" interface, allowing easy enable and disable of non-GPU devices.

+ 1 - 1
debian/control

@@ -2,7 +2,7 @@ Source: bfgminer
 Priority: optional
 Section: misc
 Maintainer: Luke Dashjr <luke_bfgminer@dashjr.org>
-Standards-Version: 3.1.2
+Standards-Version: 3.1.3
 Build-Depends: build-essential, debhelper, autoconf, automake, libtool, libssl-dev, yasm, pkg-config, libudev-dev, libcurl4-openssl-dev, wget, unzip, libjansson-dev, libncurses5-dev, libudev-dev, libusb-1.0-0-dev, git, quilt, uthash-dev, libsensors4-dev
 
 Package: bfgminer

+ 3 - 3
fpgautils.c

@@ -672,7 +672,7 @@ int tiospeed(speed_t speed)
 		case B ## baud:  \
 			return baud;  \
 // END
-#include "iospeeds.h"
+#include "iospeeds_local.h"
 #undef IOSPEED
 	default:
 		return -1;
@@ -772,7 +772,7 @@ speed_t tiospeed_t(int baud)
 		case baud:  \
 			return B ## baud;  \
 // END
-#include "iospeeds.h"
+#include "iospeeds_local.h"
 #undef IOSPEED
 	default:
 		return B0;
@@ -788,7 +788,7 @@ bool valid_baud(int baud)
 		case baud:  \
 			return true;  \
 // END
-#include "iospeeds.h"
+#include "iospeeds_local.h"
 #undef IOSPEED
 		default:
 			return false;

+ 1 - 17
iospeeds.h

@@ -1,20 +1,4 @@
-IOSPEED(0)
-IOSPEED(50)
-IOSPEED(110)
-IOSPEED(134)
-IOSPEED(200)
-
-IOSPEED(75)
-IOSPEED(150)
-IOSPEED(300)
-IOSPEED(600)
-IOSPEED(1200)
-IOSPEED(1800)
-IOSPEED(2400)
-IOSPEED(4800)
-IOSPEED(9600)
-IOSPEED(19200)
-IOSPEED(38400)
+#include <iospeeds_posix.h>
 
 IOSPEED(57600)
 IOSPEED(115200)

+ 17 - 0
iospeeds_posix.h

@@ -0,0 +1,17 @@
+IOSPEED(0)
+IOSPEED(50)
+IOSPEED(110)
+IOSPEED(134)
+IOSPEED(200)
+
+IOSPEED(75)
+IOSPEED(150)
+IOSPEED(300)
+IOSPEED(600)
+IOSPEED(1200)
+IOSPEED(1800)
+IOSPEED(2400)
+IOSPEED(4800)
+IOSPEED(9600)
+IOSPEED(19200)
+IOSPEED(38400)

+ 14 - 13
miner.c

@@ -5038,30 +5038,17 @@ static bool work_rollable(struct work *work)
 static bool hash_push(struct work *work)
 {
 	bool rc = true;
-	bool was_empty;
 
 	mutex_lock(stgd_lock);
 	if (work_rollable(work))
 		staged_rollable++;
 	if (likely(!getq->frozen)) {
-		was_empty = unlikely(staged_full && !HASH_COUNT(staged_work));
 		HASH_ADD_INT(staged_work, id, work);
 		HASH_SORT(staged_work, tv_sort);
 	} else
 		rc = false;
 	pthread_cond_broadcast(&getq->cond);
 	mutex_unlock(stgd_lock);
-	
-	if (unlikely(was_empty))
-	{
-		if (likely(opt_queue < 10 + mining_threads))
-		{
-			++opt_queue;
-			applog(LOG_WARNING, "Staged work underrun; increasing queue minimum to %d", opt_queue);
-		}
-		else
-			applog(LOG_WARNING, "Staged work underrun; not automatically increasing above %d", opt_queue);
-	}
 
 	return rc;
 }
@@ -7035,7 +7022,20 @@ static struct work *hash_pop(void)
 retry:
 	mutex_lock(stgd_lock);
 	while (!getq->frozen && !HASH_COUNT(staged_work))
+	{
+		if (unlikely(staged_full))
+		{
+			if (likely(opt_queue < 10 + mining_threads))
+			{
+				++opt_queue;
+				applog(LOG_WARNING, "Staged work underrun; increasing queue minimum to %d", opt_queue);
+			}
+			else
+				applog(LOG_WARNING, "Staged work underrun; not automatically increasing above %d", opt_queue);
+			staged_full = false;  // Let it fill up before triggering an underrun again
+		}
 		pthread_cond_wait(&getq->cond, stgd_lock);
+	}
 
 	hc = HASH_COUNT(staged_work);
 	/* Find clone work if possible, to allow masters to be reused */
@@ -7286,6 +7286,7 @@ struct work *get_work(struct thr_info *thr)
 	while (!work) {
 		work = hash_pop();
 		if (stale_work(work, false)) {
+			staged_full = false;  // It wasn't really full, since it was stale :(
 			discard_work(work);
 			work = NULL;
 			wake_gws();

+ 1 - 1
openwrt/bfgminer/Makefile

@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=bfgminer
 PKG_TITLE:=BFGMiner
-PKG_VERSION:=3.1.2
+PKG_VERSION:=3.1.3
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tbz2

+ 6 - 1
util.h

@@ -179,8 +179,13 @@ void bytes_cat(bytes_t *b, const bytes_t *cat)
 static inline
 void bytes_cpy(bytes_t *dst, const bytes_t *src)
 {
-	dst->allocsz = src->allocsz;
 	dst->sz = src->sz;
+	if (!dst->sz) {
+		dst->allocsz = 0;
+		dst->buf = NULL;
+		return;
+	}
+	dst->allocsz = src->allocsz;
 	size_t half;
 	while (dst->sz <= (half = dst->allocsz / 2))
 		dst->allocsz = half;