Ver código fonte

Tell helgrind that it's fine to check for empty fifo without actual mutex (it's just a pointer)

Samuel Thibault 12 anos atrás
pai
commit
af6fbb8766

+ 16 - 4
src/sched_policies/eager_central_policy.c

@@ -129,12 +129,24 @@ static struct starpu_task *pop_task_eager_policy(unsigned sched_ctx_id)
 	struct _starpu_eager_center_policy_data *data = (struct _starpu_eager_center_policy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	struct starpu_task *task = NULL;
-	if(!_starpu_fifo_empty(data->fifo))
+
+	/* Tell helgrind that it's fine to check for empty fifo without actual
+	 * mutex (it's just a pointer) */
+	VALGRIND_HG_MUTEX_LOCK_PRE(&data->policy_mutex);
+	VALGRIND_HG_MUTEX_LOCK_POST(&data->policy_mutex);
+	/* block until some event happens */
+	if (_starpu_fifo_empty(data->fifo))
 	{
-		_STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-		 task = _starpu_fifo_pop_task(data->fifo, workerid);
-		_STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
+		VALGRIND_HG_MUTEX_UNLOCK_PRE(&data->policy_mutex);
+		VALGRIND_HG_MUTEX_UNLOCK_POST(&data->policy_mutex);
+		return NULL;
 	}
+	VALGRIND_HG_MUTEX_UNLOCK_PRE(&data->policy_mutex);
+	VALGRIND_HG_MUTEX_UNLOCK_POST(&data->policy_mutex);
+
+	_STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
+	 task = _starpu_fifo_pop_task(data->fifo, workerid);
+	_STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 		
 	return task;
 }

+ 10 - 0
src/sched_policies/eager_central_priority_policy.c

@@ -166,9 +166,19 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 
 	struct _starpu_priority_taskq *taskq = data->taskq;
 
+	/* Tell helgrind that it's fine to check for empty fifo without actual
+	 * mutex (it's just a pointer) */
+	VALGRIND_HG_MUTEX_LOCK_PRE(&data->policy_mutex);
+	VALGRIND_HG_MUTEX_LOCK_POST(&data->policy_mutex);
 	/* block until some event happens */
 	if (taskq->total_ntasks == 0)
+	{
+		VALGRIND_HG_MUTEX_UNLOCK_PRE(&data->policy_mutex);
+		VALGRIND_HG_MUTEX_UNLOCK_POST(&data->policy_mutex);
 		return NULL;
+	}
+	VALGRIND_HG_MUTEX_UNLOCK_PRE(&data->policy_mutex);
+	VALGRIND_HG_MUTEX_UNLOCK_POST(&data->policy_mutex);
 
 	/* release this mutex before trying to wake up other workers */
 	_starpu_pthread_mutex_t *curr_sched_mutex;

+ 0 - 26
tools/valgrind/starpu.suppr

@@ -70,29 +70,3 @@
    fun:_starpu_load_bus_performance_files
    ...
 }
-
-{
-   This is racy, but keep it away for now, otherwise it clutters the buildbot log
-   Helgrind:Race
-   fun:_starpu_fifo_empty
-   fun:pop_task_eager_policy
-   ...
-}
-
-{
-   This is the counterpart of the suppression above
-   Helgrind:Race
-   fun:_starpu_fifo_push_task
-   fun:push_task_eager_policy
-   ...
-}
-
-
-{
-   This is the counterpart of the suppression above
-   Helgrind:Race
-   fun:_starpu_fifo_push_sorted_task
-   fun:_starpu_fifo_push_task
-   fun:push_task_eager_policy
-   ...
-}