v4:
* Add patches and 1 and 2, to make q_lock mandatory,
in other words, require output and capture locks to match.
* Add WARN_ON if the lock is not held in v4l2_m2m_try_schedule,
and also document the requirement.
* Add a comment explaining why the job is scheduled.
This series goal is to avoid drivers from having ad-hoc code
to call .device_run in non-atomic context. Currently, .device_run
can be called via v4l2_m2m_job_finish(), potentially running
in interrupt context.
This series will be useful for the upcoming Request API, where drivers
typically require .device_run to be called in non-atomic context for
v4l2_ctrl_request_setup() calls.
The solution is to add a per-device worker that is scheduled
by v4l2_m2m_job_finish, which replaces drivers having a threaded interrupt
or similar.
This change allows v4l2_m2m_job_finish() to be called in interrupt
context, separating .device_run and v4l2_m2m_job_finish() contexts.
It's worth mentioning that v4l2_m2m_cancel_job() doesn't need
to flush or cancel the new worker, because the job_spinlock
synchronizes both and also because the core prevents simultaneous
jobs. Either v4l2_m2m_cancel_job() will wait for the worker, or the
worker will be unable to run a new job.
Testing
-------
In order to test the change, and make sure no regressions are
introduced, a kselftest test is added to stress the mem2mem framework.
Note that this series rework the kselftest media_tests target.
Those tests that need hardware and human intervention are now
marked as _EXTENDED, and a frontend script is added to run those
tests that can run without hardware or human intervention.
This will allow the media_tests target to be included in
automatic regression testing setups.
Hopefully, we will be able to introduce more and more automatic
regression tests. Currently, our self-test run looks like:
$ make TARGETS=media_tests kselftest
make[1]: Entering directory '/home/zeta/repos/builds/virtme-x86_64'
make[3]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[3]: Nothing to be done for 'all'.
make[3]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
TAP version 13
selftests: media_tests: m2m_job_test.sh
========================================
-------------------
running media tests
-------------------
media_device : no video4linux drivers loaded, vim2m is needed
not ok 1..1 selftests: media_tests: m2m_job_test.sh [SKIP]
make[1]: Leaving directory '/home/zeta/repos/builds/virtme-x86_64'
Ezequiel Garcia (5):
mem2mem: Require capture and output mutexes to match
v4l2-ioctl.c: simplify locking for m2m devices
v4l2-mem2mem: Avoid v4l2_m2m_prepare_buf from scheduling a job
v4l2-mem2mem: Avoid calling .device_run in v4l2_m2m_job_finish
selftests: media_tests: Add a memory-to-memory concurrent stress test
Sakari Ailus (1):
v4l2-mem2mem: Simplify exiting the function in __v4l2_m2m_try_schedule
drivers/media/v4l2-core/v4l2-ioctl.c | 47 +--
drivers/media/v4l2-core/v4l2-mem2mem.c | 94 ++++--
.../testing/selftests/media_tests/.gitignore | 1 +
tools/testing/selftests/media_tests/Makefile | 5 +-
.../selftests/media_tests/m2m_job_test.c | 287 ++++++++++++++++++
.../selftests/media_tests/m2m_job_test.sh | 32 ++
6 files changed, 389 insertions(+), 77 deletions(-)
create mode 100644 tools/testing/selftests/media_tests/m2m_job_test.c
create mode 100755 tools/testing/selftests/media_tests/m2m_job_test.sh
--
2.18.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello,
This version of the series is unchanged from v2 except for the last patch
which is completely new, and is provided by Mike Rapoport.
Original series description:
> A tester ran the upstream selftest on a distro kernel and sounded the
> alarm when it reported failures for features which aren't included in
> that kernel.
>
> This patch set improves the test behavior in that scenario.
Changes since v2:
- Added Mike Rapoport's Reviewed-by's and Acked-by's to patches 1-3.
- Replaced patch 4/4 by the one provided by Mike Rapoport.
Changes since v1:
- Patch "userfaultfd: selftest: Skip test if userfaultfd() syscall
not supported"
- New patch, suggested by Mike Rapoport.
- Patch "userfaultfd: selftest: Skip test if a feature isn't supported"
- Try running other tests even if one (or more) of them returns KSFT_SKIP.
- Patch "userfaultfd: selftest: Cope if shmem doesn't support zeropage"
- Ignore lack of UFFDIO_ZEROPAGE in userfaultfd_events_test() and
userfaultfd_stress().
- Make userfaultfd_zeropage_test() return KSFT_SKIP if UFFDIO_ZEROPAGE
isn't supported.
Mike Rapoport (1):
userfaultfd: selftest: make supported range ioctl verification more
robust
Thiago Jung Bauermann (3):
userfaultfd: selftest: Fix checking of userfaultfd_open() result
userfaultfd: selftest: Skip test if userfaultfd() syscall not
supported
userfaultfd: selftest: Skip test if a feature isn't supported
tools/testing/selftests/vm/userfaultfd.c | 113 +++++++++++++++++++------------
1 file changed, 69 insertions(+), 44 deletions(-)
Hello,
A tester ran the upstream selftest on a distro kernel and sounded the alarm when
it reported failures for features which aren't included in that kernel.
This patch set improves the test behavior in that scenario.
Changes since v1:
- Patch "userfaultfd: selftest: Skip test if userfaultfd() syscall
not supported"
- New patch, suggested by Mke Rapoport.
- Patch "userfaultfd: selftest: Skip test if a feature isn't supported"
- Try running other tests even if one (or more) of them returns KSFT_SKIP.
- Patch "userfaultfd: selftest: Cope if shmem doesn't support zeropage"
- Ignore lack of UFFDIO_ZEROPAGE in userfaultfd_events_test() and
userfaultfd_stress().
- Make userfaultfd_zeropage_test() return KSFT_SKIP if UFFDIO_ZEROPAGE
isn't supported.
Thiago Jung Bauermann (4):
userfaultfd: selftest: Fix checking of userfaultfd_open() result
userfaultfd: selftest: Skip test if userfaultfd() syscall not
supported
userfaultfd: selftest: Skip test if a feature isn't supported
userfaultfd: selftest: Cope if shmem doesn't support zeropage
tools/testing/selftests/vm/userfaultfd.c | 86 ++++++++++++++++++++++++--------
1 file changed, 66 insertions(+), 20 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Makes membarrier_test compatible with older kernels (LTS) by checking if
the membarrier features exist before running the tests.
Link: https://bugs.linaro.org/show_bug.cgi?id=3771
Signed-off-by: Rafael David Tinoco <rafael.tinoco(a)linaro.org>
Cc: <stable(a)vger.kernel.org> #v4.17
---
.../selftests/membarrier/membarrier_test.c | 69 +++++++++++--------
1 file changed, 41 insertions(+), 28 deletions(-)
diff --git a/tools/testing/selftests/membarrier/membarrier_test.c b/tools/testing/selftests/membarrier/membarrier_test.c
index 6793f8ecc8e7..b96caa096e2f 100644
--- a/tools/testing/selftests/membarrier/membarrier_test.c
+++ b/tools/testing/selftests/membarrier/membarrier_test.c
@@ -225,7 +225,14 @@ static int test_membarrier_global_expedited_success(void)
static int test_membarrier(void)
{
- int status;
+ int supported, status;
+
+ supported = sys_membarrier(MEMBARRIER_CMD_QUERY, 0);
+ if (supported < 0) {
+ ksft_test_result_fail(
+ "sys_membarrier() failed to query supported cmds\n");
+ return supported;
+ }
status = test_membarrier_cmd_fail();
if (status)
@@ -236,21 +243,22 @@ static int test_membarrier(void)
status = test_membarrier_global_success();
if (status)
return status;
- status = test_membarrier_private_expedited_fail();
- if (status)
- return status;
- status = test_membarrier_register_private_expedited_success();
- if (status)
- return status;
- status = test_membarrier_private_expedited_success();
- if (status)
- return status;
- status = sys_membarrier(MEMBARRIER_CMD_QUERY, 0);
- if (status < 0) {
- ksft_test_result_fail("sys_membarrier() failed\n");
- return status;
+
+ /* commit 22e4ebb975822833b083533035233d128b30e98f added this feature */
+ if (supported & MEMBARRIER_CMD_PRIVATE_EXPEDITED) {
+ status = test_membarrier_private_expedited_fail();
+ if (status)
+ return status;
+ status = test_membarrier_register_private_expedited_success();
+ if (status)
+ return status;
+ status = test_membarrier_private_expedited_success();
+ if (status)
+ return status;
}
- if (status & MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) {
+
+ /* commit 70216e18e519a54a2f13569e8caff99a092a92d6 added this feature */
+ if (supported & MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) {
status = test_membarrier_private_expedited_sync_core_fail();
if (status)
return status;
@@ -261,19 +269,24 @@ static int test_membarrier(void)
if (status)
return status;
}
- /*
- * It is valid to send a global membarrier from a non-registered
- * process.
- */
- status = test_membarrier_global_expedited_success();
- if (status)
- return status;
- status = test_membarrier_register_global_expedited_success();
- if (status)
- return status;
- status = test_membarrier_global_expedited_success();
- if (status)
- return status;
+
+ /* commit c5f58bd58f432be5d92df33c5458e0bcbee3aadf added this feature */
+ if (supported & MEMBARRIER_CMD_GLOBAL_EXPEDITED) {
+ /*
+ * It is valid to send a global membarrier from a non-registered
+ * process.
+ */
+ status = test_membarrier_global_expedited_success();
+ if (status)
+ return status;
+ status = test_membarrier_register_global_expedited_success();
+ if (status)
+ return status;
+ status = test_membarrier_global_expedited_success();
+ if (status)
+ return status;
+ }
+
return 0;
}
--
2.18.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Commit 3c07aaef6598 ("selftests: kselftest: change KSFT_SKIP=4 instead of
KSFT_PASS") reverted commit 11867a77eb85 ("selftests: kselftest framework:
change skip exit code to 0") but missed removing the comment which that
commit added, so do that now.
Signed-off-by: Thiago Jung Bauermann <bauerman(a)linux.ibm.com>
---
tools/testing/selftests/kselftest.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 15e6b75fc3a5..a3edb2c8e43d 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -19,7 +19,6 @@
#define KSFT_FAIL 1
#define KSFT_XFAIL 2
#define KSFT_XPASS 3
-/* Treat skip as pass */
#define KSFT_SKIP 4
/* counters */
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
'make kselftest-merge' assumes that the config files for the tests are
located under the 'main' test dir, like tools/testing/selftests/android/
and not in a subdir to android.
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
tools/testing/selftests/android/{ion => }/config | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename tools/testing/selftests/android/{ion => }/config (100%)
diff --git a/tools/testing/selftests/android/ion/config b/tools/testing/selftests/android/config
similarity index 100%
rename from tools/testing/selftests/android/ion/config
rename to tools/testing/selftests/android/config
--
2.11.0