Skip to contentSkip to conversation

selftest: Add futex functional tests

GIT PULL Superseded Darren Hart 5 participants 28 messages May 8, 2015 – May 13, 2015

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

Hi Shuah,

This series begins the process of migrating my futextest tests into kselftest. I've started with only the functional tests, as the performance and stress may not be appropriate for kselftest as they stand.

I cleaned up various complaints from checkpatch, but I ignored others that would require significant rework of the testcases, such as not using volatile and not creating new typedefs.

Since v1:
Avoid checkpatch errors on 1/5 by:
- combining a later patch which did substantial cleanup.
- removing file-local typedefs and replacing with structs
- correcting all >80 char lines, except for quoted strings and header boiler plate due to long email addresses

I did *not* make changes for the following:
- Use of new typdefs for types futex_t and atomic_t as they are used throughout the test suite and I consider them to be worth while.
- Use of volatile as the warning is about use of volatile in kernel code. The usage in futextest is correct, as an indicator that other threads may modify the value.
- Adding parentheses around complex defines as it would break one use case and change the behavior of another.

The patches will follow, but I'm providing a pull request for your convenience as well.

The following changes since commit b787f68c36d49bb1d9236f403813641efa74a031:

Linux 4.1-rc1 (2015-04-26 17:59:10 -0700)

are available in the git repository at:

git://git.infradead.org/users/dvhart/linux.git futextest-v2

Darren Hart (5):
selftests: Add futex functional tests selftest/futex: Update Makefile to use lib.mk selftest/futex: Increment ksft pass and fail counters
selftest: Add futex tests to the top-level Makefile
kselftest: Add exit code defines

 tools/testing/selftests/Makefile                   |   1 +
 tools/testing/selftests/futex/Makefile             |  29 ++
 tools/testing/selftests/futex/README               |  62 ++++
 tools/testing/selftests/futex/functional/Makefile  |  25 ++
 .../selftests/futex/functional/futex_requeue_pi.c  | 409 +++++++++++++++++++++
 .../functional/futex_requeue_pi_mismatched_ops.c   | 135 +++++++
 .../functional/futex_requeue_pi_signal_restart.c   | 223 +++++++++++
 .../functional/futex_wait_private_mapped_file.c    | 125 +++++++
 .../futex/functional/futex_wait_timeout.c          |  86 +++++
 .../functional/futex_wait_uninitialized_heap.c     | 124 +++++++
 .../futex/functional/futex_wait_wouldblock.c       |  79 ++++
 tools/testing/selftests/futex/functional/run.sh    |  80 ++++
 tools/testing/selftests/futex/include/atomic.h     |  83 +++++
 tools/testing/selftests/futex/include/futextest.h  | 266 ++++++++++++++
 tools/testing/selftests/futex/include/logging.h    | 153 ++++++++
 tools/testing/selftests/futex/run.sh               |  33 ++
 tools/testing/selftests/kselftest.h                |  17 +-
 17 files changed, 1925 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/futex/Makefile
 create mode 100644 tools/testing/selftests/futex/README
 create mode 100644 tools/testing/selftests/futex/functional/Makefile
 create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_timeout.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
 create mode 100755 tools/testing/selftests/futex/functional/run.sh
 create mode 100644 tools/testing/selftests/futex/include/atomic.h
 create mode 100644 tools/testing/selftests/futex/include/futextest.h
 create mode 100644 tools/testing/selftests/futex/include/logging.h
 create mode 100755 tools/testing/selftests/futex/run.sh
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/5 selftests: Add futex functional tests

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests, but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
---
 tools/testing/selftests/futex/Makefile             |  11 +
 tools/testing/selftests/futex/README               |  62 ++++
 tools/testing/selftests/futex/functional/Makefile  |  24 ++
 .../selftests/futex/functional/futex_requeue_pi.c  | 409 +++++++++++++++++++++
 .../functional/futex_requeue_pi_mismatched_ops.c   | 135 +++++++
 .../functional/futex_requeue_pi_signal_restart.c   | 223 +++++++++++
 .../functional/futex_wait_private_mapped_file.c    | 125 +++++++
 .../futex/functional/futex_wait_timeout.c          |  86 +++++
 .../functional/futex_wait_uninitialized_heap.c     | 124 +++++++
 .../futex/functional/futex_wait_wouldblock.c       |  79 ++++
 tools/testing/selftests/futex/functional/run.sh    |  80 ++++
 tools/testing/selftests/futex/include/atomic.h     |  83 +++++
 tools/testing/selftests/futex/include/futextest.h  | 266 ++++++++++++++
 tools/testing/selftests/futex/include/logging.h    | 150 ++++++++
 tools/testing/selftests/futex/run.sh               |  33 ++
 15 files changed, 1890 insertions(+)
 create mode 100644 tools/testing/selftests/futex/Makefile
 create mode 100644 tools/testing/selftests/futex/README
 create mode 100644 tools/testing/selftests/futex/functional/Makefile
 create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_timeout.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
 create mode 100644 tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
 create mode 100755 tools/testing/selftests/futex/functional/run.sh
 create mode 100644 tools/testing/selftests/futex/include/atomic.h
 create mode 100644 tools/testing/selftests/futex/include/futextest.h
 create mode 100644 tools/testing/selftests/futex/include/logging.h
 create mode 100755 tools/testing/selftests/futex/run.sh
tools/testing/selftests/futex/Makefile new file +11 -0
new file mode 100644
index 0000000..2c26d59
@@ -0,0 +1,11 @@
+SUBDIRS := functional
+
+.PHONY: all clean
+all:
+	for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+
+run_tests: all
+	./run.sh
+
+clean:
+	for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
tools/testing/selftests/futex/README new file +62 -0

62 lines not on this page · raw message

tools/testing/selftests/futex/functional/Makefile new file +24 -0
new file mode 100644
index 0000000..4098340
@@ -0,0 +1,24 @@
+INCLUDES := -I../include
+CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)
+LDFLAGS := $(LDFLAGS) -lpthread -lrt
+
+HEADERS := ../include/futextest.h
+TARGETS := \
+	futex_wait_timeout \
+	futex_wait_wouldblock \
+	futex_requeue_pi \
+	futex_requeue_pi_signal_restart \
+	futex_requeue_pi_mismatched_ops \
+	futex_wait_uninitialized_heap \
+	futex_wait_private_mapped_file
+
+.PHONY: all clean
+all: $(TARGETS)
+
+$(TARGETS): $(HEADERS)
+
+run_tests: all
+	./run.sh
+
+clean:
+	rm -f $(TARGETS)
tools/testing/selftests/futex/functional/futex_requeue_pi.c new file +409 -0

