aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/vDSO
AgeCommit message (Collapse)Author
2022-11-03selftests/vDSO: Add riscv getcpu & gettimeofday testGuo Ren
Enable vDSO getcpu & gettimeofday test for riscv. But only riscv64 supports __vdso_gettimeofday and riscv32 is under development. VERSION { LINUX_4.15 { global: __vdso_rt_sigreturn; __vdso_gettimeofday; __vdso_clock_gettime; __vdso_clock_getres; __vdso_getcpu; __vdso_flush_icache; local: *; }; } Co-developed-by: haocheng.zy <haocheng.zy@linux.alibaba.com> Signed-off-by: haocheng.zy <haocheng.zy@linux.alibaba.com> Suggested-by: Mao Han <han_mao@linux.alibaba.com> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Elliott Hughes <enh@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2022-04-04selftests/vDSO: fix array_size.cocci warningGuo Zhengkui
Fix the following coccicheck warning: tools/testing/selftests/vDSO/vdso_test_correctness.c:309:46-47: WARNING: Use ARRAY_SIZE tools/testing/selftests/vDSO/vdso_test_correctness.c:373:46-47: WARNING: Use ARRAY_SIZE It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2022-03-07nds32: Remove the architectureAlan Kao
The nds32 architecture, also known as AndeStar V3, is a custom 32-bit RISC target designed by Andes Technologies. Support was added to the kernel in 2016 as the replacement RISC-V based V5 processors were already announced, and maintained by (current or former) Andes employees. As explained by Alan Kao, new customers are now all using RISC-V, and all known nds32 users are already on longterm stable kernels provided by Andes, with no development work going into mainline support any more. While the port is still in a reasonably good shape, it only gets worse over time without active maintainers, so it seems best to remove it before it becomes unusable. As always, if it turns out that there are mainline users after all, and they volunteer to maintain the port in the future, the removal can be reverted. Link: https://lore.kernel.org/linux-mm/YhdWNLUhk+x9RAzU@yamatobi.andestech.com/ Link: https://lore.kernel.org/lkml/20220302065213.82702-1-alankao@andestech.com/ Link: https://www.andestech.com/en/products-solutions/andestar-architecture/ Signed-off-by: Alan Kao <alankao@andestech.com> [arnd: rewrite changelog to provide more background] Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2022-01-31kselftest: Fix vdso_test_abi return statusVincenzo Frascino
vdso_test_abi contains a batch of tests that verify the validity of the vDSO ABI. When a vDSO symbol is not found the relevant test is skipped reporting KSFT_SKIP. All the tests return values are then added in a single variable which is checked to verify failures. This approach can have side effects which result in reporting the wrong kselftest exit status. Fix vdso_test_abi verifying the return code of each test separately. Cc: Shuah Khan <shuah@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Reported-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2021-02-08selftests/vDSO: fix ABI selftest on riscvTobias Klauser
Only older versions of the RISC-V GCC toolchain define __riscv__. Check for __riscv as well, which is used by newer GCC toolchains. Also set VDSO_32BIT based on __riscv_xlen. Before (on riscv64): $ ./vdso_test_abi [vDSO kselftest] VDSO_VERSION: LINUX_4 Could not find __vdso_gettimeofday Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_REALTIME [PASS] Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_BOOTTIME [PASS] Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_TAI [PASS] Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_REALTIME_COARSE [PASS] Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_MONOTONIC [PASS] Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_MONOTONIC_RAW [PASS] Could not find __vdso_clock_gettime Could not find __vdso_clock_getres clock_id: CLOCK_MONOTONIC_COARSE [PASS] Could not find __vdso_time After (on riscv32): $ ./vdso_test_abi [vDSO kselftest] VDSO_VERSION: LINUX_4.15 The time is 1612449376.015086 The time is 1612449376.18340784 The resolution is 0 1 clock_id: CLOCK_REALTIME [PASS] The time is 774.842586182 The resolution is 0 1 clock_id: CLOCK_BOOTTIME [PASS] The time is 1612449376.22536565 The resolution is 0 1 clock_id: CLOCK_TAI [PASS] The time is 1612449376.20885172 The resolution is 0 4000000 clock_id: CLOCK_REALTIME_COARSE [PASS] The time is 774.845491269 The resolution is 0 1 clock_id: CLOCK_MONOTONIC [PASS] The time is 774.849534200 The resolution is 0 1 clock_id: CLOCK_MONOTONIC_RAW [PASS] The time is 774.842139684 The resolution is 0 4000000 clock_id: CLOCK_MONOTONIC_COARSE [PASS] Could not find __vdso_time Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Acked-by: Palmer Dabbelt <palmerdabbelt@google.com> Acked-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2021-01-04selftests/vDSO: fix -Wformat warning in vdso_test_correctnessTobias Klauser
Fix the following -Wformat warnings in vdso_test_correctness.c: vdso_test_correctness.c: In function ‘test_one_clock_gettime64’: vdso_test_correctness.c:352:21: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘long long int’ [-Wformat=] 352 | printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n", | ~~~~^ | | | long int | %09lld 353 | (unsigned long long)start.tv_sec, start.tv_nsec, | ~~~~~~~~~~~~~ | | | long long int vdso_test_correctness.c:352:32: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] 352 | printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n", | ~~~~^ | | | long int | %09lld 353 | (unsigned long long)start.tv_sec, start.tv_nsec, 354 | (unsigned long long)vdso.tv_sec, vdso.tv_nsec, | ~~~~~~~~~~~~ | | | long long int vdso_test_correctness.c:352:43: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘long long int’ [-Wformat=] The tv_sec member of __kernel_timespec is long long, both in uapi/linux/time_types.h and locally in vdso_test_correctness.c. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2021-01-04selftests/vDSO: add additional binaries to .gitignoreTobias Klauser
Add the test binaries introduced by commit 693f5ca08ca0 ("kselftest: Extend vDSO selftest"), commit 03f55c7952c9 ("kselftest: Extend vDSO selftest to clock_getres") and commit c7e5789b24d3 ("kselftest: Move test_vdso to the vDSO test suite") to .gitignore. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-10-27kselftest: Extend vdso correctness test to clock_gettime64Vincenzo Frascino
With the release of Linux 5.1 has been added a new syscall, clock_gettime64, that provided a 64 bit time value for a specified clock_ID to make the kernel Y2038 safe on 32 bit architectures. Extend the vdso correctness test to cover the newly exposed vdso function. Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-10-27kselftest: Move test_vdso to the vDSO test suiteVincenzo Frascino
Move test_vdso from x86 to the vDSO test suite. Suggested-by: Andy Lutomirski <luto@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-10-27kselftest: Extend vDSO selftest to clock_getresVincenzo Frascino
The current version of the multiarch vDSO selftest verifies only gettimeofday. Extend the vDSO selftest to clock_getres, to verify that the syscall and the vDSO library function return the same information. The extension has been used to verify the hrtimer_resoltion fix. Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-10-27kselftest: Extend vDSO selftestVincenzo Frascino
The current version of the multiarch vDSO selftest verifies only gettimeofday. Extend the vDSO selftest to the other library functions: - time - clock_getres - clock_gettime The extension has been used to verify the unified vdso library on the supported architectures. Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-10-27kselftest: Enable vDSO test on non x86 platformsVincenzo Frascino
Currently the vDSO tests are built only on x86 platforms and cannot be cross compiled. Enable vDSO TARGET for all the platforms. Future patches will extend the tests. Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-05-22selftests: vdso: Add a selftest for vDSO getcpu()Mark Brown
Provide a very basic selftest for getcpu() which similarly to our existing test for gettimeofday() looks up the function in the vDSO and prints the results it gets if the function exists and succeeds. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-05-22selftests: vdso: Use a header file to prototype parse_vdso APIMark Brown
Both vdso_test_gettimeofday and vdso_standalone_test_x86 use the library in parse_vdso.c but each separately declares the API it offers which is not ideal. Create a header file with prototypes of the functions and use it in both the library and the tests to ensure that the same prototypes are used throughout. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-05-22selftests: vdso: Rename vdso_test to vdso_test_gettimeofdayMark Brown
Currently the vDSO kselftests have a test called vdso_test which tests the vDSO implementation of gettimeofday(). In preparation for adding tests for other vDSO functionality rename this test to reflect what's going on. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-03-25.gitignore: add SPDX License IdentifierMasahiro Yamada
Add SPDX License Identifier to all .gitignore files. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 180Thomas Gleixner
Based on 1 normalized pattern(s): subject to the gnu general public license version 2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Steve Winslow <swinslow@gmail.com> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Armijn Hemel <armijn@tjaldur.nl> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190528170026.343113277@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-11selftests: vDSO - fix to return KSFT_SKIP when test couldn't be runShuah Khan (Samsung OSG)
Fix to return KSFT_SKIP when test couldn't be run because AT_SYSINFO_EHDR isn't found and gettimeofday isn't defined. Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-07-11selftests: vDSO - fix to exclude x86 test on non-x86 platformsShuah Khan (Samsung OSG)
Fix to exclude vdso_standalone_test_x86 test from building on non-x86 platforms. In addition, fix it to use TEST_GEN_PROGS which is the right variable to use for generated programs. TEST_PROGS is for shell scripts. Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-02-13selftest/vDSO: fix O=Dominik Brodowski
The vDSO selftests ignored the O= or KBUILD_OUTPUT= parameters. Fix it. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-11-15selftests: vdso_test: support ARM64 targetsGreg Hackmann
ARM64's vDSO exports its gettimeofday() implementation with a different name (__kernel_gettimeofday) and version (LINUX_2.6.39) from other architectures. Add a corresponding special-case to vdso_test. Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20selftests: move vDSO tests from Documentation/vDSOShuah Khan
Remove vDSO from Makefile to move the to selftests. Update vDSO Makefile to work under selftests. vDSO will not be run as part of selftests suite and will not be included in install targets. They can be built separately for now. Acked-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>