linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rt-tests: cyclictest: try not to share the same cpu with main thread
@ 2020-06-20  1:48 Yunfeng Ye
  2020-07-01 16:24 ` John Kacur
  0 siblings, 1 reply; 3+ messages in thread
From: Yunfeng Ye @ 2020-06-20  1:48 UTC (permalink / raw)
  To: williams, jkacur; +Cc: linux-rt-users, Shiyuan Hu, Hewenliang

The main thread will interfere with the test thread and try not to share
the same CPU with the main thread when the number of thread is less than
max_cpus.

Signed-off-by: yeyunfeng <yeyunfeng@huawei.com>
---
 src/cyclictest/cyclictest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 989113fb3483..b3d72caa10ce 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1080,7 +1080,8 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus)
 		fatal("No allowable cpus to run on\n");
 	}

-	m = thread_num % num_cpus;
+	/* just don't try to share the same cpu with main thread */
+	m = (thread_num + 1) % num_cpus;

 	/* there are num_cpus bits set, we want position of m'th one */
 	for (i = 0, cpu = 0; i < max_cpus; i++) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rt-tests: cyclictest: try not to share the same cpu with main thread
  2020-06-20  1:48 [PATCH] rt-tests: cyclictest: try not to share the same cpu with main thread Yunfeng Ye
@ 2020-07-01 16:24 ` John Kacur
  2020-07-02  1:45   ` Yunfeng Ye
  0 siblings, 1 reply; 3+ messages in thread
From: John Kacur @ 2020-07-01 16:24 UTC (permalink / raw)
  To: Yunfeng Ye; +Cc: williams, linux-rt-users, Shiyuan Hu, Hewenliang

<

On Sat, 20 Jun 2020, Yunfeng Ye wrote:

> The main thread will interfere with the test thread and try not to share
> the same CPU with the main thread when the number of thread is less than
> max_cpus.
> 
> Signed-off-by: yeyunfeng <yeyunfeng@huawei.com>
> ---
>  src/cyclictest/cyclictest.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 989113fb3483..b3d72caa10ce 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1080,7 +1080,8 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus)
>  		fatal("No allowable cpus to run on\n");
>  	}
> 
> -	m = thread_num % num_cpus;
> +	/* just don't try to share the same cpu with main thread */
> +	m = (thread_num + 1) % num_cpus;
> 
>  	/* there are num_cpus bits set, we want position of m'th one */
>  	for (i = 0, cpu = 0; i < max_cpus; i++) {
> -- 
> 1.8.3.1
> 
> 
I'm not sure about this one. It would work, but the purpose of the test is 
to make sure we get good real-time results despite the other threads. Plus 
we have done it this way for so long, and tools might expect things to 
work this way. I'm inclined not to take this, even though your idea is 
correct, although note that you didn't apply it everywhere it would be 
needed.

Thanks

John

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rt-tests: cyclictest: try not to share the same cpu with main thread
  2020-07-01 16:24 ` John Kacur
@ 2020-07-02  1:45   ` Yunfeng Ye
  0 siblings, 0 replies; 3+ messages in thread
From: Yunfeng Ye @ 2020-07-02  1:45 UTC (permalink / raw)
  To: John Kacur; +Cc: williams, linux-rt-users, Shiyuan Hu, Hewenliang



On 2020/7/2 0:24, John Kacur wrote:
> <
> 
> On Sat, 20 Jun 2020, Yunfeng Ye wrote:
> 
>> The main thread will interfere with the test thread and try not to share
>> the same CPU with the main thread when the number of thread is less than
>> max_cpus.
>>
>> Signed-off-by: yeyunfeng <yeyunfeng@huawei.com>
>> ---
>>  src/cyclictest/cyclictest.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
>> index 989113fb3483..b3d72caa10ce 100644
>> --- a/src/cyclictest/cyclictest.c
>> +++ b/src/cyclictest/cyclictest.c
>> @@ -1080,7 +1080,8 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus)
>>  		fatal("No allowable cpus to run on\n");
>>  	}
>>
>> -	m = thread_num % num_cpus;
>> +	/* just don't try to share the same cpu with main thread */
>> +	m = (thread_num + 1) % num_cpus;
>>
>>  	/* there are num_cpus bits set, we want position of m'th one */
>>  	for (i = 0, cpu = 0; i < max_cpus; i++) {
>> -- 
>> 1.8.3.1
>>
>>
> I'm not sure about this one. It would work, but the purpose of the test is 
> to make sure we get good real-time results despite the other threads. Plus 
> we have done it this way for so long, and tools might expect things to 
> work this way. I'm inclined not to take this, even though your idea is 
> correct, although note that you didn't apply it everywhere it would be 
> needed.
> 
I think the cyclictest can use not only for rt-linux, but also for gp-linux
(General Purpose Linux) with isolation (for example, isolcpus, nohz_full,
and bind irq affinity to non isolation cpus, also deploy real-time application
with many constraints). In this situation, this path will work good. thanks.

> Thanks
> 
> John
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-02  1:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20  1:48 [PATCH] rt-tests: cyclictest: try not to share the same cpu with main thread Yunfeng Ye
2020-07-01 16:24 ` John Kacur
2020-07-02  1:45   ` Yunfeng Ye

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).