trace_branch: use per-cpu counters for correct/incorrect stats
PATCH 1/1 trace_branch: use per-cpu counters for correct/incorrect stats
Replace per-task counters with per-cpu increments to avoid race conditions in the branch profiler fast path.
Fixes FIXME about atomicity.
--- kernel/trace/trace_branch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_branch.c +3 -3
@@ -213,11 +213,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,*/ trace_likely_condition (f, val, expect); -/* FIXME: Make this atomic! */ +/* use per-cpu counters to avoid contention */ if (val == expect) - f->data.correct++; +this_cpu_inc (f->data.correct);else - f->data.incorrect++; +this_cpu_inc (f->data.incorrect);user_access_restore (flags); }
Signature · 1 line
2.54.0
Quoted 16 lines · On Mon, 29 Jun 2026 16:58:38 +0700 Martin Weiss <[email protected]>…
Replace per-task counters with per-cpu increments to avoid race conditions in the branch profiler fast path.
Fixes FIXME about atomicity.
Signed-off-by Martin Weiss <[email protected]>--- kernel/trace/trace_branch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/trace/trace_branch.c +0
-0@@ -213,11 +213,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,*/
kernel/trace/trace_branch.c void ftrace_likely_update(struct ftrace_likely_data *f, int val, · line 220
Quoted 10 lines
kernel/trace/trace_branch.c +3
-3trace_likely_condition (f, val, expect); -/* FIXME: Make this atomic! */ +/* use per-cpu counters to avoid contention */ if (val == expect) - f->data.correct++; +this_cpu_inc (f->data.correct);else - f->data.incorrect++; +this_cpu_inc (f->data.incorrect);
I don't think this does what you think it does.
Did you even test this? I'm guessing it would blow up in some fantastic ways.
NAK.
-- Steve
Quoted 3 lines
kernel/trace/trace_branch.c +0
-0user_access_restore (flags); }
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Martin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v7.2-rc6 next-20260806] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Martin-Weiss/trace_branch-use-per-cpu-counters-for-correct-incorrect-stats/20260806-093445 base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next patch link: https://lore.kernel.org/r/20260629095838.601926-1-Martin.weiss2410%40gmail.com patch subject: [PATCH] trace_branch: use per-cpu counters for correct/incorrect stats config: arm64-randconfig-r062-20260806 (https://download.01.org/0day-ci/archive/20260807/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 13.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
kernel/trace/trace_branch.c: In function 'ftrace_likely_update':
>> kernel/trace/trace_branch.c:198:6: warning: infinite recursion detected [-Winfinite-recursion]
198 | void ftrace_likely_update(struct ftrace_likely_data *f, int val,
| ^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/array_size.h:5,
from include/linux/kernel.h:16,
from include/linux/kallsyms.h:11,
from kernel/trace/trace_branch.c:7:
include/linux/compiler.h:33:25: note: recursive call
33 | ftrace_likely_update(&______f, ______r, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 | expect, is_constant); \
| ~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:68:10: note: in definition of macro '__trace_if_value'
68 | (cond) ? \
| ^~~~
include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
include/linux/preempt.h:238:9: note: in expansion of macro 'if'
238 | if (unlikely(__preempt_count_dec_and_test())) \
| ^~
include/linux/compiler.h:47:26: note: in expansion of macro '__branch_check__'
47 | # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
| ^~~~~~~~~~~~~~~~
include/linux/preempt.h:238:13: note: in expansion of macro 'unlikely'
238 | if (unlikely(__preempt_count_dec_and_test())) \
| ^~~~~~~~
arch/arm64/include/asm/percpu.h:160:9: note: in expansion of macro 'preempt_enable_notrace'
160 | preempt_enable_notrace(); \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/arm64/include/asm/percpu.h:197:9: note: in expansion of macro '_pcp_protect'
197 | _pcp_protect(__percpu_add_case_64, pcp, val)
| ^~~~~~~~~~~~
include/linux/percpu-defs.h:372:25: note: in expansion of macro 'this_cpu_add_8'
372 | case 8: stem##8(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:501:41: note: in expansion of macro '__pcpu_size_call'
501 | #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val)
| ^~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:511:41: note: in expansion of macro 'this_cpu_add'
511 | #define this_cpu_inc(pcp) this_cpu_add(pcp, 1)
| ^~~~~~~~~~~~
kernel/trace/trace_branch.c:218:17: note: in expansion of macro 'this_cpu_inc'
218 | this_cpu_inc(f->data.correct);
| ^~~~~~~~~~~~
include/linux/compiler.h:33:25: note: recursive call
33 | ftrace_likely_update(&______f, ______r, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 | expect, is_constant); \
| ~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:68:10: note: in definition of macro '__trace_if_value'
68 | (cond) ? \
| ^~~~
include/linux/compiler.h:55:28: note: in expansion of macro '__trace_if_var'
55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
include/linux/preempt.h:238:9: note: in expansion of macro 'if'
238 | if (unlikely(__preempt_count_dec_and_test())) \
| ^~
include/linux/compiler.h:47:26: note: in expansion of macro '__branch_check__'
47 | # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
| ^~~~~~~~~~~~~~~~
include/linux/preempt.h:238:13: note: in expansion of macro 'unlikely'
238 | if (unlikely(__preempt_count_dec_and_test())) \
| ^~~~~~~~
arch/arm64/include/asm/percpu.h:160:9: note: in expansion of macro 'preempt_enable_notrace'
160 | preempt_enable_notrace(); \
| ^~~~~~~~~~~~~~~~~~~~~~
arch/arm64/include/asm/percpu.h:197:9: note: in expansion of macro '_pcp_protect'
197 | _pcp_protect(__percpu_add_case_64, pcp, val)
| ^~~~~~~~~~~~
include/linux/percpu-defs.h:372:25: note: in expansion of macro 'this_cpu_add_8'
372 | case 8: stem##8(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:501:41: note: in expansion of macro '__pcpu_size_call'
501 | #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val)
| ^~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:511:41: note: in expansion of macro 'this_cpu_add'
511 | #define this_cpu_inc(pcp) this_cpu_add(pcp, 1)
| ^~~~~~~~~~~~
kernel/trace/trace_branch.c:220:17: note: in expansion of macro 'this_cpu_inc'
220 | this_cpu_inc(f->data.incorrect);
| ^~~~~~~~~~~~vim +198 kernel/trace/trace_branch.c
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 197
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 @198) void ftrace_likely_update(struct ftrace_likely_data *f, int val,
d45ae1f7041ac5 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-17 199) int expect, int is_constant)
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 200 {
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 201 unsigned long flags = user_access_save();
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 202
d45ae1f7041ac5 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-17 203) /* A constant is always correct */
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 204) if (is_constant) {
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 205) f->constant++;
d45ae1f7041ac5 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-17 206) val = expect;
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 207) }
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 208 /*
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 209 * I would love to have a trace point here instead, but the
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 210 * trace point code is so inundated with unlikely and likely
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 211 * conditions that the recursive nightmare that exists is too
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 212 * much to try to get working. At least for now.
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 213 */
068f530b3f274d kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 214) trace_likely_condition(f, val, expect);
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 215
a53c1587fa9e39 kernel/trace/trace_branch.c Martin Weiss 2026-06-29 216 /* use per-cpu counters to avoid contention */
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 217 if (val == expect)
a53c1587fa9e39 kernel/trace/trace_branch.c Martin Weiss 2026-06-29 218 this_cpu_inc(f->data.correct);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 219 else
a53c1587fa9e39 kernel/trace/trace_branch.c Martin Weiss 2026-06-29 220 this_cpu_inc(f->data.incorrect);
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 221
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 222 user_access_restore(flags);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 223 }
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 224 EXPORT_SYMBOL(ftrace_likely_update);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 225 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Martin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v7.2-rc6 next-20260806] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Martin-Weiss/trace_branch-use-per-cpu-counters-for-correct-incorrect-stats/20260806-093445 base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next patch link: https://lore.kernel.org/r/20260629095838.601926-1-Martin.weiss2410%40gmail.com patch subject: [PATCH] trace_branch: use per-cpu counters for correct/incorrect stats config: um-randconfig-r123-20260806 (https://download.01.org/0day-ci/archive/20260807/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> kernel/trace/trace_branch.c:218:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@ kernel/trace/trace_branch.c:218:17: sparse: expected void const [noderef] __percpu *__vpp_verify kernel/trace/trace_branch.c:218:17: sparse: got unsigned long * >> kernel/trace/trace_branch.c:218:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@ kernel/trace/trace_branch.c:218:17: sparse: expected void const [noderef] __percpu *__vpp_verify kernel/trace/trace_branch.c:218:17: sparse: got unsigned long * >> kernel/trace/trace_branch.c:218:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@ kernel/trace/trace_branch.c:218:17: sparse: expected void const [noderef] __percpu *__vpp_verify kernel/trace/trace_branch.c:218:17: sparse: got unsigned long * >> kernel/trace/trace_branch.c:218:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@ kernel/trace/trace_branch.c:218:17: sparse: expected void const [noderef] __percpu *__vpp_verify kernel/trace/trace_branch.c:218:17: sparse: got unsigned long * >> kernel/trace/trace_branch.c:218:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
kernel/trace/trace_branch.c:218:17: sparse: expected void const [noderef] __percpu *__vpp_verify
kernel/trace/trace_branch.c:218:17: sparse: got unsigned long *
kernel/trace/trace_branch.c:220:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
kernel/trace/trace_branch.c:220:17: sparse: expected void const [noderef] __percpu *__vpp_verify
kernel/trace/trace_branch.c:220:17: sparse: got unsigned long *
kernel/trace/trace_branch.c:220:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
kernel/trace/trace_branch.c:220:17: sparse: expected void const [noderef] __percpu *__vpp_verify
kernel/trace/trace_branch.c:220:17: sparse: got unsigned long *
kernel/trace/trace_branch.c:220:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
kernel/trace/trace_branch.c:220:17: sparse: expected void const [noderef] __percpu *__vpp_verify
kernel/trace/trace_branch.c:220:17: sparse: got unsigned long *
kernel/trace/trace_branch.c:220:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
kernel/trace/trace_branch.c:220:17: sparse: expected void const [noderef] __percpu *__vpp_verify
kernel/trace/trace_branch.c:220:17: sparse: got unsigned long *
kernel/trace/trace_branch.c:220:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
kernel/trace/trace_branch.c:220:17: sparse: expected void const [noderef] __percpu *__vpp_verify
kernel/trace/trace_branch.c:220:17: sparse: got unsigned long *
vim +218 kernel/trace/trace_branch.c
197
198 void ftrace_likely_update(struct ftrace_likely_data *f, int val,
199 int expect, int is_constant)
200 {
201 unsigned long flags = user_access_save();
202
203 /* A constant is always correct */
204 if (is_constant) {
205 f->constant++;
206 val = expect;
207 }
208 /*
209 * I would love to have a trace point here instead, but the
210 * trace point code is so inundated with unlikely and likely
211 * conditions that the recursive nightmare that exists is too
212 * much to try to get working. At least for now.
213 */
214 trace_likely_condition(f, val, expect);
215
216 /* use per-cpu counters to avoid contention */
217 if (val == expect)
> 218 this_cpu_inc(f->data.correct);
219 else
220 this_cpu_inc(f->data.incorrect);
221
222 user_access_restore(flags);
223 }
224 EXPORT_SYMBOL(ftrace_likely_update);
225
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Martin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v7.2-rc6 next-20260806] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Martin-Weiss/trace_branch-use-per-cpu-counters-for-correct-incorrect-stats/20260806-093445 base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next patch link: https://lore.kernel.org/r/20260629095838.601926-1-Martin.weiss2410%40gmail.com patch subject: [PATCH] trace_branch: use per-cpu counters for correct/incorrect stats config: hexagon-randconfig-002-20260807 (https://download.01.org/0day-ci/archive/20260807/[email protected]/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 12df34b8469b8095359de8c249cb1b2753fadeea) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260807/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> kernel/trace/trace_branch.c:200:1: warning: all paths through this function will call itself [-Winfinite-recursion]
200 | {
| ^1 warning generated.
vim +200 kernel/trace/trace_branch.c
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 197
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 198) void ftrace_likely_update(struct ftrace_likely_data *f, int val,
d45ae1f7041ac5 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-17 199) int expect, int is_constant)
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 @200 {
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 201 unsigned long flags = user_access_save();
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 202
d45ae1f7041ac5 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-17 203) /* A constant is always correct */
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 204) if (is_constant) {
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 205) f->constant++;
d45ae1f7041ac5 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-17 206) val = expect;
134e6a034cb004 kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 207) }
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 208 /*
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 209 * I would love to have a trace point here instead, but the
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 210 * trace point code is so inundated with unlikely and likely
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 211 * conditions that the recursive nightmare that exists is too
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 212 * much to try to get working. At least for now.
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 213 */
068f530b3f274d kernel/trace/trace_branch.c Steven Rostedt (VMware 2017-01-19 214) trace_likely_condition(f, val, expect);
52f232cb720a7b kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 215
a53c1587fa9e39 kernel/trace/trace_branch.c Martin Weiss 2026-06-29 216 /* use per-cpu counters to avoid contention */
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 217 if (val == expect)
a53c1587fa9e39 kernel/trace/trace_branch.c Martin Weiss 2026-06-29 218 this_cpu_inc(f->data.correct);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 219 else
a53c1587fa9e39 kernel/trace/trace_branch.c Martin Weiss 2026-06-29 220 this_cpu_inc(f->data.incorrect);
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 221
4a6c91fbdef846 kernel/trace/trace_branch.c Peter Zijlstra 2019-03-07 222 user_access_restore(flags);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 223 }
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 224 EXPORT_SYMBOL(ftrace_likely_update);
1f0d69a9fc815d kernel/trace/trace_unlikely.c Steven Rostedt 2008-11-12 225 --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki