Skip to content

Commit 7c27b25

Browse files
brooniegregkh
authored andcommitted
kselftest/arm64: Log fp-stress child startup errors to stdout
[ Upstream commit dca93d2 ] Currently if we encounter an error between fork() and exec() of a child process we log the error to stderr. This means that the errors don't get annotated with the child information which makes diagnostics harder and means that if we miss the exit signal from the child we can deadlock waiting for output from the child. Improve robustness and output quality by logging to stdout instead. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6100505 commit 7c27b25

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tools/testing/selftests/arm64/fp/fp-stress.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static void child_start(struct child_data *child, const char *program)
7979
*/
8080
ret = dup2(pipefd[1], 1);
8181
if (ret == -1) {
82-
fprintf(stderr, "dup2() %d\n", errno);
82+
printf("dup2() %d\n", errno);
8383
exit(EXIT_FAILURE);
8484
}
8585

@@ -89,7 +89,7 @@ static void child_start(struct child_data *child, const char *program)
8989
*/
9090
ret = dup2(startup_pipe[0], 3);
9191
if (ret == -1) {
92-
fprintf(stderr, "dup2() %d\n", errno);
92+
printf("dup2() %d\n", errno);
9393
exit(EXIT_FAILURE);
9494
}
9595

@@ -107,16 +107,15 @@ static void child_start(struct child_data *child, const char *program)
107107
*/
108108
ret = read(3, &i, sizeof(i));
109109
if (ret < 0)
110-
fprintf(stderr, "read(startp pipe) failed: %s (%d)\n",
111-
strerror(errno), errno);
110+
printf("read(startp pipe) failed: %s (%d)\n",
111+
strerror(errno), errno);
112112
if (ret > 0)
113-
fprintf(stderr, "%d bytes of data on startup pipe\n",
114-
ret);
113+
printf("%d bytes of data on startup pipe\n", ret);
115114
close(3);
116115

117116
ret = execl(program, program, NULL);
118-
fprintf(stderr, "execl(%s) failed: %d (%s)\n",
119-
program, errno, strerror(errno));
117+
printf("execl(%s) failed: %d (%s)\n",
118+
program, errno, strerror(errno));
120119

121120
exit(EXIT_FAILURE);
122121
} else {

0 commit comments

Comments
 (0)