Message ID | 20210719081505.520-2-dwagner@suse.de |
---|---|
State | New |
Headers | show |
Series | Fix a few fallouts | expand |
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
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>
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
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
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
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;
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(-)