Commit c445b498 authored by Swann Perarnau's avatar Swann Perarnau
Browse files

[fix] unlocks are too early in dma_linux_*

We were unlocking the dma before the request type get set to a
proper value, resulting in requests sometimes overlapping when
multiple threads were used in benchmarks.
parent 956d9453
......@@ -151,7 +151,6 @@ int aml_dma_linux_par_create_request(struct aml_dma_data *d,
pthread_mutex_lock(&dma->data.lock);
req = aml_vector_add(&dma->data.requests);
pthread_mutex_unlock(&dma->data.lock);
/* init the request */
if(type == AML_DMA_REQUEST_TYPE_COPY)
......@@ -177,6 +176,7 @@ int aml_dma_linux_par_create_request(struct aml_dma_data *d,
aml_dma_request_linux_par_move_init(req, darea, st, sptr,
stid);
}
pthread_mutex_unlock(&dma->data.lock);
for(int i = 0; i < dma->data.nbthreads; i++)
{
......
......@@ -117,7 +117,6 @@ int aml_dma_linux_seq_create_request(struct aml_dma_data *d,
pthread_mutex_lock(&dma->data.lock);
req = aml_vector_add(&dma->data.requests);
pthread_mutex_unlock(&dma->data.lock);
/* init the request */
if(type == AML_DMA_REQUEST_TYPE_COPY)
......@@ -143,6 +142,7 @@ int aml_dma_linux_seq_create_request(struct aml_dma_data *d,
aml_dma_request_linux_seq_move_init(req, darea, st, sptr,
stid);
}
pthread_mutex_unlock(&dma->data.lock);
*r = (struct aml_dma_request *)req;
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment