v2.6.2 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. --- a/FPGA-README
  2. +++ b/FPGA-README
  3. @@ -16,7 +16,25 @@
  4. Icarus
  5. -There is a hidden option in cgminer when Icarus support is compiled in:
  6. +There are two hidden options in cgminer when Icarus support is compiled in:
  7. +
  8. +--icarus-options <arg> Set specific FPGA board configurations - one set of values for all or comma separated
  9. + baud:work_division:fpga_count
  10. +
  11. + baud The Serial/USB baud rate - 115200 or 57600 only - default 115200
  12. + work_division The fraction of work divided up for each FPGA chip - 1, 2, 4 or 8
  13. + e.g. 2 means each FPGA does half the nonce range - default 2
  14. + fpga_count The actual number of FPGA working - this would normally be the same
  15. + as work_division - range is from 1 up to 'work_division'
  16. + It defaults to the value of work_division - or 2 if you don't specify
  17. + work_division
  18. +
  19. +If you define fewer comma seperated values than Icarus devices, the last values will be used
  20. +for all extra devices
  21. +
  22. +An example would be: --icarus-options 57600:2:1
  23. +This would mean: use 57600 baud, the FPGA board divides the work in half however
  24. +only 1 FPGA actually runs on the board (e.g. like an early CM1 Icarus copy bitstream)
  25. --icarus-timing <arg> Set how the Icarus timing is calculated - one setting/value for all or comma separated
  26. default[=N] Use the default Icarus hash time (2.6316ns)
  27. @@ -24,6 +42,9 @@
  28. long Re-calculate the hash time continuously
  29. value[=N] Specify the hash time in nanoseconds (e.g. 2.6316) and abort time (e.g. 2.6316=80)
  30. +If you define fewer comma seperated values than Icarus devices, the last values will be used
  31. +for all extra devices
  32. +
  33. Icarus timing is required for devices that do not exactly match a default Icarus Rev3 in
  34. processing speed
  35. If you have an Icarus Rev3 you should not normally need to use --icarus-timing since the
  36. @@ -55,9 +76,9 @@
  37. 'short' mode and take note of the final hash time value (Hs) calculated
  38. You can also use the RPC API 'stats' command to see the current hash time (Hs) at any time
  39. -The Icarus code currently only works with a dual FPGA device that supports the same commands as
  40. +The Icarus code currently only works with an FPGA device that supports the same commands as
  41. Icarus Rev3 requires and also is less than ~840MH/s and greater than 2MH/s
  42. -If a dual FPGA device does hash faster than ~840MH/s it should work correctly if you supply the
  43. +If an FPGA device does hash faster than ~840MH/s it should work correctly if you supply the
  44. correct hash time nanoseconds value
  45. The timing code itself will affect the Icarus performance since it increases the delay after
  46. --- a/NEWS
  47. +++ b/NEWS
  48. @@ -1,7 +1,42 @@
  49. +Version 2.6.2 - August 3, 2012
  50. +
  51. +- Scrypt mining does not support block testing yet so don't try to print it.
  52. +- Clear the bitforce buffer whenever we get an unexpected result as it has
  53. +likely throttled and we are getting cached responses out of order, and use the
  54. +temperature monitoring as a kind of watchdog to flush unexpected results.
  55. +- It is not critical getting the temperature response in bitforce so don't
  56. +mandatorily wait on the mutex lock.
  57. +- Check there is a cutoff temp actually set in bitforce before using it as a cut
  58. +off value otherwise it may think it's set to zero degrees.
  59. +- We dropped the temporary stopping of curl recruiting on submit_fail by
  60. +mistake, reinstate it.
  61. +- Make threads report in either side of the scanhash function in case we miss
  62. +reporting in when restarting work.
  63. +- Don't make mandatory work and its clones last forever.
  64. +- Make test work for pool_active mandatory work items to smooth out staged work
  65. +counts when in failover-only mode.
  66. +- Add debugging output when work is found stale as to why.
  67. +- Print the 3 parameters that are passed to applog for a debug line in
  68. +bitforce.c
  69. +- Clear bitforce buffer on init as previously.
  70. +- Add some headroom to the number of curls available per pool to allow for
  71. +longpoll and sendwork curls.
  72. +- Revert "Revert "Change BFL driver thread initialising to a constant 100ms
  73. +delay between devices instead of a random arrangement.""
  74. +- Revert "Remove bitforce_thread_init"
  75. +- Show the correct base units on GPU summary.
  76. +- Differentiate between the send return value being a bool and the get return
  77. +value when managing them in bitforce scanhash.
  78. +- 23a8c60 Revert "bitforce: Skip out of sending work if work restart requested"
  79. +
  80. +
  81. Version 2.6.1 - July 30, 2012
  82. +- Display scrypt as being built in as well.
  83. +- Fix build warning about KL_SCRYPT when built without scrypt support.
  84. - Remove the low hash count determinant of hardware being sick. A low hash rate
  85. -can be for poor network connectivity or scrypt mining, neither of which a
  86. +can be for poor network connectivity or scrypt mining, neither of which are due
  87. +to a sick device.
  88. - api.c poolpriority changes
  89. --- a/cgminer.c
  90. +++ b/cgminer.c
  91. @@ -142,6 +142,7 @@
  92. bool opt_api_network;
  93. bool opt_delaynet;
  94. bool opt_disable_pool = true;
  95. +char *opt_icarus_options = NULL;
  96. char *opt_icarus_timing = NULL;
  97. char *opt_kernel_path;
  98. @@ -710,6 +711,13 @@
  99. }
  100. #ifdef USE_ICARUS
  101. +static char *set_icarus_options(const char *arg)
  102. +{
  103. + opt_set_charp(arg, &opt_icarus_options);
  104. +
  105. + return NULL;
  106. +}
  107. +
  108. static char *set_icarus_timing(const char *arg)
  109. {
  110. opt_set_charp(arg, &opt_icarus_timing);
  111. @@ -873,6 +881,9 @@
  112. "Override sha256 kernel to use (diablo, poclbm, phatk or diakgcn) - one value or comma separated"),
  113. #endif
  114. #ifdef USE_ICARUS
  115. + OPT_WITH_ARG("--icarus-options",
  116. + set_icarus_options, NULL, NULL,
  117. + opt_hidden),
  118. OPT_WITH_ARG("--icarus-timing",
  119. set_icarus_timing, NULL, NULL,
  120. opt_hidden),
  121. @@ -1770,10 +1781,9 @@
  122. if (!QUIET) {
  123. hash32 = (uint32_t *)(work->hash);
  124. - if (opt_scrypt) {
  125. - sprintf(hashshow, "%08lx.%08lx%s", (unsigned long)(hash32[7]), (unsigned long)(hash32[6]),
  126. - work->block? " BLOCK!" : "");
  127. - } else {
  128. + if (opt_scrypt)
  129. + sprintf(hashshow, "%08lx.%08lx", (unsigned long)(hash32[7]), (unsigned long)(hash32[6]));
  130. + else {
  131. sprintf(hashshow, "%08lx.%08lx%s", (unsigned long)(hash32[6]), (unsigned long)(hash32[5]),
  132. work->block? " BLOCK!" : "");
  133. }
  134. @@ -2169,14 +2179,14 @@
  135. * network delays/outages. */
  136. static struct curl_ent *pop_curl_entry(struct pool *pool)
  137. {
  138. - int curl_limit = opt_delaynet ? 5 : mining_threads;
  139. + int curl_limit = opt_delaynet ? 5 : mining_threads * 4 / 3;
  140. struct curl_ent *ce;
  141. mutex_lock(&pool->pool_lock);
  142. if (!pool->curls)
  143. recruit_curl(pool);
  144. else if (list_empty(&pool->curlring)) {
  145. - if (pool->curls >= curl_limit)
  146. + if (pool->submit_fail || pool->curls >= curl_limit)
  147. pthread_cond_wait(&pool->cr_cond, &pool->pool_lock);
  148. else
  149. recruit_curl(pool);
  150. @@ -2278,9 +2288,6 @@
  151. struct pool *pool;
  152. int getwork_delay;
  153. - if (work->mandatory)
  154. - return false;
  155. -
  156. if (share) {
  157. /* Technically the rolltime should be correct but some pools
  158. * advertise a broken expire= that is lower than a meaningful
  159. @@ -2306,14 +2313,20 @@
  160. work_expiry = 5;
  161. gettimeofday(&now, NULL);
  162. - if ((now.tv_sec - work->tv_staged.tv_sec) >= work_expiry)
  163. + if ((now.tv_sec - work->tv_staged.tv_sec) >= work_expiry) {
  164. + applog(LOG_DEBUG, "Work stale due to expiry");
  165. return true;
  166. + }
  167. - if (work->work_block != work_block)
  168. + if (work->work_block != work_block) {
  169. + applog(LOG_DEBUG, "Work stale due to block mismatch");
  170. return true;
  171. + }
  172. - if (opt_fail_only && !share && pool != current_pool() && pool->enabled != POOL_REJECTING)
  173. + if (opt_fail_only && !share && pool != current_pool() && !work->mandatory) {
  174. + applog(LOG_DEBUG, "Work stale due to fail only pool mismatch");
  175. return true;
  176. + }
  177. return false;
  178. }
  179. @@ -3011,6 +3024,8 @@
  180. fprintf(fcfg, ",\n\"api-description\" : \"%s\"", opt_api_description);
  181. if (opt_api_groups)
  182. fprintf(fcfg, ",\n\"api-groups\" : \"%s\"", opt_api_groups);
  183. + if (opt_icarus_options)
  184. + fprintf(fcfg, ",\n\"icarus-options\" : \"%s\"", opt_icarus_options);
  185. if (opt_icarus_timing)
  186. fprintf(fcfg, ",\n\"icarus-timing\" : \"%s\"", opt_icarus_timing);
  187. fputs("\n}", fcfg);
  188. @@ -3584,6 +3599,7 @@
  189. struct work *work = make_work();
  190. bool rc;
  191. + work->mandatory = true;
  192. rc = work_decode(json_object_get(val, "result"), work);
  193. if (rc) {
  194. applog(LOG_DEBUG, "Successfully retrieved and deciphered work from pool %u %s",
  195. @@ -3835,6 +3851,7 @@
  196. memcpy(work_clone, work, sizeof(struct work));
  197. work_clone->clone = true;
  198. work_clone->longpoll = false;
  199. + work_clone->mandatory = false;
  200. /* Make cloned work appear slightly older to bias towards keeping the
  201. * master work item which can be further rolled */
  202. work_clone->tv_staged.tv_sec -= 1;
  203. @@ -4192,7 +4209,9 @@
  204. }
  205. pool_stats->getwork_calls++;
  206. + thread_reportin(mythr);
  207. hashes = api->scanhash(mythr, work, work->blk.nonce + max_nonce);
  208. + thread_reportin(mythr);
  209. gettimeofday(&getwork_start, NULL);
  210. --- a/configure.ac
  211. +++ b/configure.ac
  212. @@ -2,7 +2,7 @@
  213. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  214. m4_define([v_maj], [2])
  215. m4_define([v_min], [6])
  216. -m4_define([v_mic], [1])
  217. +m4_define([v_mic], [2])
  218. ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  219. m4_define([v_ver], [v_maj.v_min.v_mic])
  220. m4_define([lt_rev], m4_eval(v_maj + v_min))
  221. --- a/debian/changelog
  222. +++ b/debian/changelog
  223. @@ -1,112 +1,151 @@
  224. +cgminer (2.4.3-1) stable; urgency=medium
  225. + Version 2.4.3 - June 14, 2012
  226. +
  227. + * can_roll and should_roll should have no bearing on the cycle period within the
  228. + miner_thread so remove it.
  229. + * Check for strategy being changed to load balance when enabling LPs.
  230. + * Check that all threads on the device that called get_work are waiting on getwork
  231. + before considering the pool lagging.
  232. + * Iterate over each thread belonging to each device in the hashmeter instead of
  233. + searching for them now that they're a list.
  234. + * When using rotate pool strategy, ensure we only select from alive enabled pools.
  235. + * Start longpoll from every pool when load balance strategy is in use.
  236. + * Add mandatory and block fields to the work struct. Flag any shares that are
  237. + detected as blocks as mandatory to submit, along with longpoll work from a previously
  238. + rejecting pool.
  239. + * Consider the fan optimal if fanspeed is dropping but within the optimal speed window.
  240. + * Fix typo in some API messages (succeess/success)
  241. + * api.c MMQ stat bugs
  242. + * Bugfix: Fix warnings when built without libudev support
  243. + * Bugfix: slay a variety of warnings
  244. + * Bugfix: modminer: Fix unsigned/signed comparison and similar warnings
  245. + * API add ModMinerQuad support
  246. + * Bugfix: Honour forceauto parameter in serial_detect functions
  247. + * modminer: Temperature sensor improvements
  248. + * modminer: Make log messages more consistent in format
  249. + * Only adjust GPU speed up if the fanspeed is within the normal fanrange and hasn't been
  250. + turned to maximum speed under overheat conditions.
  251. + * ModMiner use valid .name
  252. + * New driver: BTCFPGA ModMiner
  253. + * Abstract generally useful FPGA code into fpgautils.c
  254. + * API add stats for pool getworks
  255. + * miner.php option to hide specific fields from the display
  256. + * miner.php add version numbers to the summary page
  257. + * Update debian configs to v2.4.2
  258. + * Add API and FPGA READMEs into Makefile to be included in source distribution.
  259. + * Icarus - fix unit64_t printf warnings
  260. +
  261. + -- nushor <nushor11@gmail.com> Fri, 15 Jun 2012 11:31:51 -0500
  262. +
  263. cgminer (2.4.2-1) stable; urgency=medium
  264. Version 2.4.2 - June 2, 2012
  265. - - API.class compiled with Java SE 6.0_03 - works with Win7x64
  266. - - miner.php highlight devs too slow finding shares (possibly failing)
  267. - - API update version to V1.11 and document changes
  268. - - API save default config file if none specified
  269. - - api.c save success incorrectly returns error
  270. - - api.c replace BUFSIZ (linux/windows have different values)
  271. - - Move RPC API content out of README to API-README
  272. - - Open a longpoll connection if a pool is in the REJECTING state as it's the
  273. + * API.class compiled with Java SE 6.0_03 - works with Win7x64
  274. + * miner.php highlight devs too slow finding shares (possibly failing)
  275. + * API update version to V1.11 and document changes
  276. + * API save default config file if none specified
  277. + * api.c save success incorrectly returns error
  278. + * api.c replace BUFSIZ (linux/windows have different values)
  279. + * Move RPC API content out of README to API-README
  280. + * Open a longpoll connection if a pool is in the REJECTING state as it's the
  281. only way to re-enable it automatically.
  282. - - Use only one longpoll as much as possible by using a pthread conditional
  283. + * Use only one longpoll as much as possible by using a pthread conditional
  284. broadcast that each longpoll thread waits on and checks if it's the current pool
  285. before
  286. - - If shares are known stale, don't use them to decide to disable a pool for
  287. + * If shares are known stale, don't use them to decide to disable a pool for
  288. sequential rejects.
  289. - - Restarting cgminer from within after ADL has been corrupted only leads to a
  290. + * Restarting cgminer from within after ADL has been corrupted only leads to a
  291. crash. Display a warning only and disable fanspeed monitoring.
  292. - - Icarus: fix abort calculation/allow user specified abort
  293. - - Icarus: make --icarus-timing hidden and document it in FPGA-README
  294. - - Icarus: high accuracy timing and other bitstream speed support
  295. - - add-MIPSEB-to-icarus-for-BIG_ENDIAN
  296. - - work_decode only needs swab32 on midstate under BIG ENDIAN
  297. - - add compile command to api-example.c
  298. - - save config bugfix: writing an extra ',' when no gpus
  299. - - Add dpkg-source commits
  300. + * Icarus: fix abort calculation/allow user specified abort
  301. + * Icarus: make --icarus-timing hidden and document it in FPGA-README
  302. + * Icarus: high accuracy timing and other bitstream speed support
  303. + * add-MIPSEB-to-icarus-for-BIG_ENDIAN
  304. + * work_decode only needs swab32 on midstate under BIG ENDIAN
  305. + * add compile command to api-example.c
  306. + * save config bugfix: writing an extra ',' when no gpus
  307. + * Add dpkg-source commits
  308. -- nushor <nushor11@gmail.com> Sun, 03 Jun 2012 22:02:03 -0500
  309. cgminer (2.4.1-1) stable; urgency=low
  310. Version 2.4.1-1 - May 6, 2012
  311. - - In the unlikely event of finding a block, display the block solved count with
  312. + * In the unlikely event of finding a block, display the block solved count with
  313. the pool it came from for auditing.
  314. - - Display the device summary on exit even if a device has been disabled.
  315. - - Use correct pool enabled enums in api.c.
  316. - - Import Debian packaging configs
  317. - - Ensure we test for a pool recovering from idle so long as it's not set to
  318. + * Display the device summary on exit even if a device has been disabled.
  319. + * Use correct pool enabled enums in api.c.
  320. + * Import Debian packaging configs
  321. + * Ensure we test for a pool recovering from idle so long as it's not set to
  322. disabled.
  323. - - Fix pool number display.
  324. - - Give cgminer -T message only if curses is in use.
  325. - - Reinit_adl is no longer used.
  326. - - API 'stats' allow devices to add their own stats also for testing/debug
  327. - - API add getwork stats to cgminer - accesable from API 'stats'
  328. - - Don't initialise variables to zero when in global scope since they're already
  329. + * Fix pool number display.
  330. + * Give cgminer -T message only if curses is in use.
  331. + * Reinit_adl is no longer used.
  332. + * API 'stats' allow devices to add their own stats also for testing/debug
  333. + * API add getwork stats to cgminer - accesable from API 'stats'
  334. + * Don't initialise variables to zero when in global scope since they're already
  335. initialised.
  336. - - Get rid of unitialised variable warning when it's false.
  337. - - Move a pool to POOL_REJECTING to be disabled only after 3 minutes of
  338. + * Get rid of unitialised variable warning when it's false.
  339. + * Move a pool to POOL_REJECTING to be disabled only after 3 minutes of
  340. continuous rejected shares.
  341. - - Some tweaks to reporting and logging.
  342. - - Change FPGA detection order since BFL hangs on an ICA
  343. - - API support new pool status
  344. - - Add a temporarily disabled state for enabled pools called POOL_REJECTING and
  345. + * Some tweaks to reporting and logging.
  346. + * Change FPGA detection order since BFL hangs on an ICA
  347. + * API support new pool status
  348. + * Add a temporarily disabled state for enabled pools called POOL_REJECTING and
  349. use the work from each longpoll to help determine when a rejecting pool has
  350. started working again. Switch pools based on the multipool strategy once a pool
  351. is re-enabled.
  352. - - Removing extra debug
  353. - - Fix the benchmark feature by bypassing the new networking code.
  354. - - Reset sequential reject counter after a pool is disabled for when it is
  355. + * Removing extra debug
  356. + * Fix the benchmark feature by bypassing the new networking code.
  357. + * Reset sequential reject counter after a pool is disabled for when it is
  358. re-enabled.
  359. - - Icarus - correct MH/s and U: with work restart set at 8 seconds
  360. - - ztex updateFreq was always reporting on fpga 0
  361. - - Trying harder to get 1.15y working
  362. - - Specifying threads on multi fpga boards extra cgpu
  363. - - Missing the add cgpu per extra fpga on 1.15y boards
  364. - - API add last share time to each pool
  365. - - Don't try to reap curls if benchmarking is enabled.
  366. + * Icarus - correct MH/s and U: with work restart set at 8 seconds
  367. + * ztex updateFreq was always reporting on fpga 0
  368. + * Trying harder to get 1.15y working
  369. + * Specifying threads on multi fpga boards extra cgpu
  370. + * Missing the add cgpu per extra fpga on 1.15y boards
  371. + * API add last share time to each pool
  372. + * Don't try to reap curls if benchmarking is enabled.
  373. -- nushor <nushor11@gmail.com> Sun, 06 May 2012 11:09:46 -0500
  374. cgminer (2.4.0-1) stable; urgency=low
  375. Version 2.4.0 - May 3, 2012
  376. - - Only show longpoll warning once when it has failed.
  377. - - Convert hashes to an unsigned long long as well.
  378. - - Detect pools that have issues represented by endless rejected shares and
  379. + * Only show longpoll warning once when it has failed.
  380. + * Convert hashes to an unsigned long long as well.
  381. + * Detect pools that have issues represented by endless rejected shares and
  382. disable them, with a parameter to optionally disable this feature.
  383. - - Bugfix: Use a 64-bit type for hashes_done (miner_thread) since it can overflow
  384. + * Bugfix: Use a 64-bit type for hashes_done (miner_thread) since it can overflow
  385. 32-bit on some FPGAs
  386. - - Implement an older header fix for a label existing before the pthread_cleanup
  387. + * Implement an older header fix for a label existing before the pthread_cleanup
  388. macro.
  389. - - Limit the number of curls we recruit on communication failures and with
  390. + * Limit the number of curls we recruit on communication failures and with
  391. delaynet enabled to 5 by maintaining a per-pool curl count, and using a pthread
  392. conditional that wakes up when one is returned to the ring buffer.
  393. - - Generalise add_pool() functions since they're repeated in add_pool_details.
  394. - - Bugfix: Return failure, rather than quit, if BFwrite fails
  395. - - Disable failing devices such that the user can attempt to re-enable them
  396. - - Bugfix: thread_shutdown shouldn't try to free the device, since it's needed
  397. + * Generalise add_pool() functions since they're repeated in add_pool_details.
  398. + * Bugfix: Return failure, rather than quit, if BFwrite fails
  399. + * Disable failing devices such that the user can attempt to re-enable them
  400. + * Bugfix: thread_shutdown shouldn't try to free the device, since it's needed
  401. afterward
  402. - - API bool's and 1TBS fixes
  403. - - Icarus - minimise code delays and name timer variables
  404. - - api.c V1.9 add 'restart' + redesign 'quit' so thread exits cleanly
  405. - - api.c bug - remove extra ']'s in notify command
  406. - - Increase pool watch interval to 30 seconds.
  407. - - Reap curls that are unused for over a minute. This allows connections to be
  408. + * API bool's and 1TBS fixes
  409. + * Icarus - minimise code delays and name timer variables
  410. + * api.c V1.9 add 'restart' + redesign 'quit' so thread exits cleanly
  411. + * api.c bug - remove extra ']'s in notify command
  412. + * Increase pool watch interval to 30 seconds.
  413. + * Reap curls that are unused for over a minute. This allows connections to be
  414. closed, thereby allowing the number of curl handles to always be the minimum
  415. necessary to not delay networking.
  416. - - Use the ringbuffer of curls from the same pool for submit as well as getwork
  417. + * Use the ringbuffer of curls from the same pool for submit as well as getwork
  418. threads. Since the curl handles were already connected to the same pool and are
  419. immediately available, share submission will not be delayed by getworks.
  420. - - Implement a scaleable networking framework designed to cope with any sized
  421. + * Implement a scaleable networking framework designed to cope with any sized
  422. network requirements, yet minimise the number of connections being reopened. Do
  423. this by create a ring buffer linked list of curl handles to be used by getwork,
  424. recruiting extra handles when none is immediately available.
  425. - - There is no need for the submit and getwork curls to be tied to the pool
  426. + * There is no need for the submit and getwork curls to be tied to the pool
  427. struct.
  428. - - Do not recruit extra connection threads if there have been connection errors
  429. + * Do not recruit extra connection threads if there have been connection errors
  430. to the pool in question.
  431. - - We should not retry submitting shares indefinitely or we may end up with a
  432. + * We should not retry submitting shares indefinitely or we may end up with a
  433. huge backlog during network outages, so discard stale shares if we failed to
  434. submit them and they've become stale in the interim.
  435. @@ -114,32 +153,32 @@
  436. cgminer (2.3.6-3) stable; urgency=low
  437. Version 2.3.6-3 - may 3, 2012
  438. - - More bug fixes, Pre 2.4.1 release.
  439. + * More bug fixes, Pre 2.4.1 release.
  440. -- nushor <nushor11@gmail.com> Thurs, 03 May 2012 00:36:50 -0500
  441. cgminer (2.3.6-2) stable; urgency=low
  442. Version 2.3.6-2 - May 2, 2012
  443. - - Various bug fixes, latest build from repository.
  444. + * Various bug fixes, latest build from repository.
  445. -- nushor <nushor11@gmail.com> Wed, 02 May 2012 18:17:49 -0500
  446. cgminer (2.3.6-1) stable; urgency=low
  447. Version 2.3.6 - April 29, 2012
  448. - - Shorten stale share messages slightly.
  449. - - Protect the freeing of current_hash under mutex_lock to prevent racing on it
  450. + * Shorten stale share messages slightly.
  451. + * Protect the freeing of current_hash under mutex_lock to prevent racing on it
  452. when set_curblock is hit concurrently.
  453. - - Change default behaviour to submitting stale, removing the --submit-stale
  454. + * Change default behaviour to submitting stale, removing the --submit-stale
  455. option and adding a --no-submit-stale option.
  456. - - Make sure to start the getwork and submit threads when a pool is added on the
  457. + * Make sure to start the getwork and submit threads when a pool is added on the
  458. fly. This fixes a crash when a pool is added to running cgminer and then
  459. switched to.
  460. - - Faster hardware can easily outstrip the speed we can get work and submit
  461. + * Faster hardware can easily outstrip the speed we can get work and submit
  462. shares when using only one connection per pool.
  463. - - Test the queued list to see if any get/submits are already queued and if they
  464. + * Test the queued list to see if any get/submits are already queued and if they
  465. are, start recruiting extra connections by generating new threads.
  466. - - This allows us to reuse network connections at low loads but recuit new open
  467. + * This allows us to reuse network connections at low loads but recuit new open
  468. connections as they're needed, so that cgminer can scale to hardware of any
  469. size.
  470. --- a/driver-bitforce.c
  471. +++ b/driver-bitforce.c
  472. @@ -157,7 +157,7 @@
  473. return true;
  474. }
  475. -static void biforce_clear_buffer(struct cgpu_info *bitforce)
  476. +static void bitforce_clear_buffer(struct cgpu_info *bitforce)
  477. {
  478. int fdDev = bitforce->device_fd;
  479. char pdevbuf[0x100];
  480. @@ -185,6 +185,8 @@
  481. applog(LOG_WARNING, "BFL%i: Re-initialising", bitforce->device_id);
  482. + bitforce_clear_buffer(bitforce);
  483. +
  484. mutex_lock(&bitforce->device_mutex);
  485. if (fdDev) {
  486. BFclose(fdDev);
  487. @@ -239,7 +241,11 @@
  488. if (!fdDev)
  489. return false;
  490. - mutex_lock(&bitforce->device_mutex);
  491. + /* It is not critical getting temperature so don't get stuck if we
  492. + * can't grab the mutex here */
  493. + if (mutex_trylock(&bitforce->device_mutex))
  494. + return false;
  495. +
  496. BFwrite(fdDev, "ZLX", 3);
  497. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  498. mutex_unlock(&bitforce->device_mutex);
  499. @@ -255,7 +261,7 @@
  500. if (temp > 0) {
  501. bitforce->temp = temp;
  502. - if (temp > bitforce->cutofftemp) {
  503. + if (unlikely(bitforce->cutofftemp > 0 && temp > bitforce->cutofftemp)) {
  504. applog(LOG_WARNING, "BFL%i: Hit thermal cutoff limit, disabling!", bitforce->device_id);
  505. bitforce->deven = DEV_RECOVER;
  506. @@ -264,7 +270,15 @@
  507. bitforce->dev_thermal_cutoff_count++;
  508. }
  509. }
  510. + } else {
  511. + /* Use the temperature monitor as a kind of watchdog for when
  512. + * our responses are out of sync and flush the buffer to
  513. + * hopefully recover */
  514. + applog(LOG_WARNING, "BFL%i: Garbled response probably throttling, clearing buffer");
  515. + bitforce_clear_buffer(bitforce);
  516. + return false;;
  517. }
  518. +
  519. return true;
  520. }
  521. @@ -287,8 +301,7 @@
  522. BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
  523. if (!pdevbuf[0] || !strncasecmp(pdevbuf, "B", 1)) {
  524. mutex_unlock(&bitforce->device_mutex);
  525. - if (!restart_wait(WORK_CHECK_INTERVAL_MS))
  526. - return false;
  527. + nmsleep(WORK_CHECK_INTERVAL_MS);
  528. goto re_send;
  529. } else if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
  530. mutex_unlock(&bitforce->device_mutex);
  531. @@ -300,6 +313,7 @@
  532. goto re_send;
  533. }
  534. applog(LOG_ERR, "BFL%i: Error: Send work reports: %s", bitforce->device_id, pdevbuf);
  535. + bitforce_clear_buffer(bitforce);
  536. return false;
  537. }
  538. @@ -340,6 +354,7 @@
  539. if (unlikely(strncasecmp(pdevbuf, "OK", 2))) {
  540. applog(LOG_ERR, "BFL%i: Error: Send block data reports: %s", bitforce->device_id, pdevbuf);
  541. + bitforce_clear_buffer(bitforce);
  542. return false;
  543. }
  544. @@ -414,7 +429,7 @@
  545. }
  546. if (delay_time_ms != bitforce->sleep_ms)
  547. - applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms);
  548. + applog(LOG_DEBUG, "BFL%i: Wait time changed to: %d, waited %u", bitforce->device_id, bitforce->sleep_ms, bitforce->wait_ms);
  549. /* Work out the average time taken. Float for calculation, uint for display */
  550. bitforce->avg_wait_f += (tv_to_ms(elapsed) - bitforce->avg_wait_f) / TIME_AVG_CONSTANT;
  551. @@ -428,6 +443,7 @@
  552. return 0; /* Device idle */
  553. else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
  554. applog(LOG_WARNING, "BFL%i: Error: Get result reports: %s", bitforce->device_id, pdevbuf);
  555. + bitforce_clear_buffer(bitforce);
  556. return 0;
  557. }
  558. @@ -475,9 +491,10 @@
  559. {
  560. struct cgpu_info *bitforce = thr->cgpu;
  561. unsigned int sleep_time;
  562. + bool send_ret;
  563. int64_t ret;
  564. - ret = bitforce_send_work(thr, work);
  565. + send_ret = bitforce_send_work(thr, work);
  566. if (!bitforce->nonce_range) {
  567. /* Initially wait 2/3 of the average cycle time so we can request more
  568. @@ -503,8 +520,10 @@
  569. bitforce->wait_ms = sleep_time;
  570. }
  571. - if (ret)
  572. + if (send_ret)
  573. ret = bitforce_get_result(thr, work);
  574. + else
  575. + ret = -1;
  576. if (ret == -1) {
  577. ret = 0;
  578. @@ -513,7 +532,7 @@
  579. bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR;
  580. bitforce->dev_comms_error_count++;
  581. /* empty read buffer */
  582. - biforce_clear_buffer(bitforce);
  583. + bitforce_clear_buffer(bitforce);
  584. }
  585. return ret;
  586. }
  587. @@ -523,6 +542,20 @@
  588. return bitforce_get_temp(bitforce);
  589. }
  590. +static bool bitforce_thread_init(struct thr_info *thr)
  591. +{
  592. + struct cgpu_info *bitforce = thr->cgpu;
  593. + unsigned int wait;
  594. +
  595. + /* Pause each new thread at least 100ms between initialising
  596. + * so the devices aren't making calls all at the same time. */
  597. + wait = thr->id * MAX_START_DELAY_US;
  598. + applog(LOG_DEBUG, "BFL%i: Delaying start by %dms", bitforce->device_id, wait / 1000);
  599. + usleep(wait);
  600. +
  601. + return true;
  602. +}
  603. +
  604. static struct api_data *bitforce_api_stats(struct cgpu_info *cgpu)
  605. {
  606. struct api_data *root = NULL;
  607. @@ -546,6 +579,7 @@
  608. .get_statline_before = get_bitforce_statline_before,
  609. .get_stats = bitforce_get_stats,
  610. .thread_prepare = bitforce_thread_prepare,
  611. + .thread_init = bitforce_thread_init,
  612. .scanhash = bitforce_scanhash,
  613. .thread_shutdown = bitforce_shutdown,
  614. .thread_enable = biforce_thread_enable
  615. --- a/driver-icarus.c
  616. +++ b/driver-icarus.c
  617. @@ -65,7 +65,7 @@
  618. #define ASSERT1(condition) __maybe_unused static char sizeof_uint32_t_must_be_4[(condition)?1:-1]
  619. ASSERT1(sizeof(uint32_t) == 4);
  620. -#define ICARUS_READ_TIME ((double)ICARUS_READ_SIZE * (double)8.0 / (double)ICARUS_IO_SPEED)
  621. +#define ICARUS_READ_TIME(baud) ((double)ICARUS_READ_SIZE * (double)8.0 / (double)(baud))
  622. // Fraction of a second, USB timeout is measured in
  623. // i.e. 10 means 1/10 of a second
  624. @@ -176,11 +176,36 @@
  625. // (which will only affect W)
  626. uint64_t history_count;
  627. struct timeval history_time;
  628. +
  629. + // icarus-options
  630. + int baud;
  631. + int work_division;
  632. + int fpga_count;
  633. + uint32_t nonce_mask;
  634. };
  635. +#define END_CONDITION 0x0000ffff
  636. +
  637. // One for each possible device
  638. static struct ICARUS_INFO **icarus_info;
  639. +// Looking for options in --icarus-timing and --icarus-options:
  640. +//
  641. +// Code increments this each time we start to look at a device
  642. +// However, this means that if other devices are checked by
  643. +// the Icarus code (e.g. BFL) they will count in the option offset
  644. +//
  645. +// This, however, is deterministic so that's OK
  646. +//
  647. +// If we were to increment after successfully finding an Icarus
  648. +// that would be random since an Icarus may fail and thus we'd
  649. +// not be able to predict the option order
  650. +//
  651. +// This also assumes that serial_detect() checks them sequentially
  652. +// and in the order specified on the command line
  653. +//
  654. +static int option_offset = -1;
  655. +
  656. struct device_api icarus_api;
  657. static void rev(unsigned char *s, size_t l)
  658. @@ -195,8 +220,8 @@
  659. }
  660. }
  661. -#define icarus_open2(devpath, purge) serial_open(devpath, 115200, ICARUS_READ_FAULT_DECISECONDS, purge)
  662. -#define icarus_open(devpath) icarus_open2(devpath, false)
  663. +#define icarus_open2(devpath, baud, purge) serial_open(devpath, baud, ICARUS_READ_FAULT_DECISECONDS, purge)
  664. +#define icarus_open(devpath, baud) icarus_open2(devpath, baud, false)
  665. static int icarus_gets(unsigned char *buf, int fd, struct timeval *tv_finish, struct thr_info *thr, int read_count)
  666. {
  667. @@ -272,7 +297,7 @@
  668. }
  669. }
  670. -static void set_timing_mode(struct cgpu_info *icarus)
  671. +static void set_timing_mode(int this_option_offset, struct cgpu_info *icarus)
  672. {
  673. struct ICARUS_INFO *info = icarus_info[icarus->device_id];
  674. double Hs;
  675. @@ -285,7 +310,7 @@
  676. buf[0] = '\0';
  677. else {
  678. ptr = opt_icarus_timing;
  679. - for (i = 0; i < icarus->device_id; i++) {
  680. + for (i = 0; i < this_option_offset; i++) {
  681. comma = strchr(ptr, ',');
  682. if (comma == NULL)
  683. break;
  684. @@ -354,11 +379,123 @@
  685. applog(LOG_DEBUG, "Icarus: Init: %d mode=%s read_count=%d Hs=%e",
  686. icarus->device_id, timing_mode_str(info->timing_mode), info->read_count, info->Hs);
  687. +}
  688. +
  689. +static uint32_t mask(int work_division)
  690. +{
  691. + char err_buf[BUFSIZ+1];
  692. + uint32_t nonce_mask = 0x7fffffff;
  693. + // yes we can calculate these, but this way it's easy to see what they are
  694. + switch (work_division) {
  695. + case 1:
  696. + nonce_mask = 0xffffffff;
  697. + break;
  698. + case 2:
  699. + nonce_mask = 0x7fffffff;
  700. + break;
  701. + case 4:
  702. + nonce_mask = 0x3fffffff;
  703. + break;
  704. + case 8:
  705. + nonce_mask = 0x1fffffff;
  706. + break;
  707. + default:
  708. + sprintf(err_buf, "Invalid2 icarus-options for work_division (%d) must be 1, 2, 4 or 8", work_division);
  709. + quit(1, err_buf);
  710. + }
  711. +
  712. + return nonce_mask;
  713. +}
  714. +
  715. +static void get_options(int this_option_offset, int *baud, int *work_division, int *fpga_count)
  716. +{
  717. + char err_buf[BUFSIZ+1];
  718. + char buf[BUFSIZ+1];
  719. + char *ptr, *comma, *colon, *colon2;
  720. + size_t max;
  721. + int i, tmp;
  722. +
  723. + if (opt_icarus_options == NULL)
  724. + buf[0] = '\0';
  725. + else {
  726. + ptr = opt_icarus_options;
  727. + for (i = 0; i < this_option_offset; i++) {
  728. + comma = strchr(ptr, ',');
  729. + if (comma == NULL)
  730. + break;
  731. + ptr = comma + 1;
  732. + }
  733. +
  734. + comma = strchr(ptr, ',');
  735. + if (comma == NULL)
  736. + max = strlen(ptr);
  737. + else
  738. + max = comma - ptr;
  739. +
  740. + if (max > BUFSIZ)
  741. + max = BUFSIZ;
  742. + strncpy(buf, ptr, max);
  743. + buf[max] = '\0';
  744. + }
  745. +
  746. + *baud = ICARUS_IO_SPEED;
  747. + *work_division = 2;
  748. + *fpga_count = 2;
  749. +
  750. + if (*buf) {
  751. + colon = strchr(buf, ':');
  752. + if (colon)
  753. + *(colon++) = '\0';
  754. +
  755. + if (*buf) {
  756. + tmp = atoi(buf);
  757. + switch (tmp) {
  758. + case 115200:
  759. + *baud = 115200;
  760. + break;
  761. + case 57600:
  762. + *baud = 57600;
  763. + break;
  764. + default:
  765. + sprintf(err_buf, "Invalid icarus-options for baud (%s) must be 115200 or 57600", buf);
  766. + quit(1, err_buf);
  767. + }
  768. + }
  769. +
  770. + if (colon && *colon) {
  771. + colon2 = strchr(colon, ':');
  772. + if (colon2)
  773. + *(colon2++) = '\0';
  774. +
  775. + if (*colon) {
  776. + tmp = atoi(colon);
  777. + if (tmp == 1 || tmp == 2 || tmp == 4 || tmp == 8) {
  778. + *work_division = tmp;
  779. + *fpga_count = tmp; // default to the same
  780. + } else {
  781. + sprintf(err_buf, "Invalid icarus-options for work_division (%s) must be 1, 2, 4 or 8", colon);
  782. + quit(1, err_buf);
  783. + }
  784. + }
  785. +
  786. + if (colon2 && *colon2) {
  787. + tmp = atoi(colon2);
  788. + if (tmp > 0 && tmp <= *work_division)
  789. + *fpga_count = tmp;
  790. + else {
  791. + sprintf(err_buf, "Invalid icarus-options for fpga_count (%s) must be >0 and <=work_division (%d)", colon2, *work_division);
  792. + quit(1, err_buf);
  793. + }
  794. + }
  795. + }
  796. + }
  797. }
  798. static bool icarus_detect_one(const char *devpath)
  799. {
  800. + int this_option_offset = ++option_offset;
  801. +
  802. struct ICARUS_INFO *info;
  803. struct timeval tv_start, tv_finish;
  804. int fd;
  805. @@ -379,9 +516,13 @@
  806. unsigned char ob_bin[64], nonce_bin[ICARUS_READ_SIZE];
  807. char *nonce_hex;
  808. + int baud, work_division, fpga_count;
  809. +
  810. + get_options(this_option_offset, &baud, &work_division, &fpga_count);
  811. +
  812. applog(LOG_DEBUG, "Icarus Detect: Attempting to open %s", devpath);
  813. - fd = icarus_open2(devpath, true);
  814. + fd = icarus_open2(devpath, baud, true);
  815. if (unlikely(fd == -1)) {
  816. applog(LOG_ERR, "Icarus Detect: Failed to open %s", devpath);
  817. return false;
  818. @@ -429,6 +570,9 @@
  819. applog(LOG_INFO, "Found Icarus at %s, mark as %d",
  820. devpath, icarus->device_id);
  821. + applog(LOG_DEBUG, "Icarus: Init: %d baud=%d work_division=%d fpga_count=%d",
  822. + icarus->device_id, baud, work_division, fpga_count);
  823. +
  824. // Since we are adding a new device on the end it needs to always be allocated
  825. icarus_info[icarus->device_id] = (struct ICARUS_INFO *)malloc(sizeof(struct ICARUS_INFO));
  826. if (unlikely(!(icarus_info[icarus->device_id])))
  827. @@ -439,10 +583,15 @@
  828. // Initialise everything to zero for a new device
  829. memset(info, 0, sizeof(struct ICARUS_INFO));
  830. - info->golden_hashes = (golden_nonce_val & 0x7fffffff) << 1;
  831. + info->baud = baud;
  832. + info->work_division = work_division;
  833. + info->fpga_count = fpga_count;
  834. + info->nonce_mask = mask(work_division);
  835. +
  836. + info->golden_hashes = (golden_nonce_val & info->nonce_mask) * fpga_count;
  837. timersub(&tv_finish, &tv_start, &(info->golden_tv));
  838. - set_timing_mode(icarus);
  839. + set_timing_mode(this_option_offset, icarus);
  840. return true;
  841. }
  842. @@ -458,7 +607,7 @@
  843. struct timeval now;
  844. - int fd = icarus_open(icarus->device_path);
  845. + int fd = icarus_open(icarus->device_path, icarus_info[icarus->device_id]->baud);
  846. if (unlikely(-1 == fd)) {
  847. applog(LOG_ERR, "Failed to open Icarus on %s",
  848. icarus->device_path);
  849. @@ -565,11 +714,9 @@
  850. submit_nonce(thr, work, nonce);
  851. - hash_count = (nonce & 0x7fffffff);
  852. - if (hash_count++ == 0x7fffffff)
  853. - hash_count = 0xffffffff;
  854. - else
  855. - hash_count <<= 1;
  856. + hash_count = (nonce & info->nonce_mask);
  857. + hash_count++;
  858. + hash_count *= info->fpga_count;
  859. if (opt_debug || info->do_icarus_timing)
  860. timersub(&tv_finish, &tv_start, &elapsed);
  861. @@ -580,7 +727,9 @@
  862. }
  863. // ignore possible end condition values
  864. - if (info->do_icarus_timing && (nonce & 0x7fffffff) > 0x000fffff && (nonce & 0x7fffffff) < 0x7ff00000) {
  865. + if (info->do_icarus_timing
  866. + && ((nonce & info->nonce_mask) > END_CONDITION)
  867. + && ((nonce & info->nonce_mask) < (info->nonce_mask & ~END_CONDITION))) {
  868. gettimeofday(&tv_history_start, NULL);
  869. history0 = &(info->history[0]);
  870. @@ -590,7 +739,7 @@
  871. Ti = (double)(elapsed.tv_sec)
  872. + ((double)(elapsed.tv_usec))/((double)1000000)
  873. - - ICARUS_READ_TIME;
  874. + - ((double)ICARUS_READ_TIME(info->baud));
  875. Xi = (double)hash_count;
  876. history0->sumXiTi += Xi * Ti;
  877. history0->sumXi += Xi;
  878. @@ -700,6 +849,9 @@
  879. root = api_add_uint(root, "timing_values", &(info->history[0].values), false);
  880. root = api_add_const(root, "timing_mode", timing_mode_str(info->timing_mode), false);
  881. root = api_add_bool(root, "is_timing", &(info->do_icarus_timing), false);
  882. + root = api_add_int(root, "baud", &(info->baud), false);
  883. + root = api_add_int(root, "work_division", &(info->work_division), false);
  884. + root = api_add_int(root, "fpga_count", &(info->fpga_count), false);
  885. return root;
  886. }
  887. --- a/driver-opencl.c
  888. +++ b/driver-opencl.c
  889. @@ -660,9 +660,19 @@
  890. for (gpu = 0; gpu < nDevs; gpu++) {
  891. struct cgpu_info *cgpu = &gpus[gpu];
  892. + double displayed_rolling, displayed_total;
  893. + bool mhash_base = true;
  894. - wlog("GPU %d: %.1f / %.1f Mh/s | A:%d R:%d HW:%d U:%.2f/m I:%d\n",
  895. - gpu, cgpu->rolling, cgpu->total_mhashes / total_secs,
  896. + displayed_rolling = cgpu->rolling;
  897. + displayed_total = cgpu->total_mhashes / total_secs;
  898. + if (displayed_rolling < 1) {
  899. + displayed_rolling *= 1000;
  900. + displayed_total *= 1000;
  901. + mhash_base = false;
  902. + }
  903. +
  904. + wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d\n",
  905. + gpu, displayed_rolling, displayed_total, mhash_base ? "M" : "K",
  906. cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
  907. cgpu->utility, cgpu->intensity);
  908. #ifdef HAVE_ADL
  909. @@ -710,7 +720,10 @@
  910. if (thr->cgpu != cgpu)
  911. continue;
  912. get_datestamp(checkin, &thr->last);
  913. - wlog("Thread %d: %.1f Mh/s %s ", i, thr->rolling, cgpu->deven != DEV_DISABLED ? "Enabled" : "Disabled");
  914. + displayed_rolling = thr->rolling;
  915. + if (!mhash_base)
  916. + displayed_rolling *= 1000;
  917. + wlog("Thread %d: %.1f %sh/s %s ", i, displayed_rolling, mhash_base ? "M" : "K" , cgpu->deven != DEV_DISABLED ? "Enabled" : "Disabled");
  918. switch (cgpu->status) {
  919. default:
  920. case LIFE_WELL:
  921. --- a/miner.h
  922. +++ b/miner.h
  923. @@ -500,6 +500,11 @@
  924. quit(1, "WTF MUTEX ERROR ON UNLOCK!");
  925. }
  926. +static inline int mutex_trylock(pthread_mutex_t *lock)
  927. +{
  928. + return pthread_mutex_trylock(lock);
  929. +}
  930. +
  931. static inline void wr_lock(pthread_rwlock_t *lock)
  932. {
  933. if (unlikely(pthread_rwlock_wrlock(lock)))
  934. @@ -557,6 +562,7 @@
  935. extern bool opt_api_network;
  936. extern bool opt_delaynet;
  937. extern bool opt_restart;
  938. +extern char *opt_icarus_options;
  939. extern char *opt_icarus_timing;
  940. #ifdef USE_BITFORCE
  941. extern bool opt_bfl_noncerange;
  942. --- a/miner.php
  943. +++ b/miner.php
  944. @@ -87,11 +87,13 @@
  945. 'DATE' => null,
  946. 'RIGS' => null,
  947. 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 'Accepted', 'Rejected=Rej', 'Utility'),
  948. - 'DEVS' => array('ID', 'Name', 'GPU', 'Status', 'MHS av', 'Accepted', 'Rejected=Rej', 'Utility'),
  949. + 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.Status=Status', 'DEVS.Temperature=Temp',
  950. + 'DEVS.MHS av=MHS av', 'DEVS.Accepted=Accept', 'DEVS.Rejected=Rej',
  951. + 'DEVS.Utility=Utility', 'NOTIFY.Last Not Well=Not Well'),
  952. 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', 'Last Share Time'));
  953. $mobilesum = array(
  954. 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'),
  955. - 'DEVS' => array('MHS av', 'Accepted', 'Rejected', 'Utility'),
  956. + 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Accepted', 'DEVS.Rejected', 'DEVS.Utility'),
  957. 'POOL' => array('Accepted', 'Rejected'));
  958. #
  959. # customsummarypages is an array of these Custom Summary Pages
  960. @@ -716,6 +718,9 @@
  961. if ($class == '' && ($rownum % 2) == 0)
  962. $class = $c2class;
  963. + if ($ret == '')
  964. + $ret = $b;
  965. +
  966. return array($ret, $class);
  967. }
  968. #
  969. @@ -1274,8 +1279,171 @@
  970. 'GPU' => 'devs', // You would normally use DEVS
  971. 'PGA' => 'devs', // You would normally use DEVS
  972. 'NOTIFY' => 'notify',
  973. + 'DEVDETAILS' => 'devdetails',
  974. + 'STATS' => 'stats',
  975. 'CONFIG' => 'config');
  976. #
  977. +function joinfields($section1, $section2, $join, $results)
  978. +{
  979. + global $sectionmap;
  980. +
  981. + $name1 = $sectionmap[$section1];
  982. + $name2 = $sectionmap[$section2];
  983. + $newres = array();
  984. +
  985. + // foreach rig in section1
  986. + foreach ($results[$name1] as $rig => $result)
  987. + {
  988. + $status = null;
  989. +
  990. + // foreach answer section in the rig api call
  991. + foreach ($result as $name1b => $fields1b)
  992. + {
  993. + if ($name1b == 'STATUS')
  994. + {
  995. + // remember the STATUS from section1
  996. + $status = $result[$name1b];
  997. + continue;
  998. + }
  999. +
  1000. + // foreach answer section in the rig api call (for the other api command)
  1001. + foreach ($results[$name2][$rig] as $name2b => $fields2b)
  1002. + {
  1003. + if ($name2b == 'STATUS')
  1004. + continue;
  1005. +
  1006. + // If match the same field values of fields in $join
  1007. + $match = true;
  1008. + foreach ($join as $field)
  1009. + if ($fields1b[$field] != $fields2b[$field])
  1010. + {
  1011. + $match = false;
  1012. + break;
  1013. + }
  1014. +
  1015. + if ($match === true)
  1016. + {
  1017. + if ($status != null)
  1018. + {
  1019. + $newres[$rig]['STATUS'] = $status;
  1020. + $status = null;
  1021. + }
  1022. +
  1023. + $subsection = $section1.'+'.$section2;
  1024. + $subsection .= preg_replace('/[^0-9]/', '', $name1b.$name2b);
  1025. +
  1026. + foreach ($fields1b as $nam => $val)
  1027. + $newres[$rig][$subsection]["$section1.$nam"] = $val;
  1028. + foreach ($fields2b as $nam => $val)
  1029. + $newres[$rig][$subsection]["$section2.$nam"] = $val;
  1030. + }
  1031. + }
  1032. + }
  1033. + }
  1034. + return $newres;
  1035. +}
  1036. +#
  1037. +function joinall($section1, $section2, $results)
  1038. +{
  1039. + global $sectionmap;
  1040. +
  1041. + $name1 = $sectionmap[$section1];
  1042. + $name2 = $sectionmap[$section2];
  1043. + $newres = array();
  1044. +
  1045. + // foreach rig in section1
  1046. + foreach ($results[$name1] as $rig => $result)
  1047. + {
  1048. + // foreach answer section in the rig api call
  1049. + foreach ($result as $name1b => $fields1b)
  1050. + {
  1051. + if ($name1b == 'STATUS')
  1052. + {
  1053. + // copy the STATUS from section1
  1054. + $newres[$rig][$name1b] = $result[$name1b];
  1055. + continue;
  1056. + }
  1057. +
  1058. + // foreach answer section in the rig api call (for the other api command)
  1059. + foreach ($results[$name2][$rig] as $name2b => $fields2b)
  1060. + {
  1061. + if ($name2b == 'STATUS')
  1062. + continue;
  1063. +
  1064. + $subsection = $section1.'+'.$section2;
  1065. + $subsection .= preg_replace('/[^0-9]/', '', $name1b.$name2b);
  1066. +
  1067. + foreach ($fields1b as $nam => $val)
  1068. + $newres[$rig][$subsection]["$section1.$nam"] = $val;
  1069. + foreach ($fields2b as $nam => $val)
  1070. + $newres[$rig][$subsection]["$section2.$nam"] = $val;
  1071. + }
  1072. + }
  1073. + }
  1074. + return $newres;
  1075. +}
  1076. +#
  1077. +function joinsections($sections, $results, $errors)
  1078. +{
  1079. + global $sectionmap;
  1080. +
  1081. +#echo "results['pools']=".print_r($results['pools'],true)."<br>";
  1082. +
  1083. + // GPU's don't have Name,ID fields - so create them
  1084. + foreach ($results as $section => $res)
  1085. + foreach ($res as $rig => $result)
  1086. + foreach ($result as $name => $fields)
  1087. + {
  1088. + $subname = preg_replace('/[0-9]/', '', $name);
  1089. + if ($subname == 'GPU' and isset($result[$name]['GPU']))
  1090. + {
  1091. + $results[$section][$rig][$name]['Name'] = 'GPU';
  1092. + $results[$section][$rig][$name]['ID'] = $result[$name]['GPU'];
  1093. + }
  1094. + }
  1095. +
  1096. + foreach ($sections as $section => $fields)
  1097. + if ($section != 'DATE' && !isset($sectionmap[$section]))
  1098. + {
  1099. + $both = explode('+', $section, 2);
  1100. + if (count($both) > 1)
  1101. + {
  1102. + switch($both[0])
  1103. + {
  1104. + case 'SUMMARY':
  1105. + switch($both[1])
  1106. + {
  1107. + case 'POOL':
  1108. + case 'DEVS':
  1109. + case 'CONFIG':
  1110. + $sectionmap[$section] = $section;
  1111. + $results[$section] = joinall($both[0], $both[1], $results);
  1112. + break;
  1113. + }
  1114. + break;
  1115. + case 'DEVS':
  1116. + $join = array('Name', 'ID');
  1117. + switch($both[1])
  1118. + {
  1119. + case 'NOTIFY':
  1120. + case 'DEVDETAILS':
  1121. + $sectionmap[$section] = $section;
  1122. + $results[$section] = joinfields($both[0], $both[1], $join, $results);
  1123. + break;
  1124. + }
  1125. + break;
  1126. + default:
  1127. + $errors[] = "Error: Invalid section '$section'";
  1128. + break;
  1129. + }
  1130. + }
  1131. + else
  1132. + $errors[] = "Error: Invalid section '$section'";
  1133. + }
  1134. +
  1135. + return array($results, $errors);
  1136. +}
  1137. +#
  1138. function secmatch($section, $field)
  1139. {
  1140. if ($section == $field)
  1141. @@ -1335,7 +1503,14 @@
  1142. $value = null;
  1143. }
  1144. - list($showvalue, $class) = fmt($secname, $name, $value, $when, $row);
  1145. + if (strpos($secname, '+') === false)
  1146. + list($showvalue, $class) = fmt($secname, $name, $value, $when, $row);
  1147. + else
  1148. + {
  1149. + $parts = explode('.', $name, 2);
  1150. + list($showvalue, $class) = fmt($parts[0], $parts[1], $value, $when, $row);
  1151. + }
  1152. +
  1153. echo "<td$class align=right>$showvalue</td>";
  1154. }
  1155. endrow();
  1156. @@ -1356,15 +1531,19 @@
  1157. $errors = array();
  1158. foreach ($sections as $section => $fields)
  1159. {
  1160. - if (isset($sectionmap[$section]))
  1161. + $all = explode('+', $section);
  1162. + foreach ($all as $section)
  1163. {
  1164. - $cmd = $sectionmap[$section];
  1165. - if (!isset($cmds[$cmd]))
  1166. - $cmds[$cmd] = 1;
  1167. + if (isset($sectionmap[$section]))
  1168. + {
  1169. + $cmd = $sectionmap[$section];
  1170. + if (!isset($cmds[$cmd]))
  1171. + $cmds[$cmd] = 1;
  1172. + }
  1173. + else
  1174. + if ($section != 'DATE')
  1175. + $errors[] = "Error: unknown section '$section' in custom summary page '$pagename'";
  1176. }
  1177. - else
  1178. - if ($section != 'DATE')
  1179. - $errors[] = "Error: unknown section '$section' in custom summary page '$pagename'";
  1180. }
  1181. $results = array();
  1182. @@ -1399,6 +1578,7 @@
  1183. $shownsomething = false;
  1184. if (count($results) > 0)
  1185. {
  1186. + list($results, $errors) = joinsections($sections, $results, $errors);
  1187. $first = true;
  1188. foreach ($sections as $section => $fields)
  1189. {