validation: scheduler run cpu_num - 1 worker threads

Message ID 1435594158-11370-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov June 29, 2015, 4:09 p.m.
Use first cpu as control thread to run workers. And
all other cpus for workers run with pthread_create.
If needed to run something on current core it has to be
run directly, not with pthread_create.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/validation/odp_scheduler.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Maxim Uvarov June 29, 2015, 5:16 p.m. | #1
On 06/29/15 19:32, Nicolas Morey-Chaisemartin wrote:
> I'm fine with this but why should it only be for this test and not all of them?
Do you have that problem in others tests? Which one?

Maxim.

> On 06/29/2015 06:09 PM, Maxim Uvarov wrote:
>> Use first cpu as control thread to run workers. And
>> all other cpus for workers run with pthread_create.
>> If needed to run something on current core it has to be
>> run directly, not with pthread_create.
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   test/validation/odp_scheduler.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c
>> index c2eb996..fc96d90 100644
>> --- a/test/validation/odp_scheduler.c
>> +++ b/test/validation/odp_scheduler.c
>> @@ -683,7 +683,9 @@ static int schd_suite_init(void)
>>   
>>   	memset(globals, 0, sizeof(test_globals_t));
>>   
>> -	globals->cpu_count = odp_cpu_count();
>> +	/* Use current cpu as control thread and run workers
>> +	 * on all others cpu.*/
>> +	globals->cpu_count = odp_cpu_count() - 1;
>>   	if (globals->cpu_count > MAX_WORKERS)
>>   		globals->cpu_count = MAX_WORKERS;
>>
Maxim Uvarov June 30, 2015, 12:20 p.m. | #2
On 06/29/15 19:32, Nicolas Morey-Chaisemartin wrote:
> I'm fine with this but why should it only be for this test and not all of them?

Nicolas, can you do required changes for your platform and test them? My 
fix needed only for dpdk others tests
looks like pass.

Maxim.

> On 06/29/2015 06:09 PM, Maxim Uvarov wrote:
>> Use first cpu as control thread to run workers. And
>> all other cpus for workers run with pthread_create.
>> If needed to run something on current core it has to be
>> run directly, not with pthread_create.
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   test/validation/odp_scheduler.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c
>> index c2eb996..fc96d90 100644
>> --- a/test/validation/odp_scheduler.c
>> +++ b/test/validation/odp_scheduler.c
>> @@ -683,7 +683,9 @@ static int schd_suite_init(void)
>>   
>>   	memset(globals, 0, sizeof(test_globals_t));
>>   
>> -	globals->cpu_count = odp_cpu_count();
>> +	/* Use current cpu as control thread and run workers
>> +	 * on all others cpu.*/
>> +	globals->cpu_count = odp_cpu_count() - 1;
>>   	if (globals->cpu_count > MAX_WORKERS)
>>   		globals->cpu_count = MAX_WORKERS;
>>
Stuart Haslam June 30, 2015, 12:52 p.m. | #3
On Tue, Jun 30, 2015 at 03:20:34PM +0300, Maxim Uvarov wrote:
> On 06/29/15 19:32, Nicolas Morey-Chaisemartin wrote:
> >I'm fine with this but why should it only be for this test and not all of them?
> 
> Nicolas, can you do required changes for your platform and test
> them? My fix needed only for dpdk others tests
> looks like pass.
> 
> Maxim.

When will the control/worker thread changes on API-NEXT make it into
master?.. because whatever changes are made now will need to be redone
then so perhaps it's better to wait, or cherry pick those changes.

The current fix is a bit limited as it assumes cpu 0 is the control cpu,
but we don't do any thread pinning for the main (/control) thread.
Maxim Uvarov July 2, 2015, 8:51 a.m. | #4
On 06/30/15 15:52, Stuart Haslam wrote:
> On Tue, Jun 30, 2015 at 03:20:34PM +0300, Maxim Uvarov wrote:
>> On 06/29/15 19:32, Nicolas Morey-Chaisemartin wrote:
>>> I'm fine with this but why should it only be for this test and not all of them?
>> Nicolas, can you do required changes for your platform and test
>> them? My fix needed only for dpdk others tests
>> looks like pass.
>>
>> Maxim.
> When will the control/worker thread changes on API-NEXT make it into
> master?.. because whatever changes are made now will need to be redone
> then so perhaps it's better to wait, or cherry pick those changes.
>
> The current fix is a bit limited as it assumes cpu 0 is the control cpu,
> but we don't do any thread pinning for the main (/control) thread.
>
That is good question. Probably we should cherry-pick that change before 
anything else. At least to
unblock dpdk.

Maxim.
Mike Holmes July 2, 2015, 5:50 p.m. | #5
Yes - at the latest lets use Tuesdays ODP planning meeting to find a pick
what makes sense in preparation for ODP 1.2 at the end of August.

On 2 July 2015 at 04:51, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 06/30/15 15:52, Stuart Haslam wrote:
>
>> On Tue, Jun 30, 2015 at 03:20:34PM +0300, Maxim Uvarov wrote:
>>
>>> On 06/29/15 19:32, Nicolas Morey-Chaisemartin wrote:
>>>
>>>> I'm fine with this but why should it only be for this test and not all
>>>> of them?
>>>>
>>> Nicolas, can you do required changes for your platform and test
>>> them? My fix needed only for dpdk others tests
>>> looks like pass.
>>>
>>> Maxim.
>>>
>> When will the control/worker thread changes on API-NEXT make it into
>> master?.. because whatever changes are made now will need to be redone
>> then so perhaps it's better to wait, or cherry pick those changes.
>>
>> The current fix is a bit limited as it assumes cpu 0 is the control cpu,
>> but we don't do any thread pinning for the main (/control) thread.
>>
>>  That is good question. Probably we should cherry-pick that change before
> anything else. At least to
> unblock dpdk.
>
> Maxim.
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>

Patch

diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c
index c2eb996..fc96d90 100644
--- a/test/validation/odp_scheduler.c
+++ b/test/validation/odp_scheduler.c
@@ -683,7 +683,9 @@  static int schd_suite_init(void)
 
 	memset(globals, 0, sizeof(test_globals_t));
 
-	globals->cpu_count = odp_cpu_count();
+	/* Use current cpu as control thread and run workers
+	 * on all others cpu.*/
+	globals->cpu_count = odp_cpu_count() - 1;
 	if (globals->cpu_count > MAX_WORKERS)
 		globals->cpu_count = MAX_WORKERS;