409 lines not on this page · raw message

tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c new file +135 -0

135 lines not on this page · raw message

tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c new file +223 -0

223 lines not on this page · raw message

tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c new file +125 -0

125 lines not on this page · raw message

tools/testing/selftests/futex/functional/futex_wait_timeout.c new file +86 -0

86 lines not on this page · raw message

tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c new file +124 -0

124 lines not on this page · raw message

tools/testing/selftests/futex/functional/futex_wait_wouldblock.c new file +79 -0

79 lines not on this page · raw message

tools/testing/selftests/futex/functional/run.sh new file +80 -0

80 lines not on this page · raw message

tools/testing/selftests/futex/include/atomic.h new file +83 -0

83 lines not on this page · raw message

tools/testing/selftests/futex/include/futextest.h new file +266 -0

266 lines not on this page · raw message

tools/testing/selftests/futex/include/logging.h new file +150 -0

150 lines not on this page · raw message

tools/testing/selftests/futex/run.sh new file +33 -0
new file mode 100755
index 0000000..4126312
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+###############################################################################
+#
+#   Copyright © International Business Machines  Corp., 2009
+#
+#   This program is free software;  you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+# DESCRIPTION
+#      Run all tests under the functional, performance, and stress directories.
+#      Format and summarize the results.
+#
+# AUTHOR
+#      Darren Hart <[email protected]>
+#
+# HISTORY
+#      2009-Nov-9: Initial version by Darren Hart <[email protected]>
+#
+###############################################################################
+
+# Test for a color capable shell and pass the result to the subdir scripts
+USE_COLOR=0
+tput setf 7
+if [ $? -eq 0 ]; then
+    USE_COLOR=1
+    tput sgr0
+fi
+export USE_COLOR
+
+(cd functional; ./run.sh)
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/5 selftest/futex: Update Makefile to use lib.mk

Adapt the futextest Makefiles to use lib.mk macros for RUN_TESTS and EMIT_TESTS. For now, we reuse the run.sh mechanism provided by futextest. This doesn't provide the standard selftests: [PASS|FAIL] format, but the tests provide very similar output already.

This results in the run_kselftest.sh script for futexes including a single line: ./run.sh

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
---
 tools/testing/selftests/futex/Makefile            | 20 +++++++++++++++++++-
 tools/testing/selftests/futex/functional/Makefile |  5 +++--
 2 files changed, 22 insertions(+), 3 deletions(-)
tools/testing/selftests/futex/Makefile +19 -1
index 2c26d59..6a17529 100644
@@ -1,11 +1,29 @@
 SUBDIRS := functional
 
+TEST_PROGS := run.sh
+
 .PHONY: all clean
 all:
 	for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 
-run_tests: all
+include ../lib.mk
+
+override define RUN_TESTS
 	./run.sh
+endef
+
+override define INSTALL_RULE
+	mkdir -p $(INSTALL_PATH)
+	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
+
+	@for SUBDIR in $(SUBDIRS); do \
+		$(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
+	done;
+endef
+
+override define EMIT_TESTS
+	echo "./run.sh"
+endef
 
 clean:
 	for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
tools/testing/selftests/futex/functional/Makefile +3 -2
index 4098340..fb96927 100644
@@ -12,13 +12,14 @@ TARGETS := \
 	futex_wait_uninitialized_heap \
 	futex_wait_private_mapped_file
 
+TEST_PROGS := $(TARGETS) run.sh
+
 .PHONY: all clean
 all: $(TARGETS)
 
 $(TARGETS): $(HEADERS)
 
-run_tests: all
-	./run.sh
+include ../../lib.mk
 
 clean:
 	rm -f $(TARGETS)
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/5 selftest/futex: Increment ksft pass and fail counters

In reply to Darren Hart

Add kselftest.h to logging.h and increment the pass and fail counters as part of the print_result routine which is called by all futex tests.

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
---
 tools/testing/selftests/futex/functional/Makefile | 2 +-
 tools/testing/selftests/futex/include/logging.h   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/futex/functional/Makefile +1 -1
index fb96927..e64d43b 100644
@@ -1,4 +1,4 @@
-INCLUDES := -I../include
+INCLUDES := -I../include -I../../
 CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)
 LDFLAGS := $(LDFLAGS) -lpthread -lrt
 
