From: Benjamin Gray <bgray@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Benjamin Gray <bgray@linux.ibm.com>
Subject: [PATCH v2 2/7] selftests/powerpc: Move bind_to_cpu() to utils.h
Date: Thu, 6 Apr 2023 14:33:15 +1000 [thread overview]
Message-ID: <20230406043320.125138-3-bgray@linux.ibm.com> (raw)
In-Reply-To: <20230406043320.125138-1-bgray@linux.ibm.com>
This function will be useful in the DSCR test patches later in this
series, so promote it to be shared by all powerpc selftests.
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
---
v2: * New in v2
---
tools/testing/selftests/powerpc/include/utils.h | 1 +
tools/testing/selftests/powerpc/pmu/lib.c | 13 -------------
tools/testing/selftests/powerpc/pmu/lib.h | 1 -
tools/testing/selftests/powerpc/utils.c | 12 ++++++++++++
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h
index eed7dd7582b2..d3589e16a20f 100644
--- a/tools/testing/selftests/powerpc/include/utils.h
+++ b/tools/testing/selftests/powerpc/include/utils.h
@@ -32,6 +32,7 @@ void *find_auxv_entry(int type, char *auxv);
void *get_auxv_entry(int type);
int pick_online_cpu(void);
+int bind_to_cpu(int cpu);
int parse_intmax(const char *buffer, size_t count, intmax_t *result, int base);
int parse_uintmax(const char *buffer, size_t count, uintmax_t *result, int base);
diff --git a/tools/testing/selftests/powerpc/pmu/lib.c b/tools/testing/selftests/powerpc/pmu/lib.c
index 719f94f10d41..144f90a78d69 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.c
+++ b/tools/testing/selftests/powerpc/pmu/lib.c
@@ -14,19 +14,6 @@
#include "utils.h"
#include "lib.h"
-
-int bind_to_cpu(int cpu)
-{
- cpu_set_t mask;
-
- printf("Binding to cpu %d\n", cpu);
-
- CPU_ZERO(&mask);
- CPU_SET(cpu, &mask);
-
- return sched_setaffinity(0, sizeof(mask), &mask);
-}
-
#define PARENT_TOKEN 0xAA
#define CHILD_TOKEN 0x55
diff --git a/tools/testing/selftests/powerpc/pmu/lib.h b/tools/testing/selftests/powerpc/pmu/lib.h
index bf1bec013bbb..1d62403ae6ea 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.h
+++ b/tools/testing/selftests/powerpc/pmu/lib.h
@@ -20,7 +20,6 @@ union pipe {
int fds[2];
};
-extern int bind_to_cpu(int cpu);
extern int kill_child_and_wait(pid_t child_pid);
extern int wait_for_child(pid_t child_pid);
extern int sync_with_child(union pipe read_pipe, union pipe write_pipe);
diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c
index 7c8cfedb012a..cdb996dba703 100644
--- a/tools/testing/selftests/powerpc/utils.c
+++ b/tools/testing/selftests/powerpc/utils.c
@@ -452,6 +452,18 @@ int pick_online_cpu(void)
return cpu;
}
+int bind_to_cpu(int cpu)
+{
+ cpu_set_t mask;
+
+ printf("Binding to cpu %d\n", cpu);
+
+ CPU_ZERO(&mask);
+ CPU_SET(cpu, &mask);
+
+ return sched_setaffinity(0, sizeof(mask), &mask);
+}
+
bool is_ppc64le(void)
{
struct utsname uts;
--
2.39.2
next prev parent reply other threads:[~2023-04-06 4:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-06 4:33 [PATCH v2 0/7] Update DSCR tests Benjamin Gray
2023-04-06 4:33 ` [PATCH v2 1/7] selftests/powerpc/dscr: Correct typos Benjamin Gray
2023-04-06 4:33 ` Benjamin Gray [this message]
2023-04-06 4:33 ` [PATCH v2 3/7] selftests/powerpc: Allow bind_to_cpu() to automatically pick CPU Benjamin Gray
2023-04-06 4:33 ` [PATCH v2 4/7] selftests/powerpc/dscr: Add lockstep test cases to DSCR explicit tests Benjamin Gray
2023-04-06 4:33 ` [PATCH v2 5/7] selftests/powerpc/dscr: Improve DSCR explicit random test case Benjamin Gray
2023-04-06 4:33 ` [PATCH v2 6/7] selftests/powerpc/dscr: Speed up DSCR sysfs tests Benjamin Gray
2023-04-06 4:33 ` [PATCH v2 7/7] selftests/powerpc/dscr: Restore timeout to DSCR selftests Benjamin Gray
2023-04-26 12:01 ` [PATCH v2 0/7] Update DSCR tests Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230406043320.125138-3-bgray@linux.ibm.com \
--to=bgray@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).