All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rt-tests v3 0/1] Fix a few fallouts
@ 2021-07-19  8:15 Daniel Wagner
  2021-07-19  8:15 ` [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Daniel Wagner
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Wagner @ 2021-07-19  8:15 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

v1:
 - initial version
v2:
 - update error message for sched_getaffinity()
v3:
 - updated commit message for sched_getaffinity()

Daniel Wagner (1):
  rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()

 src/lib/rt-numa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.32.0


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

* [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
  2021-07-19  8:15 [PATCH rt-tests v3 0/1] Fix a few fallouts Daniel Wagner
@ 2021-07-19  8:15 ` Daniel Wagner
  2021-08-27  7:31   ` Daniel Wagner
  2021-08-27 17:09   ` John Kacur
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Wagner @ 2021-07-19  8:15 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

pthread_getaffinity_np() prevents static builds as glibc does not
expose it for this configuration. Instead use sched_getaffinity()
directly as pthread_getaffinity_np() is just a fancy glibc wrapper
around sched_getaffinity().

Static builds helps in in situation where the rootfs is minimal
and does for example not ship libnuma.

The pthread_getaffinity_np call was introduced by commit
f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified
[NUM]")

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/lib/rt-numa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index babcc634d57e..bb0121a65eca 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -68,15 +68,13 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
 int cpu_for_thread_ua(int thread_num, int max_cpus)
 {
 	int res, num_cpus, i, m, cpu;
-	pthread_t thread;
 	cpu_set_t cpuset;
 
-	thread = pthread_self();
 	CPU_ZERO(&cpuset);
 
-	res = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
+	res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset);
 	if (res != 0)
-		fatal("pthread_getaffinity_np failed: %s\n", strerror(res));
+		fatal("sched_getaffinity failed: %s\n", strerror(res));
 
 	num_cpus = CPU_COUNT(&cpuset);
 	m = thread_num % num_cpus;
-- 
2.32.0


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

* Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
  2021-07-19  8:15 ` [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Daniel Wagner
@ 2021-08-27  7:31   ` Daniel Wagner
  2021-08-27 17:09   ` John Kacur
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2021-08-27  7:31 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, John Kacur, linux-rt-users

On Mon, Jul 19, 2021 at 10:15:05AM +0200, Daniel Wagner wrote:
> pthread_getaffinity_np() prevents static builds as glibc does not
> expose it for this configuration. Instead use sched_getaffinity()
> directly as pthread_getaffinity_np() is just a fancy glibc wrapper
> around sched_getaffinity().
> 
> Static builds helps in in situation where the rootfs is minimal
> and does for example not ship libnuma.
> 
> The pthread_getaffinity_np call was introduced by commit
> f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified
> [NUM]")

ping

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

* Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
  2021-07-19  8:15 ` [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Daniel Wagner
  2021-08-27  7:31   ` Daniel Wagner
@ 2021-08-27 17:09   ` John Kacur
  2021-08-29 19:58     ` Daniel Wagner
  1 sibling, 1 reply; 7+ messages in thread
From: John Kacur @ 2021-08-27 17:09 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Mon, 19 Jul 2021, Daniel Wagner wrote:

> pthread_getaffinity_np() prevents static builds as glibc does not
> expose it for this configuration. Instead use sched_getaffinity()
> directly as pthread_getaffinity_np() is just a fancy glibc wrapper
> around sched_getaffinity().
> 
> Static builds helps in in situation where the rootfs is minimal
> and does for example not ship libnuma.
> 
> The pthread_getaffinity_np call was introduced by commit
> f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified
> [NUM]")
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/lib/rt-numa.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
> index babcc634d57e..bb0121a65eca 100644
> --- a/src/lib/rt-numa.c
> +++ b/src/lib/rt-numa.c
> @@ -68,15 +68,13 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask)
>  int cpu_for_thread_ua(int thread_num, int max_cpus)
>  {
>  	int res, num_cpus, i, m, cpu;
> -	pthread_t thread;
>  	cpu_set_t cpuset;
>  
> -	thread = pthread_self();
>  	CPU_ZERO(&cpuset);
>  
> -	res = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
> +	res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset);
>  	if (res != 0)
> -		fatal("pthread_getaffinity_np failed: %s\n", strerror(res));
> +		fatal("sched_getaffinity failed: %s\n", strerror(res));
>  
>  	num_cpus = CPU_COUNT(&cpuset);
>  	m = thread_num % num_cpus;
> -- 
> 2.32.0
> 
> 

-Some minor fixes to the description
Signed-off-by: John Kacur <jkacur@redhat.com>


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

* Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
  2021-08-27 17:09   ` John Kacur
@ 2021-08-29 19:58     ` Daniel Wagner
  2021-08-30 12:54       ` John Kacur
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Wagner @ 2021-08-29 19:58 UTC (permalink / raw)
  To: John Kacur; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

Hi John,

On Fri, Aug 27, 2021 at 01:09:41PM -0400, John Kacur wrote:
> -Some minor fixes to the description

Thanks a lot. Do you plan to do a release soon? I'd like to update the
versions in LAVA's test-definition test suite. And it's way simpler to
base it on a released version.

Thanks,
Daniel

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

* Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
  2021-08-29 19:58     ` Daniel Wagner
@ 2021-08-30 12:54       ` John Kacur
  2021-08-30 13:10         ` Daniel Wagner
  0 siblings, 1 reply; 7+ messages in thread
From: John Kacur @ 2021-08-30 12:54 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Daniel Wagner, Clark Williams, linux-rt-users



On Sun, 29 Aug 2021, Daniel Wagner wrote:

> Hi John,
> 
> On Fri, Aug 27, 2021 at 01:09:41PM -0400, John Kacur wrote:
> > -Some minor fixes to the description
> 
> Thanks a lot. Do you plan to do a release soon? I'd like to update the
> versions in LAVA's test-definition test suite. And it's way simpler to
> base it on a released version.
> 
> Thanks,
> Daniel
> 

I hadn't planned on doing so, but I can do so if it will help you out.
I can probably get to this, this afternoon my time, or if not, then 
tomorrow.

Could you provide a link to LAVA again so I don't have to go looking for 
it.?

Thanks

John


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

* Re: [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np()
  2021-08-30 12:54       ` John Kacur
@ 2021-08-30 13:10         ` Daniel Wagner
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Wagner @ 2021-08-30 13:10 UTC (permalink / raw)
  To: John Kacur; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

Hi John,

On Mon, Aug 30, 2021 at 08:54:18AM -0400, John Kacur wrote:
> I hadn't planned on doing so, but I can do so if it will help you out.
> I can probably get to this, this afternoon my time, or if not, then 
> tomorrow.

Great. Thanks!

> Could you provide a link to LAVA again so I don't have to go looking for 
> it.?

  https://github.com/Linaro/test-definitions

and the main script for cyclictest is here:

  https://github.com/Linaro/test-definitions/tree/master/automated/linux/cyclictest

There is the 'bin' folder which contains a static build binary. I know,
this is a bit strange. I'll try to argue with upstream and see if we get
this dropped eventually. But for this update I'd like to get the JSON
output feature enabled first and not get lost in the discussion why the
static build binary should be dropped.

BTW, I've queued the JSON changes in my tree:

  https://github.com/igaw/test-definitions/tree/rt-tests-json

I think I could get this ready before Plumbers, so that we can discuss
the next steps during a MC/BoF.

Thanks,
Daniel

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

end of thread, other threads:[~2021-08-30 13:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19  8:15 [PATCH rt-tests v3 0/1] Fix a few fallouts Daniel Wagner
2021-07-19  8:15 ` [PATCH rt-tests v3 1/1] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Daniel Wagner
2021-08-27  7:31   ` Daniel Wagner
2021-08-27 17:09   ` John Kacur
2021-08-29 19:58     ` Daniel Wagner
2021-08-30 12:54       ` John Kacur
2021-08-30 13:10         ` Daniel Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.