Ensure we iterate over all dies adjusting temperate for hfa by starting iterating after the last die modified.
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
diff --git a/driver-hashfast.c b/driver-hashfast.c
index 58a06fd..31b7f12 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -1124,8 +1124,9 @@ fan_only:
if (now_t - info->last_restart < 15)
return;
- for (i = 0; i < info->asic_count ; i++) {
- struct hf_die_data *hdd = &info->die_data[i];
+ for (i = 1; i <= info->asic_count ; i++) {
+ int die = (info->last_die_adjusted + i) % info->asic_count;
+ struct hf_die_data *hdd = &info->die_data[die];
/* Only send a restart no more than every 30 seconds. */
if (now_t - hdd->last_restart < 30)
@@ -1148,16 +1149,20 @@ fan_only:
/* Have some leeway before throttling speed */
if (hdd->temp < opt_hfa_target + HFA_TEMP_HYSTERESIS)
break;
- hfa_decrease_clock(hashfast, info, i);
+ hfa_decrease_clock(hashfast, info, die);
} else {
/* Temp below target range.*/
/* Already at max speed */
if (hdd->hash_clock == info->hash_clock_rate)
continue;
- hfa_increase_clock(hashfast, info, i);
+ hfa_increase_clock(hashfast, info, die);
}
+ /* Keep track of the last die adjusted since we only adjust
+ * one at a time to ensure we end up iterating over all of
+ * them. */
info->last_restart = hdd->last_restart = now_t;
+ info->last_die_adjusted = die;
break;
}
}
diff --git a/driver-hashfast.h b/driver-hashfast.h
index c2fa608..4489ce4 100644
--- a/driver-hashfast.h
+++ b/driver-hashfast.h
@@ -127,6 +127,7 @@ struct hashfast_info {
int last_max_temp;
int temp_updates;
int fanspeed; // Fanspeed in percent
+ int last_die_adjusted;
pthread_t read_thr;
time_t last_restart;