Merge branch 'master' into kncminer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
diff --git a/ASIC-README b/ASIC-README
index a56666c..f495d29 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -105,7 +105,7 @@ ASIC SPECIFIC COMMANDS
--bitburner-fury-options <arg> Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq
--bitburner-fury-voltage <arg> Set BitBurner Fury core voltage, in millivolts
--bitburner-voltage <arg> Set BitBurner (Avalon) core voltage, in millivolts
---klondike-options <arg> Set klondike options clock:temp1:temp2:fan
+--klondike-options <arg> Set klondike options clock:temptarget
AVALON AND BITBURNER DEVICES
diff --git a/README b/README
index 0a96dee..7f32794 100644
--- a/README
+++ b/README
@@ -227,6 +227,7 @@ ASIC only options:
--bitburner-fury-options <arg> Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq
--bitburner-fury-voltage <arg> Set BitBurner Fury core voltage, in millivolts
--bitburner-voltage <arg> Set BitBurner (Avalon) core voltage, in millivolts
+--klondike-options <arg> Set klondike options clock:temptarget
See ASIC-README for more information regarding these.
diff --git a/cgminer.c b/cgminer.c
index 62d3718..5ef3d47 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1270,7 +1270,7 @@ static struct opt_table opt_config_table[] = {
#ifdef USE_KLONDIKE
OPT_WITH_ARG("--klondike-options",
set_klondike_options, NULL, NULL,
- "Set klondike options clock:temp1:temp2:fan"),
+ "Set klondike options clock:temptarget"),
#endif
OPT_WITHOUT_ARG("--load-balance",
set_loadbalance, &pool_strategy,
diff --git a/driver-klondike.c b/driver-klondike.c
index 8648dde..a445bf4 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -208,6 +208,7 @@ typedef struct jobque {
int workqc;
struct timeval last_update;
bool overheat;
+ bool flushed;
int late_update_count;
int late_update_sequential;
} JOBQUE;
@@ -315,7 +316,7 @@ static KLIST *allocate_kitem(struct cgpu_info *klncgpu)
cg_wunlock(&klninfo->klist_lock);
if (ran_out > 0)
- applog(LOG_ERR, "%s", errbuf);
+ applog(LOG_WARNING, "%s", errbuf);
return kitem;
}
@@ -709,32 +710,14 @@ static bool klondike_init(struct cgpu_info *klncgpu)
// boundaries are checked by device, with valid values returned
if (opt_klondike_options != NULL) {
- int hashclock, fantarget;
- double temp1, temp2;
+ int hashclock;
+ double temptarget;
- sscanf(opt_klondike_options, "%d:%lf:%lf:%d",
- &hashclock,
- &temp1, &temp2,
- &fantarget);
+ sscanf(opt_klondike_options, "%d:%lf", &hashclock, &temptarget);
SET_HASHCLOCK(kline.cfg.hashclock, hashclock);
- kline.cfg.temptarget = cvtCToKln(temp1);
- kline.cfg.tempcritical = cvtCToKln(temp2);
- if (fantarget < 0) {
- applog(LOG_WARNING,
- "%s%i: %s options invalid fantarget < 0 using 0",
- klncgpu->drv->name,
- klncgpu->device_id,
- klncgpu->drv->dname);
- fantarget = 0;
- } else if (fantarget > 100) {
- applog(LOG_WARNING,
- "%s%i: %s options invalid fantarget > 100 using 100",
- klncgpu->drv->name,
- klncgpu->device_id,
- klncgpu->drv->dname);
- fantarget = 100;
- }
- kline.cfg.fantarget = (int)(255 * fantarget / 100);
+ kline.cfg.temptarget = cvtCToKln(temptarget);
+ kline.cfg.tempcritical = 0; // hard code for old firmware
+ kline.cfg.fantarget = 0xff; // hard code for old firmware
size = sizeof(kline.cfg) - 2;
}
@@ -838,6 +821,7 @@ static bool klondike_detect_one(struct libusb_device *dev, struct usb_find_devic
break;
update_usb_stats(klncgpu);
applog(LOG_DEBUG, "Klondike cgpu added");
+ rwlock_init(&klninfo->stat_lock);
cglock_init(&klninfo->klist_lock);
return true;
}
@@ -985,7 +969,9 @@ static void *klondike_get_replies(void *userdata)
}
if (!err && recd == REPLY_SIZE) {
cgtime(&(kitem->tv_when));
+ rd_lock(&(klninfo->stat_lock));
kitem->block_seq = klninfo->block_seq;
+ rd_unlock(&(klninfo->stat_lock));
if (opt_log_level <= READ_DEBUG) {
hexdata = bin2hex((unsigned char *)&(kitem->kline.hd.dev), recd-1);
applog(READ_DEBUG, "%s%i:%d reply [%c:%s]",
@@ -1022,11 +1008,32 @@ static void *klondike_get_replies(void *userdata)
klondike_check_nonce(klncgpu, kitem);
display_kline(klncgpu, &kitem->kline, msg_reply);
break;
- case KLN_CMD_STATUS:
case KLN_CMD_WORK:
+ // We can't do/check this until it's initialised
+ if (klninfo->initialised) {
+ dev = kitem->kline.ws.dev;
+ if (kitem->kline.ws.workqc == 0) {
+ bool idle = false;
+ rd_lock(&(klninfo->stat_lock));
+ if (klninfo->jobque[dev].flushed == false)
+ idle = true;
+ slaves = klninfo->status[0].kline.ws.slavecount;
+ rd_unlock(&(klninfo->stat_lock));
+ if (idle)
+ applog(LOG_WARNING, "%s%i:%d went idle before work was sent",
+ klncgpu->drv->name,
+ klncgpu->device_id,
+ dev);
+ }
+ wr_lock(&(klninfo->stat_lock));
+ klninfo->jobque[dev].flushed = false;
+ wr_unlock(&(klninfo->stat_lock));
+ }
+ case KLN_CMD_STATUS:
case KLN_CMD_ABORT:
// We can't do/check this until it's initialised
if (klninfo->initialised) {
+ isc = 0;
dev = kitem->kline.ws.dev;
wr_lock(&(klninfo->stat_lock));
klninfo->jobque[dev].workqc = (int)(kitem->kline.ws.workqc);
@@ -1066,9 +1073,10 @@ static void *klondike_get_replies(void *userdata)
klninfo->jobque[dev].overheat = true;
wr_unlock(&(klninfo->stat_lock));
- applog(LOG_ERR, "%s%i:%d Critical overheat (%.0fC)",
- klncgpu->drv->name, klncgpu->device_id,
- dev, temp);
+ applog(LOG_WARNING, "%s%i:%d Critical overheat (%.0fC)",
+ klncgpu->drv->name,
+ klncgpu->device_id,
+ dev, temp);
zero_kline(&kline);
kline.hd.cmd = KLN_CMD_ABORT;
@@ -1121,13 +1129,13 @@ static void klondike_flush_work(struct cgpu_info *klncgpu)
KLINE kline;
int slaves, dev;
+ wr_lock(&(klninfo->stat_lock));
klninfo->block_seq++;
+ slaves = klninfo->status[0].kline.ws.slavecount;
+ wr_unlock(&(klninfo->stat_lock));
applog(LOG_DEBUG, "%s%i: flushing work",
klncgpu->drv->name, klncgpu->device_id);
- rd_lock(&(klninfo->stat_lock));
- slaves = klninfo->status[0].kline.ws.slavecount;
- rd_unlock(&(klninfo->stat_lock));
zero_kline(&kline);
kline.hd.cmd = KLN_CMD_ABORT;
for (dev = 0; dev <= slaves; dev++) {
@@ -1138,6 +1146,7 @@ static void klondike_flush_work(struct cgpu_info *klncgpu)
memcpy((void *)&(klninfo->status[dev]),
kitem,
sizeof(klninfo->status[dev]));
+ klninfo->jobque[dev].flushed = true;
wr_unlock(&(klninfo->stat_lock));
kitem = release_kitem(klncgpu, kitem);
}
@@ -1285,14 +1294,14 @@ static bool klondike_queue_full(struct cgpu_info *klncgpu)
seq = ++klninfo->jobque[dev].late_update_sequential;
rd_unlock(&(klninfo->stat_lock));
if (seq < LATE_UPDATE_LIMIT) {
- applog(LOG_ERR, "%s%i:%d late update",
+ applog(LOG_DEBUG, "%s%i:%d late update",
klncgpu->drv->name, klncgpu->device_id, dev);
klondike_get_stats(klncgpu);
goto que;
} else {
- applog(LOG_ERR, "%s%i:%d late update (%d) reached - attempting reset",
- klncgpu->drv->name, klncgpu->device_id,
- dev, LATE_UPDATE_LIMIT);
+ applog(LOG_WARNING, "%s%i:%d late update (%d) reached - attempting reset",
+ klncgpu->drv->name, klncgpu->device_id,
+ dev, LATE_UPDATE_LIMIT);
control_init(klncgpu);
kln_enable(klncgpu);
klondike_get_stats(klncgpu);
@@ -1332,9 +1341,9 @@ tryagain:
if (temp <= KLN_COOLED_DOWN) {
klninfo->jobque[dev].overheat = false;
rd_unlock(&(klninfo->stat_lock));
- applog(LOG_ERR, "%s%i:%d Overheat recovered (%.0fC)",
- klncgpu->drv->name, klncgpu->device_id,
- dev, temp);
+ applog(LOG_WARNING, "%s%i:%d Overheat recovered (%.0fC)",
+ klncgpu->drv->name, klncgpu->device_id,
+ dev, temp);
kln_enable(klncgpu);
goto tryagain;
} else {