tools/testing/selftests/futex/include/logging.h +3 -0
index f6ed5c2..014aa01 100644
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <linux/futex.h>
+#include "kselftest.h"
 
 /*
  * Define PASS, ERROR, and FAIL strings with and without color escape
@@ -111,12 +112,14 @@ void print_result(int ret)
 
 	switch (ret) {
 	case RET_PASS:
+		ksft_inc_pass_cnt();
 		result = PASS;
 		break;
 	case RET_ERROR:
 		result = ERROR;
 		break;
 	case RET_FAIL:
+		ksft_inc_fail_cnt();
 		result = FAIL;
 		break;
 	}
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/5 selftest: Add futex tests to the top-level Makefile

In reply to Darren Hart

Enable futex tests to be built and run with the make kselftest and associated targets.

Most of the tests require escalated privileges. These return ERROR, and run.sh continues.

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
---
 tools/testing/selftests/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
index 95abddc..ebac6b8 100644
@@ -4,6 +4,7 @@ TARGETS += efivarfs
 TARGETS += exec
 TARGETS += firmware
 TARGETS += ftrace
+TARGETS += futex
 TARGETS += kcmp
 TARGETS += memfd
 TARGETS += memory-hotplug
Signature · 1 line
2.1.4
#5 lore raw

PATCH 5/5 kselftest: Add exit code defines

In reply to Darren Hart

Define the exit codes with KSFT_PASS and similar so tests can use these directly if they choose. Also enable harnesses and other tooling to use the defines instead of hardcoding the return codes.

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
---
 tools/testing/selftests/kselftest.h | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
tools/testing/selftests/kselftest.h +12 -5
index 572c888..ef1c80d 100644
@@ -13,6 +13,13 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+/* define kselftest exit codes */
+#define KSFT_PASS  0
+#define KSFT_FAIL  1
+#define KSFT_XFAIL 2
+#define KSFT_XPASS 3
+#define KSFT_SKIP  4
+
 /* counters */
 struct ksft_count {
 	unsigned int ksft_pass;
@@ -40,23 +47,23 @@ static inline void ksft_print_cnts(void)
 
 static inline int ksft_exit_pass(void)
 {
-	exit(0);
+	exit(KSFT_PASS);
 }
 static inline int ksft_exit_fail(void)
 {
-	exit(1);
+	exit(KSFT_FAIL);
 }
 static inline int ksft_exit_xfail(void)
 {
-	exit(2);
+	exit(KSFT_XFAIL);
 }
 static inline int ksft_exit_xpass(void)
 {
-	exit(3);
+	exit(KSFT_XPASS);
 }
 static inline int ksft_exit_skip(void)
 {
-	exit(4);
+	exit(KSFT_SKIP);
 }
 
 #endif /* __KSELFTEST_H */
Signature · 1 line
2.1.4
#6 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

In reply to Darren Hart
Quoted 29 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests, but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#7 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 32 lines · Shuah Khan
Quoted 29 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests, but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII text
0001-selftests-Add-futex-functional-tests.patch:                 unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:         unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch: unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:   unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:                      unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of © in the kernel itself, so this should not present a problem.

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to fix my scripts to avoid the issue in the future.

If you want to use the patches directly, please have a look at 1 of 5 and just remove the "Content..." header, and I think you'll find "git am" will apply it without complaint.

Thanks,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#8 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 73 lines · Darren Hart
Quoted 32 lines · Shuah Khan
Quoted 29 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests, but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII text
0001-selftests-Add-futex-functional-tests.patch:                 unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:         unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch: unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:   unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:                      unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of © in the kernel itself, so this should not present a problem.

Quoted 8 lines

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to fix my scripts to avoid the issue in the future.

If you want to use the patches directly, please have a look at 1 of 5 and just remove the "Content..." header, and I think you'll find "git am" will apply it without complaint.

Hi Daren,

Removing the Content header got me past the utf error. However, git am complains:

git am --signoff ../4.2_patches/futex_tests/PATCH_1_5selftestsAddfutexfunctionaltests.mbox
Applying: selftests: Add futex functional tests /mnt/data/lkml/linux-kselftest/.git/rebase-apply/patch:1457: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Could you look into these. Rest of the patches applied fine.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#9 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 106 lines · Shuah Khan
Quoted 85 lines · Darren Hart
Quoted 36 lines · Shuah Khan
Quoted 33 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of
more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests, but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference
to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII
text
0001-selftests-Add-futex-functional-tests.patch:                 unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:         unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch: unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:   unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:                      unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume
this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of
© in the kernel itself, so this should not present a problem.

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to
fix my scripts to avoid the issue in the future.

Quoted 6 lines

If you want to use the patches directly, please have a look at 1 of 5 and
just remove the "Content..." header, and I think you'll find "git am" will
apply it without complaint.

Hi Daren,

Removing the Content header got me past the utf error. However, git am complains:

git am --signoff ../4.2_patches/futex_tests/PATCH_1_5selftestsAddfutexfunctionaltests.mbox
Applying: selftests: Add futex functional tests /mnt/data/lkml/linux-kselftest/.git/rebase-apply/patch:1457: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Quoted 1 line

Could you look into these. Rest of the patches applied fine.

Hi Shuah,

This was due to a newline at the end of:
tools/testing/selftests/futex/functional/run.sh

Which unfortunately checkpatch.pl doesn't catch. My fault for not applying the series from the generated patches first. Sorry for the hassle.

I have corrected this in the first patch and pushed v3 of the series to:

git://git.infradead.org/users/dvhart/linux.git futextest-v3

$ git diff infradead/futextest-v2 infradead/futextest-v3
(quoted diff) +0 -0

b/tools/testing/selftests/futex/functional/run.sh
index 46827a8..e87dbe2 100755

tools/testing/selftests/futex/functional/run.sh +0 -1
@@ -77,4 +77,3 @@ echo
 echo
 ./futex_wait_uninitialized_heap $COLOR
 ./futex_wait_private_mapped_file $COLOR
-

Is this sufficient or do would you prefer a new pull request?

Thanks,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#10 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 132 lines · Darren Hart
Quoted 106 lines · Shuah Khan
Quoted 85 lines · Darren Hart
Quoted 36 lines · Shuah Khan
Quoted 33 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be of
more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests, but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference
to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII
text
0001-selftests-Add-futex-functional-tests.patch:                 unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:         unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch: unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:   unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:                      unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume
this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of
© in the kernel itself, so this should not present a problem.

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to
fix my scripts to avoid the issue in the future.

Quoted 6 lines

If you want to use the patches directly, please have a look at 1 of 5 and
just remove the "Content..." header, and I think you'll find "git am" will
apply it without complaint.

Hi Daren,

Removing the Content header got me past the utf error. However, git am complains:

git am --signoff ../4.2_patches/futex_tests/PATCH_1_5selftestsAddfutexfunctionaltests.mbox
Applying: selftests: Add futex functional tests /mnt/data/lkml/linux-kselftest/.git/rebase-apply/patch:1457: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Quoted 1 line

Could you look into these. Rest of the patches applied fine.

Hi Shuah,

This was due to a newline at the end of:
tools/testing/selftests/futex/functional/run.sh

Which unfortunately checkpatch.pl doesn't catch. My fault for not applying the series from the generated patches first. Sorry for the hassle.

I have corrected this in the first patch and pushed v3 of the series to:

git://git.infradead.org/users/dvhart/linux.git futextest-v3

$ git diff infradead/futextest-v2 infradead/futextest-v3
tools/testing/selftests/futex/functional/run.sh +0 -0
index 46827a8..e87dbe2 100755

tools/testing/selftests/futex/functional/run.sh echo · line 80

Quoted 4 lines
tools/testing/selftests/futex/functional/run.sh +0 -1
@@ -77,4 +77,3 @@ echo
 echo
 ./futex_wait_uninitialized_heap $COLOR
 ./futex_wait_private_mapped_file $COLOR
-

No need for a new pull request. Have you seen these errors before:

make[2]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex'
for DIR in functional; do make -C $DIR all ; done
make[3]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional'
gcc -g -O2 -Wall -D_GNU_SOURCE -I../include -I../../ -lpthread -lrt
futex_requeue_pi.c ../include/futextest.h -o futex_requeue_pi
/tmp/cc2UgUVs.o: In function `create_rt_thread':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/futex_requeue_pi.c:102:
undefined reference to `pthread_create'
/tmp/cc2UgUVs.o: In function `unit_test':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/futex_requeue_pi.c:342:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/futex_requeue_pi.c:347:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/futex_requeue_pi.c:346:
undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'futex_requeue_pi' failed
make[3]: *** [futex_requeue_pi] Error 1
make[3]: Leaving directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional' Makefile:7: recipe for target 'all' failed

I am running make kselftest target when I saw the above build failures. kselftest run doesn't fail which is good, however futex tests won't run with this failure.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#11 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 180 lines · Shuah Khan
Quoted 144 lines · Darren Hart
Quoted 117 lines · Shuah Khan
Quoted 94 lines · Darren Hart
Quoted 38 lines · Shuah Khan
Quoted 35 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be
of
more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests,
but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference
to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I
dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git
send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII
text
0001-selftests-Add-futex-functional-tests.patch:
unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:
unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch:
unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:
unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:
unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume
this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of
© in the kernel itself, so this should not present a problem.

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to
fix my scripts to avoid the issue in the future.

Quoted 6 lines

If you want to use the patches directly, please have a look at 1 of 5 and
just remove the "Content..." header, and I think you'll find "git am" will
apply it without complaint.

Hi Daren,

Removing the Content header got me past the utf error. However, git am complains:

git am --signoff

../4.2_patches/futex_tests/PATCH_1_5selftestsAddfutexfunctionaltests.mbo x
Applying: selftests: Add futex functional tests /mnt/data/lkml/linux-kselftest/.git/rebase-apply/patch:1457: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Quoted 1 line

Could you look into these. Rest of the patches applied fine.

Hi Shuah,

This was due to a newline at the end of:
tools/testing/selftests/futex/functional/run.sh

Which unfortunately checkpatch.pl doesn't catch. My fault for not applying
the series from the generated patches first. Sorry for the hassle.

I have corrected this in the first patch and pushed v3 of the series to:

git://git.infradead.org/users/dvhart/linux.git futextest-v3

$ git diff infradead/futextest-v2 infradead/futextest-v3
tools/testing/selftests/futex/functional/run.sh +0 -0
index 46827a8..e87dbe2 100755

tools/testing/selftests/futex/functional/run.sh echo · line 80

Quoted 4 lines
tools/testing/selftests/futex/functional/run.sh +0 -1
@@ -77,4 +77,3 @@ echo
 echo
 ./futex_wait_uninitialized_heap $COLOR
 ./futex_wait_private_mapped_file $COLOR
-

No need for a new pull request. Have you seen these errors before:

make[2]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex' for DIR in functional; do make -C $DIR all ; done
make[3]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional'
gcc -g -O2 -Wall -D_GNU_SOURCE -I../include -I../../ -lpthread -lrt
futex_requeue_pi.c ../include/futextest.h -o futex_requeue_pi
/tmp/cc2UgUVs.o: In function `create_rt_thread':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:102:
undefined reference to `pthread_create'
/tmp/cc2UgUVs.o: In function `unit_test':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:342:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:347:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:346:
undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'futex_requeue_pi' failed make[3]: *** [futex_requeue_pi] Error 1
make[3]: Leaving directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional' Makefile:7: recipe for target 'all' failed

Quoted 3 lines

I am running make kselftest target when I saw the above build failures. kselftest run doesn't fail which is good, however futex tests won't run with this failure.

I have not seen these errors whilst developing with futextest for the kernel. That looks like you may be missing the pthread development headers from your build machine.

Those are provided by libc6-dev on my Debian systems.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#12 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 186 lines · Darren Hart
Quoted 180 lines · Shuah Khan
Quoted 144 lines · Darren Hart
Quoted 117 lines · Shuah Khan
Quoted 94 lines · Darren Hart
Quoted 38 lines · Shuah Khan
Quoted 35 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be
of
more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests,
but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference
to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I
dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git
send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII
text
0001-selftests-Add-futex-functional-tests.patch:
unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:
unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch:
unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:
unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:
unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume
this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of
© in the kernel itself, so this should not present a problem.

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to
fix my scripts to avoid the issue in the future.

Quoted 6 lines

If you want to use the patches directly, please have a look at 1 of 5 and
just remove the "Content..." header, and I think you'll find "git am" will
apply it without complaint.

Hi Daren,

Removing the Content header got me past the utf error. However, git am complains:

git am --signoff

../4.2_patches/futex_tests/PATCH_1_5selftestsAddfutexfunctionaltests.mbo x
Applying: selftests: Add futex functional tests /mnt/data/lkml/linux-kselftest/.git/rebase-apply/patch:1457: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Quoted 1 line

Could you look into these. Rest of the patches applied fine.

Hi Shuah,

This was due to a newline at the end of:
tools/testing/selftests/futex/functional/run.sh

Which unfortunately checkpatch.pl doesn't catch. My fault for not applying
the series from the generated patches first. Sorry for the hassle.

I have corrected this in the first patch and pushed v3 of the series to:

git://git.infradead.org/users/dvhart/linux.git futextest-v3

$ git diff infradead/futextest-v2 infradead/futextest-v3
tools/testing/selftests/futex/functional/run.sh +0 -0
index 46827a8..e87dbe2 100755

tools/testing/selftests/futex/functional/run.sh echo · line 80

Quoted 4 lines
tools/testing/selftests/futex/functional/run.sh +0 -1
@@ -77,4 +77,3 @@ echo
 echo
 ./futex_wait_uninitialized_heap $COLOR
 ./futex_wait_private_mapped_file $COLOR
-

No need for a new pull request. Have you seen these errors before:

make[2]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex' for DIR in functional; do make -C $DIR all ; done
make[3]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional'
gcc -g -O2 -Wall -D_GNU_SOURCE -I../include -I../../ -lpthread -lrt
futex_requeue_pi.c ../include/futextest.h -o futex_requeue_pi
/tmp/cc2UgUVs.o: In function `create_rt_thread':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:102:
undefined reference to `pthread_create'
/tmp/cc2UgUVs.o: In function `unit_test':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:342:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:347:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:346:
undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'futex_requeue_pi' failed make[3]: *** [futex_requeue_pi] Error 1
make[3]: Leaving directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional' Makefile:7: recipe for target 'all' failed

Quoted 3 lines

I am running make kselftest target when I saw the above build failures. kselftest run doesn't fail which is good, however futex tests won't run with this failure.

Quoted 6 lines

I have not seen these errors whilst developing with futextest for the kernel. That looks like you may be missing the pthread development headers from your build machine.

Those are provided by libc6-dev on my Debian systems.

I do have lib6-dev installed. timers uses pthread compiles fine. So does mqueue. I am not sure what is going on with futex tests though. I am guessing it has to do with library link order.

The following fixed it for me:

-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt

Could you please make this change and resend the patch series. I prefer patch series over pull request.

thanks,
-- Shuah

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#13 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 203 lines · Shuah Khan
Quoted 186 lines · Darren Hart
Quoted 180 lines · Shuah Khan
Quoted 144 lines · Darren Hart
Quoted 117 lines · Shuah Khan
Quoted 94 lines · Darren Hart
Quoted 38 lines · Shuah Khan
Quoted 35 lines · Darren Hart

The futextest testsuite [1] provides functional, stress, and performance tests for the various futex op codes. Those tests will be
of
more use to futex developers if they are included with the kernel source.

Copy the core infrastructure and the functional tests into selftests,
but adapt them for inclusion in the kernel:

- Update the Makefile to include the run_tests target, remove reference
to the performance and stress tests from the contributed sources.
- Replace my dead IBM email address with my current Intel email address.
- Remove the warrantee and write-to paragraphs from the license blurbs.
- Remove the NAME section as the filename is easily determined. ;-)
- Make the whitespace usage consistent in a couple of places.
- Cleanup various CodingStyle violations.

A future effort will explore moving the performance and stress tests into the kernel.

1. http://git.kernel.org/cgit/linux/kernel/git/dvhart/futextest.git

Cc Shuah Khan <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Quoted 1 line

---

Quoted 7 lines

Daren,

I am seeing

fatal: cannot convert from y to UTF-8

when I try to apply the patch. Did you use git send-email?

Hi Shuah,

I've seen that from one of my contributors earlier this month as well. I
dropped the Content... Header and it applied without problems.

I created the patch using git format-patch and then sent them using git
send-email - via a script I've been using for years now...

Checking the files locally:

$ file *
0000-cover-letter.patch:                                         ASCII
text
0001-selftests-Add-futex-functional-tests.patch:
unified
diff output, UTF-8 Unicode text
0002-selftest-futex-Update-Makefile-to-use-lib.mk.patch:
unified
diff output, ASCII text
0003-selftest-futex-Increment-ksft-pass-and-fail-counters.patch:
unified
diff output, ASCII text
0004-selftest-Add-futex-tests-to-the-top-level-Makefile.patch:
unified
diff output, ASCII text
0005-kselftest-Add-exit-code-defines.patch:
unified
diff output, ASCII text

This shows that only the first in UTF-8 and the rest are ASCII. I presume
this is due to the Copyright notices in the original files:

Copyright © International Business Machines Corp., 2006-2008

Which use © instead of (C). I just checked and there are 545 instances of
© in the kernel itself, so this should not present a problem.

I apologize for the glitch in applying. If you use the pull request I included that will avoid the mail transport issues, and I will be sure to
fix my scripts to avoid the issue in the future.

Quoted 6 lines

If you want to use the patches directly, please have a look at 1 of 5 and
just remove the "Content..." header, and I think you'll find "git am" will
apply it without complaint.

Hi Daren,

Removing the Content header got me past the utf error. However, git am complains:

git am --signoff

../4.2_patches/futex_tests/PATCH_1_5selftestsAddfutexfunctionaltests.mbo x
Applying: selftests: Add futex functional tests /mnt/data/lkml/linux-kselftest/.git/rebase-apply/patch:1457: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Quoted 1 line

Could you look into these. Rest of the patches applied fine.

Hi Shuah,

This was due to a newline at the end of:
tools/testing/selftests/futex/functional/run.sh

Which unfortunately checkpatch.pl doesn't catch. My fault for not applying
the series from the generated patches first. Sorry for the hassle.

I have corrected this in the first patch and pushed v3 of the series to:

git://git.infradead.org/users/dvhart/linux.git futextest-v3

$ git diff infradead/futextest-v2 infradead/futextest-v3
tools/testing/selftests/futex/functional/run.sh +0 -0
index 46827a8..e87dbe2 100755

tools/testing/selftests/futex/functional/run.sh echo · line 80

Quoted 4 lines
tools/testing/selftests/futex/functional/run.sh +0 -1
@@ -77,4 +77,3 @@ echo
 echo
 ./futex_wait_uninitialized_heap $COLOR
 ./futex_wait_private_mapped_file $COLOR
-

No need for a new pull request. Have you seen these errors before:

make[2]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex' for DIR in functional; do make -C $DIR all ; done
make[3]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional'
gcc -g -O2 -Wall -D_GNU_SOURCE -I../include -I../../ -lpthread -lrt
futex_requeue_pi.c ../include/futextest.h -o futex_requeue_pi
/tmp/cc2UgUVs.o: In function `create_rt_thread':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:102:
undefined reference to `pthread_create'
/tmp/cc2UgUVs.o: In function `unit_test':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:342:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:347:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional/fu tex_requeue_pi.c:346:
undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'futex_requeue_pi' failed make[3]: *** [futex_requeue_pi] Error 1
make[3]: Leaving directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional' Makefile:7: recipe for target 'all' failed

Quoted 3 lines

I am running make kselftest target when I saw the above build failures. kselftest run doesn't fail which is good, however futex tests won't run with this failure.

Quoted 6 lines

I have not seen these errors whilst developing with futextest for the kernel. That looks like you may be missing the pthread development headers from your build machine.

Those are provided by libc6-dev on my Debian systems.

I do have lib6-dev installed. timers uses pthread compiles fine. So does mqueue. I am not sure what is going on with futex tests though. I am guessing it has to do with library link order.

The following fixed it for me:

(quoted diff) +1 -1
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt
Quoted 6 lines

Could you please make this change and resend the patch series. I prefer patch series over pull request.

thanks,
-- Shuah

Sorry full diff:

(quoted diff) +0 -0

b/tools/testing/selftests/futex/functional/Makefile index e64d43b..b8a2e9b 100644

tools/testing/selftests/futex/functional/Makefile +1 -2
@@ -1,6 +1,6 @@
 INCLUDES := -I../include -I../../
 CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt
 
 
-- Shuah
Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#14 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 69 lines · Shuah Khan
Quoted 53 lines
Quoted 40 lines
Quoted 36 lines

No need for a new pull request. Have you seen these errors before:

make[2]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex' for DIR in functional; do make -C $DIR all ; done
make[3]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functiona l'
gcc -g -O2 -Wall -D_GNU_SOURCE -I../include -I../../ -lpthread -lrt
futex_requeue_pi.c ../include/futextest.h -o futex_requeue_pi
/tmp/cc2UgUVs.o: In function `create_rt_thread':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:102:
undefined reference to `pthread_create'
/tmp/cc2UgUVs.o: In function `unit_test':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:342:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:347:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:346:
undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'futex_requeue_pi' failed make[3]: *** [futex_requeue_pi] Error 1
make[3]: Leaving directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functiona l'
Makefile:7: recipe for target 'all' failed

Quoted 3 lines

I am running make kselftest target when I saw the above build failures. kselftest run doesn't fail which is good, however futex tests won't run with this failure.

Quoted 7 lines

I have not seen these errors whilst developing with futextest for the kernel. That looks like you may be missing the pthread development headers
from your build machine.

Those are provided by libc6-dev on my Debian systems.

I do have lib6-dev installed. timers uses pthread compiles fine. So does mqueue. I am not sure what is going on with futex tests though. I am guessing it has to do with library link order. The following fixed it for me:

tools/testing/selftests/futex/functional/Makefile +1 -1
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt
Quoted 4 lines

Could you please make this change and resend the patch series. I prefer patch series over pull request.
thanks,
-- Shuah

Sorry full diff:

tools/testing/selftests/futex/functional/Makefile +0 -0
index e64d43b..b8a2e9b 100644
@@ -1,6 +1,6 @@

INCLUDES := -I../include -I../../
CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)

tools/testing/selftests/futex/functional/Makefile line 3

Quoted 2 lines
tools/testing/selftests/futex/functional/Makefile +1 -1
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt

I'm happy to do that, but I would like to make sure I'm doing the right thing.

I'm building with:

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2

What's there now works for me:

	LDFLAGS := $(LDFLAGS) -lpthread -lrt

What you propose also works for me:

	LDFLAGS := $(LDFLAGS) -pthread -lrt

I notice that most other test cases list -lrt first, including timers:

	LDFLAGS += -lrt -lpthread

Which works for me for timers - does that work for you? I assume so. It also works for futexes for me. I've found references out there suggesting -lrt should always come before -lpthread.

I suspect you are correct as -pthread provides flags for both the preprocessor and the linker, however, I'm still concerned about the ordering.

John - did you deliberately choose to use "-lrt -lpthread" ?

If ordering matters and -pthread is preferred over -lpthread, then perhaps the "right way" is:

LDFLAGS += -lrt -pthread

Since -pthread also impacts the pre-processor, it seems that if used, it should be present in both LDFLAGS as well as CFLAGS. However, I've also read that -pthread is a non-standard compiler option and is best avoided.

If so, and if the reversed order works for you, "-lrt -lpthread", perhaps that would be the "right fix".

I'd like to answer this once and for all for all tests we add to selftest.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#15 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 98 lines · Darren Hart
Quoted 69 lines · Shuah Khan
Quoted 53 lines
Quoted 40 lines
Quoted 36 lines

No need for a new pull request. Have you seen these errors before:

make[2]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex' for DIR in functional; do make -C $DIR all ; done
make[3]: Entering directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functiona l'
gcc -g -O2 -Wall -D_GNU_SOURCE -I../include -I../../ -lpthread -lrt
futex_requeue_pi.c ../include/futextest.h -o futex_requeue_pi
/tmp/cc2UgUVs.o: In function `create_rt_thread':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:102:
undefined reference to `pthread_create'
/tmp/cc2UgUVs.o: In function `unit_test':
/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:342:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:347:
undefined reference to `pthread_join' /mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functional /fu
tex_requeue_pi.c:346:
undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'futex_requeue_pi' failed make[3]: *** [futex_requeue_pi] Error 1
make[3]: Leaving directory '/mnt/data/lkml/linux-kselftest/tools/testing/selftests/futex/functiona l'
Makefile:7: recipe for target 'all' failed

Quoted 3 lines

I am running make kselftest target when I saw the above build failures. kselftest run doesn't fail which is good, however futex tests won't run with this failure.

Quoted 7 lines

I have not seen these errors whilst developing with futextest for the kernel. That looks like you may be missing the pthread development headers
from your build machine.

Those are provided by libc6-dev on my Debian systems.

I do have lib6-dev installed. timers uses pthread compiles fine. So does mqueue. I am not sure what is going on with futex tests though. I am guessing it has to do with library link order. The following fixed it for me:

tools/testing/selftests/futex/functional/Makefile +1 -1
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt
Quoted 4 lines

Could you please make this change and resend the patch series. I prefer patch series over pull request.
thanks,
-- Shuah

Sorry full diff:

tools/testing/selftests/futex/functional/Makefile +0 -0
index e64d43b..b8a2e9b 100644
@@ -1,6 +1,6 @@

INCLUDES := -I../include -I../../
CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)

tools/testing/selftests/futex/functional/Makefile line 3

Quoted 2 lines
tools/testing/selftests/futex/functional/Makefile +1 -1
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+LDFLAGS := $(LDFLAGS) -pthread -lrt

I'm happy to do that, but I would like to make sure I'm doing the right thing.

I'm building with:

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2

What's there now works for me:

        LDFLAGS := $(LDFLAGS) -lpthread -lrt

What you propose also works for me:

        LDFLAGS := $(LDFLAGS) -pthread -lrt

I notice that most other test cases list -lrt first, including timers:

        LDFLAGS += -lrt -lpthread

Which works for me for timers - does that work for you? I assume so. It also works for futexes for me. I've found references out there suggesting -lrt should always come before -lpthread.

Quoted 5 lines

I suspect you are correct as -pthread provides flags for both the preprocessor and the linker, however, I'm still concerned about the ordering.

John - did you deliberately choose to use "-lrt -lpthread" ?

Ooof. Possibly, but I can't say I really recall at this point.

I do remember somewhere around gcc 4.6 I had to change things around since the linker arguments had to be at the end of the gcc string (where as before I was throwing them in w/ the CFLAGS). I think it was then I added the "-Wl,-no-as-needed" bit after googling around. You might look at that as well?

Sorry I'm not of much help.
-john

#16 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

In reply to Darren Hart

Hi!

Quoted 2 lines

I'm happy to do that, but I would like to make sure I'm doing the right thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Signature · 2 lines
Cyril Hrubis
[email protected]
#17 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 6 lines · Cyril Hrubis

Hi!

Quoted 2 lines

I'm happy to do that, but I would like to make sure I'm doing the right thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Unfortunately, all these options are functional for me, while some are not for Shuah, so I'm currently having to rely on documentation which seems pretty sparse.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#18 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 16 lines · Darren Hart
Quoted 6 lines · Cyril Hrubis

Hi!

Quoted 2 lines

I'm happy to do that, but I would like to make sure I'm doing the right thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

Quoted 9 lines

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Unfortunately, all these options are functional for me, while some are not for Shuah, so I'm currently having to rely on documentation which seems pretty sparse.

Hi Daren,

My goals are really simple. make kselftest doesn't break. All tests compile and run and install or fail gracefully when dependencies aren't met. As long as the above are met, I don't really worry about what individual test Makefiles do.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
reviewer
#19 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 27 lines · Shuah Khan
Quoted 16 lines · Darren Hart
Quoted 6 lines · Cyril Hrubis

Hi!

Quoted 2 lines

I'm happy to do that, but I would like to make sure I'm doing the right thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

Quoted 9 lines

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Unfortunately, all these options are functional for me, while some are not for Shuah, so I'm currently having to rely on documentation which seems pretty sparse.

Quoted 6 lines

Hi Daren,

My goals are really simple. make kselftest doesn't break. All tests compile and run and install or fail gracefully when dependencies aren't met. As long as the above are met, I don't really worry about what individual test Makefiles do.

Understood. Given the variability across distros/compiler versions, the "doesn't break" part isn't as straight forward as it should be. I could fix this so it builds for you and me, but I'm trying to build confidence that I'm doing this "correctly" so it doesn't break in other scenarios - since I'm not seeing any breakage on my systems.

Shuah, which distro and compiler version are you seeing the build failure on? I'd like to at least reproduce that so I can be confident my next version will at least build in your environment.

Currently, the only direction I have is gcc man page and Cyril's advocacy for -pthread. Does the following work for you (it still does for me)?

Quoted 1 line

From 0b7284551d6419520d5ce8833e177ba5b8be2286 Mon Sep 17 00:00:00 2001

Message-Id: <0b7284551d6419520d5ce8833e177ba5b8be2286.1431449782.git.dvhart-VuQAYsv1563Yd54FQh9/[email protected]>
From: Darren Hart <dvhart-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Tue, 12 May 2015 09:54:39 -0700
Subject: [PATCH] selftests/futex: Add -pthread to CFLAGS and LDFLAGS

Certain environments fail to build with the "-lpthread -lrt" LDFLAGS. Using "-pthread" instead of "-lpthread" resolves this and is the documented mechanism in the gcc man page.

---
 tools/testing/selftests/futex/functional/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/futex/functional/Makefile +2 -2
index e64d43b..9d6b75e 100644
@@ -1,6 +1,6 @@
 INCLUDES := -I../include -I../../
-CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES)
+LDFLAGS := $(LDFLAGS) -pthread -lrt
 
 HEADERS := ../include/futextest.h
 TARGETS := \
Signature · 6 lines
2.1.4


-- 
Darren Hart
Intel Open Source Technology Center
#20 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 70 lines · Darren Hart
Quoted 27 lines · Shuah Khan
Quoted 16 lines · Darren Hart
Quoted 6 lines · Cyril Hrubis

Hi!

Quoted 2 lines

I'm happy to do that, but I would like to make sure I'm doing the right thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

Quoted 9 lines

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Unfortunately, all these options are functional for me, while some are not for Shuah, so I'm currently having to rely on documentation which seems pretty sparse.

Quoted 6 lines

Hi Daren,

My goals are really simple. make kselftest doesn't break. All tests compile and run and install or fail gracefully when dependencies aren't met. As long as the above are met, I don't really worry about what individual test Makefiles do.

Understood. Given the variability across distros/compiler versions, the "doesn't break" part isn't as straight forward as it should be. I could fix this so it builds for you and me, but I'm trying to build confidence that I'm doing this "correctly" so it doesn't break in other scenarios - since I'm not seeing any breakage on my systems.

Shuah, which distro and compiler version are you seeing the build failure on? I'd like to at least reproduce that so I can be confident my next version will at least build in your environment.

Currently, the only direction I have is gcc man page and Cyril's advocacy for -pthread. Does the following work for you (it still does for me)?

Quoted 1 line

From 0b7284551d6419520d5ce8833e177ba5b8be2286 Mon Sep 17 00:00:00 2001

Message-Id: <0b7284551d6419520d5ce8833e177ba5b8be2286.1431449782.git.dvhart-VuQAYsv1563Yd54FQh9/[email protected]>
From: Darren Hart <dvhart-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Tue, 12 May 2015 09:54:39 -0700
Subject: [PATCH] selftests/futex: Add -pthread to CFLAGS and LDFLAGS

Certain environments fail to build with the "-lpthread -lrt" LDFLAGS. Using "-pthread" instead of "-lpthread" resolves this and is the documented mechanism in the gcc man page.

---
 tools/testing/selftests/futex/functional/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/futex/functional/Makefile +0 -0
index e64d43b..9d6b75e 100644

tools/testing/selftests/futex/functional/Makefile line 6

Quoted 8 lines
tools/testing/selftests/futex/functional/Makefile +2 -2
@@ -1,6 +1,6 @@
 INCLUDES := -I../include -I../../
-CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE $(INCLUDES)
-LDFLAGS := $(LDFLAGS) -lpthread -lrt
+CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES)
+LDFLAGS := $(LDFLAGS) -pthread -lrt
 
 HEADERS := ../include/futextest.h
 TARGETS := \

Daren,

The above worked on my system. I have gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13) on mine just in case you need that info.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#21 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

In reply to Darren Hart

Hi!

Quoted 13 lines
Quoted 5 lines
Quoted 2 lines

I'm happy to do that, but I would like to make sure I'm doing the right thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

Quoted 4 lines

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using
cc -pthread."

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

The portable way i.e. POSIX would be getting compiler flags with getconf but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Signature · 2 lines
Cyril Hrubis
[email protected]
#22 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 29 lines · Cyril Hrubis

Hi!

Quoted 15 lines
Quoted 1 line
Quoted 1 line

I'm happy to do that, but I would like to make sure I'm doing the

right

Quoted 4 lines
Quoted 1 line

thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the
CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

Quoted 4 lines

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using cc -pthread."

Quoted 7 lines

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

The portable way i.e. POSIX would be getting compiler flags with getconf but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Thanks Cyril, that's perfect.

I'll roll my latest example patch adding -pthread to LDFLAGS and CFLAGS into the initial patch and resubmit the patch series as v4.

Thanks all.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#23 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 35 lines · Darren Hart
Quoted 33 lines · Cyril Hrubis

Hi!

Quoted 15 lines
Quoted 1 line
Quoted 1 line

I'm happy to do that, but I would like to make sure I'm doing the

right

Quoted 4 lines
Quoted 1 line

thing.

The right thing here is to add -pthread to CFLAGS which sets both flags for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the
CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to add more?

Quoted 4 lines

I'm also struggling to find any kind of prescribed documentation on this beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using cc -pthread."

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

Quoted 9 lines
Quoted 3 lines

The portable way i.e. POSIX would be getting compiler flags with getconf but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Thanks Cyril, that's perfect.

I'll roll my latest example patch adding -pthread to LDFLAGS and CFLAGS into the initial patch and resubmit the patch series as v4.

Daren,

While you are generating new version, could you also please add .gitignore for the futex binaries, so they get ignored by git.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#24 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 46 lines · Shuah Khan
Quoted 45 lines · Darren Hart
Quoted 32 lines · Cyril Hrubis

Hi!

Quoted 17 lines
Quoted 1 line
Quoted 1 line

I'm happy to do that, but I would like to make sure I'm doing the

right

Quoted 5 lines
Quoted 1 line

thing.

The right thing here is to add -pthread to CFLAGS which sets both flags
for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the
CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to
add more?

Quoted 5 lines

I'm also struggling to find any kind of prescribed documentation on this
beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using cc -pthread."

Quoted 8 lines

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

The portable way i.e. POSIX would be getting compiler flags with getconf
but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Thanks Cyril, that's perfect.

Quoted 8 lines
Quoted 3 lines

I'll roll my latest example patch adding -pthread to LDFLAGS and CFLAGS into the initial patch and resubmit the patch series as v4.

Daren,

While you are generating new version, could you also please add .gitignore for the futex binaries, so they get ignored by git.

Will do.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#25 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 52 lines · Darren Hart
Quoted 50 lines · Shuah Khan
Quoted 48 lines · Darren Hart
Quoted 32 lines · Cyril Hrubis

Hi!

Quoted 17 lines
Quoted 1 line
Quoted 1 line

I'm happy to do that, but I would like to make sure I'm doing the

right

Quoted 5 lines
Quoted 1 line

thing.

The right thing here is to add -pthread to CFLAGS which sets both flags
for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the
CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to
add more?

Quoted 5 lines

I'm also struggling to find any kind of prescribed documentation on this
beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using cc -pthread."

Quoted 8 lines

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

The portable way i.e. POSIX would be getting compiler flags with getconf
but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Thanks Cyril, that's perfect.

I'll roll my latest example patch adding -pthread to LDFLAGS and CFLAGS into the initial patch and resubmit the patch series as v4.

Quoted 7 lines
Quoted 4 lines

Daren,

While you are generating new version, could you also please add .gitignore for the futex binaries, so they get ignored by git.

Will do.

Daren,

Do you plan to add futex test install support in a later patch series? When you sent this patch series, install support was work in progress. 4.1 has the kselftest install feature.

Feel free to defer it for a later patch series if you like. Would be good to get the futex install support into 4.2 if it is possible.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#26 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 61 lines · Shuah Khan
Quoted 52 lines · Darren Hart
Quoted 50 lines · Shuah Khan
Quoted 48 lines · Darren Hart
Quoted 32 lines · Cyril Hrubis

Hi!

Quoted 17 lines
Quoted 1 line
Quoted 1 line

I'm happy to do that, but I would like to make sure I'm doing the

right

Quoted 5 lines
Quoted 1 line

thing.

The right thing here is to add -pthread to CFLAGS which sets both flags
for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the
CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to
add more?

Quoted 5 lines

I'm also struggling to find any kind of prescribed documentation on this
beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using cc -pthread."

Quoted 8 lines

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

The portable way i.e. POSIX would be getting compiler flags with getconf
but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Thanks Cyril, that's perfect.

I'll roll my latest example patch adding -pthread to LDFLAGS and CFLAGS into the initial patch and resubmit the patch series as v4.

Quoted 7 lines
Quoted 4 lines

Daren,

While you are generating new version, could you also please add .gitignore for the futex binaries, so they get ignored by git.

Will do.

Quoted 9 lines

Daren,

Do you plan to add futex test install support in a later patch series? When you sent this patch series, install support was work in progress. 4.1 has the kselftest install feature.

Feel free to defer it for a later patch series if you like. Would be good to get the futex install support into 4.2 if it is possible.

I am blind. Never mind. futex tests are installed.

-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
reviewer
#27 lore raw

Re: [PATCH 1/5] selftests: Add futex functional tests

Quoted 68 lines · Shuah Khan
Quoted 67 lines · Shuah Khan
Quoted 52 lines · Darren Hart
Quoted 50 lines · Shuah Khan
Quoted 48 lines · Darren Hart
Quoted 32 lines · Cyril Hrubis

Hi!

Quoted 17 lines
Quoted 1 line
Quoted 1 line

I'm happy to do that, but I would like to make sure I'm doing the

right

Quoted 5 lines
Quoted 1 line

thing.

The right thing here is to add -pthread to CFLAGS which sets both flags
for preprocessor and linker (see man gcc).

Hi Cyril,

Thanks. I read that, and mentioned it, but my concern with -pthread in the
CFLAGS and LDFLAGS is that it is a non-standard compiler flag. I understand we have a number of gcc-isms in our build - but do we want to
add more?

Quoted 5 lines

I'm also struggling to find any kind of prescribed documentation on this
beyond the short blurb in the gcc man page which describes what this option does, but not when to use it. I'll need something concrete to justify changes to testcase Makefiles to Shuah.

Sorry to mislead you with the pointing at gcc man page.

It is a Linux standard. Have a look at pthreads manual page:
http://man7.org/linux/man-pages/man7/pthreads.7.html

"On Linux, programs that use the Pthreads API should be compiled using cc -pthread."

Quoted 8 lines

Or any pthread_foo() manual page that starts with:

"Compile and link with -pthread."

The portable way i.e. POSIX would be getting compiler flags with getconf
but as this is a Linux kernel testsuite I would not bother with that. Hmm, and it looks like this is not implemented on Linux anyway.

Thanks Cyril, that's perfect.

I'll roll my latest example patch adding -pthread to LDFLAGS and CFLAGS into the initial patch and resubmit the patch series as v4.

Quoted 7 lines
Quoted 4 lines

Daren,

While you are generating new version, could you also please add .gitignore for the futex binaries, so they get ignored by git.

Will do.

Daren,

Do you plan to add futex test install support in a later patch series? When you sent this patch series, install support was work in progress. 4.1 has the kselftest install feature.

Quoted 5 lines
Quoted 3 lines

Feel free to defer it for a later patch series if you like. Would be good to get the futex install support into 4.2 if it is possible.

I am blind. Never mind. futex tests are installed.

Oh good - I just reviewed my patches and could swear it was all there!

I'll add the .gitignore now and roll out v4 with all the cleanups and pthread linker fixes.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center