Browse Source

Bugfix: knc: Use separate DEV_RECOVER_DRV deven when doing automatic core disable/re-enable, so user-initiated disables are left alone

Luke Dashjr 12 years ago
parent
commit
5f9a59a9df
3 changed files with 20 additions and 9 deletions
  1. 7 5
      driver-knc.c
  2. 12 4
      miner.c
  3. 1 0
      miner.h

+ 7 - 5
driver-knc.c

@@ -295,11 +295,11 @@ bool knc_init(struct thr_info * const thr)
 					case KNC_I2CSTATUS_ENABLED:
 					case KNC_I2CSTATUS_ENABLED:
 						break;
 						break;
 					default:  // permanently disabled
 					default:  // permanently disabled
-						timer_unset(&knccore->enable_at);  // never enable
-						// fallthru
-					case KNC_I2CSTATUS_DISABLED:
 						proc->deven = DEV_DISABLED;
 						proc->deven = DEV_DISABLED;
 						break;
 						break;
+					case KNC_I2CSTATUS_DISABLED:
+						proc->deven = DEV_RECOVER_DRV;
+						break;
 				}
 				}
 				
 				
 				proc = proc->next_proc;
 				proc = proc->next_proc;
@@ -623,6 +623,8 @@ void knc_core_disable(struct thr_info * const thr)
 static
 static
 void knc_core_enable(struct thr_info * const thr)
 void knc_core_enable(struct thr_info * const thr)
 {
 {
+	struct knc_core * const knccore = thr->cgpu_data;
+	timer_set_now(&knccore->enable_at);
 	_knc_core_setstatus(thr, 1);
 	_knc_core_setstatus(thr, 1);
 }
 }
 
 
@@ -666,7 +668,7 @@ void knc_hw_error(struct thr_info * const thr)
 		}
 		}
 		else
 		else
 			knccore->hwerr_disable_time  = KNC_HWERR_DISABLE_SECS;
 			knccore->hwerr_disable_time  = KNC_HWERR_DISABLE_SECS;
-		proc->deven = DEV_DISABLED;
+		proc->deven = DEV_RECOVER_DRV;
 		applog(LOG_WARNING, "%"PRIpreprv": Disabled. %d hwerr in %.3f / %.3f . disabled %d s",
 		applog(LOG_WARNING, "%"PRIpreprv": Disabled. %d hwerr in %.3f / %.3f . disabled %d s",
 		       proc->proc_repr, knccore->hwerr_in_row,
 		       proc->proc_repr, knccore->hwerr_in_row,
 		       enable_dt, first_err_dt, knccore->hwerr_disable_time);
 		       enable_dt, first_err_dt, knccore->hwerr_disable_time);
@@ -763,7 +765,7 @@ bool knc_get_stats(struct cgpu_info * const cgpu)
 		knccore->current = current;
 		knccore->current = current;
 		
 		
 		// NOTE: We need to check _mt_disable_called because otherwise enabling won't assert it to i2c (it's false when getting stats for eg proc 0 before proc 1+ haven't initialised completely yet)
 		// NOTE: We need to check _mt_disable_called because otherwise enabling won't assert it to i2c (it's false when getting stats for eg proc 0 before proc 1+ haven't initialised completely yet)
-		if (proc->deven == DEV_DISABLED && timer_passed(&knccore->enable_at, &tv_now) && thr->_mt_disable_called)
+		if (proc->deven == DEV_RECOVER_DRV && timer_passed(&knccore->enable_at, &tv_now) && thr->_mt_disable_called)
 		{
 		{
 			knccore->hwerr_in_row = 0;
 			knccore->hwerr_in_row = 0;
 			proc_enable(proc);
 			proc_enable(proc);

+ 12 - 4
miner.c

@@ -3037,8 +3037,9 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 	if (for_curses)
 	if (for_curses)
 	{
 	{
 		const char *cHrStatsOpt[] = {"\2DEAD \1", "\2SICK \1", "OFF  ", "\2REST \1", " \2ERR \1", "\2WAIT \1", cHr};
 		const char *cHrStatsOpt[] = {"\2DEAD \1", "\2SICK \1", "OFF  ", "\2REST \1", " \2ERR \1", "\2WAIT \1", cHr};
+		const char *cHrStats;
 		int cHrStatsI = (sizeof(cHrStatsOpt) / sizeof(*cHrStatsOpt)) - 1;
 		int cHrStatsI = (sizeof(cHrStatsOpt) / sizeof(*cHrStatsOpt)) - 1;
-		bool all_dead = true, all_off = true;
+		bool all_dead = true, all_off = true, all_rdrv = true;
 		struct cgpu_info *proc = cgpu;
 		struct cgpu_info *proc = cgpu;
 		for (int i = 0; i < cgpu->procs; ++i, (proc = proc->next_proc))
 		for (int i = 0; i < cgpu->procs; ++i, (proc = proc->next_proc))
 		{
 		{
@@ -3059,8 +3060,12 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 						all_off = false;
 						all_off = false;
 					}
 					}
 					else
 					else
-					if (likely(proc->deven != DEV_DISABLED))
-						all_off = false;
+					{
+						if (likely(proc->deven == DEV_ENABLED))
+							all_off = false;
+						if (proc->deven != DEV_RECOVER_DRV)
+							all_rdrv = false;
+					}
 				case 1:
 				case 1:
 					break;
 					break;
 			}
 			}
@@ -3074,9 +3079,12 @@ void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_cur
 		else
 		else
 		if (unlikely(all_off))
 		if (unlikely(all_off))
 			cHrStatsI = 2;
 			cHrStatsI = 2;
+		cHrStats = cHrStatsOpt[cHrStatsI];
+		if (cHrStatsI == 2 && all_rdrv)
+			cHrStats = " RST ";
 		
 		
 		format_statline(buf, bufsz,
 		format_statline(buf, bufsz,
-		                cHrStatsOpt[cHrStatsI],
+		                cHrStats,
 		                aHr, uHr,
 		                aHr, uHr,
 		                accepted, rejected, stale,
 		                accepted, rejected, stale,
 		                wnotaccepted, waccepted,
 		                wnotaccepted, waccepted,

+ 1 - 0
miner.h

@@ -346,6 +346,7 @@ enum dev_enable {
 	DEV_DISABLED,     // Disabled by user
 	DEV_DISABLED,     // Disabled by user
 	DEV_RECOVER,      // Disabled by temperature cutoff in watchdog
 	DEV_RECOVER,      // Disabled by temperature cutoff in watchdog
 	DEV_RECOVER_ERR,  // Disabled by communications error
 	DEV_RECOVER_ERR,  // Disabled by communications error
+	DEV_RECOVER_DRV,  // Disabled by driver
 };
 };
 
 
 enum cl_kernels {
 enum cl_kernels {