Browse Source

Bugfix: knc: Maintain queue_full for all cores, so they continue to queue work even if the first is disabled

Luke Dashjr 12 years ago
parent
commit
6eab13424a
1 changed files with 17 additions and 6 deletions
  1. 17 6
      driver-knc.c

+ 17 - 6
driver-knc.c

@@ -257,8 +257,6 @@ bool knc_init(struct thr_info * const thr)
 					.asicno = i2cslave - 0x20,
 					.asicno = i2cslave - 0x20,
 					.coreno = i + j,
 					.coreno = i + j,
 				};
 				};
-				if (proc != cgpu)
-					mythr->queue_full = true;
 				proc->device_data = knc;
 				proc->device_data = knc;
 				if (buf[j] != 3)
 				if (buf[j] != 3)
 					proc->deven = DEV_DISABLED;
 					proc->deven = DEV_DISABLED;
@@ -299,6 +297,19 @@ nomorecores: ;
 	return true;
 	return true;
 }
 }
 
 
+static
+void knc_set_queue_full(struct knc_device * const knc)
+{
+	const bool full = (knc->workqueue_size >= knc->workqueue_max);
+	struct cgpu_info *proc;
+	
+	for (proc = knc->cgpu; proc; proc = proc->next_proc)
+	{
+		struct thr_info * const thr = proc->thr[0];
+		thr->queue_full = full;
+	}
+}
+
 static
 static
 void knc_remove_local_queue(struct knc_device * const knc, struct work * const work)
 void knc_remove_local_queue(struct knc_device * const knc, struct work * const work)
 {
 {
@@ -319,7 +330,7 @@ void knc_prune_local_queue(struct thr_info *thr)
 		if (stale_work(work, false))
 		if (stale_work(work, false))
 			knc_remove_local_queue(knc, work);
 			knc_remove_local_queue(knc, work);
 	}
 	}
-	thr->queue_full = (knc->workqueue_size >= knc->workqueue_max);
+	knc_set_queue_full(knc);
 }
 }
 
 
 static
 static
@@ -338,7 +349,7 @@ bool knc_queue_append(struct thr_info * const thr, struct work * const work)
 	DL_APPEND(knc->workqueue, work);
 	DL_APPEND(knc->workqueue, work);
 	++knc->workqueue_size;
 	++knc->workqueue_size;
 	
 	
-	thr->queue_full = (knc->workqueue_size >= knc->workqueue_max);
+	knc_set_queue_full(knc);
 	if (thr->queue_full)
 	if (thr->queue_full)
 		knc_prune_local_queue(thr);
 		knc_prune_local_queue(thr);
 	
 	
@@ -362,7 +373,7 @@ void knc_queue_flush(struct thr_info * const thr)
 	{
 	{
 		knc_remove_local_queue(knc, work);
 		knc_remove_local_queue(knc, work);
 	}
 	}
-	thr->queue_full = false;
+	knc_set_queue_full(knc);
 	
 	
 	HASH_LAST_ADDED(knc->devicework, work);
 	HASH_LAST_ADDED(knc->devicework, work);
 	if (work && stale_work(work, true))
 	if (work && stale_work(work, true))
@@ -535,7 +546,7 @@ void knc_poll(struct thr_info * const thr)
 			if (!--workaccept)
 			if (!--workaccept)
 				break;
 				break;
 		}
 		}
-		thr->queue_full = (knc->workqueue_size >= knc->workqueue_max);
+		knc_set_queue_full(knc);
 	}
 	}
 	
 	
 	timer_set_delay_from_now(&thr->tv_poll, delay_usecs);
 	timer_set_delay_from_now(&thr->tv_poll, delay_usecs);