Add throttling control to hfa driver, configurable at command line, nominally set to 85 degrees.
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
diff --git a/cgminer.c b/cgminer.c
index b2fb715..7df8672 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -646,7 +646,7 @@ static char *set_int_0_to_100(const char *arg, int *i)
}
#endif
-#if defined(USE_BFLSC) || defined(USE_BITFURY)
+#if defined(USE_BFLSC) || defined(USE_BITFURY) || defined(USE_HASHFAST)
static char *set_int_0_to_200(const char *arg, int *i)
{
return set_int_range(arg, i, 0, 200);
@@ -1233,6 +1233,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG("--hfa-pll-bypass",
opt_set_bool, &opt_hfa_pll_bypass,
opt_hidden),
+ OPT_WITH_ARG("--hfa-temp-overheat",
+ set_int_0_to_200, opt_show_intval, &opt_hfa_overheat,
+ "Set the hashfast overheat throttling temperature"),
#endif
#ifdef USE_KLONDIKE
OPT_WITH_ARG("--klondike-options",
diff --git a/driver-hashfast.c b/driver-hashfast.c
index a95ef3a..f58da8e 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -20,6 +20,7 @@
int opt_hfa_ntime_roll = 1;
int opt_hfa_hash_clock = 550;
+int opt_hfa_overheat = 85;
bool opt_hfa_pll_bypass;
bool opt_hfa_dfu_boot;
@@ -891,7 +892,10 @@ static bool hfa_prepare(struct thr_info *thr)
/* Figure out how many jobs to send. */
static int hfa_jobs(struct hashfast_info *info)
{
- int ret;
+ int ret = 0;
+
+ if (unlikely(info->overheat))
+ goto out;
mutex_lock(&info->lock);
ret = info->usb_init_base.inflight_target - HF_SEQUENCE_DISTANCE(info->hash_sequence_head, info->device_sequence_tail);
@@ -901,6 +905,7 @@ static int hfa_jobs(struct hashfast_info *info)
ret = info->usb_init_base.inflight_target;
mutex_unlock(&info->lock);
+out:
return ret;
}
@@ -1115,6 +1120,15 @@ static void hfa_statline_before(char *buf, size_t bufsiz, struct cgpu_info *hash
}
tailsprintf(buf, bufsiz, " max%3.0fC %3.2fV | ", max_temp, max_volt);
+
+ if (unlikely(max_temp >= opt_hfa_overheat)) {
+ if (!info->overheat) {
+ applog(LOG_WARNING, "HFA %d: Hit throttle temp of %.1f, throttling!",
+ hashfast->device_id, max_temp);
+ info->overheat = true;
+ }
+ } else if (unlikely(info->overheat))
+ info->overheat = false;
}
static void hfa_init(struct cgpu_info __maybe_unused *hashfast)
diff --git a/driver-hashfast.h b/driver-hashfast.h
index 76a8660..9766b60 100644
--- a/driver-hashfast.h
+++ b/driver-hashfast.h
@@ -18,6 +18,7 @@
int opt_hfa_ntime_roll;
int opt_hfa_hash_clock;
+int opt_hfa_overheat;
bool opt_hfa_pll_bypass;
bool opt_hfa_dfu_boot;
@@ -99,6 +100,7 @@ struct hashfast_info {
uint16_t shed_count; // Dynamic copy of #cores device has shed for thermal control
int no_matching_work;
int resets;
+ bool overheat;
pthread_t read_thr;
};