Skip to content

Commit 4700ccd

Browse files
melverpaulmckrcu
authored andcommitted
kcsan: Remove debugfs test command
Remove the debugfs test command, as it is no longer needed now that we have the KUnit+Torture based kcsan-test module. This is to avoid confusion around how KCSAN should be tested, as only the kcsan-test module is maintained. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent a4e74fa commit 4700ccd

1 file changed

Lines changed: 0 additions & 66 deletions

File tree

kernel/kcsan/debugfs.c

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -98,66 +98,6 @@ static noinline void microbenchmark(unsigned long iters)
9898
current->kcsan_ctx = ctx_save;
9999
}
100100

101-
/*
102-
* Simple test to create conflicting accesses. Write 'test=<iters>' to KCSAN's
103-
* debugfs file from multiple tasks to generate real conflicts and show reports.
104-
*/
105-
static long test_dummy;
106-
static long test_flags;
107-
static long test_scoped;
108-
static noinline void test_thread(unsigned long iters)
109-
{
110-
const long CHANGE_BITS = 0xff00ff00ff00ff00L;
111-
const struct kcsan_ctx ctx_save = current->kcsan_ctx;
112-
cycles_t cycles;
113-
114-
/* We may have been called from an atomic region; reset context. */
115-
memset(&current->kcsan_ctx, 0, sizeof(current->kcsan_ctx));
116-
117-
pr_info("KCSAN: %s begin | iters: %lu\n", __func__, iters);
118-
pr_info("test_dummy@%px, test_flags@%px, test_scoped@%px,\n",
119-
&test_dummy, &test_flags, &test_scoped);
120-
121-
cycles = get_cycles();
122-
while (iters--) {
123-
/* These all should generate reports. */
124-
__kcsan_check_read(&test_dummy, sizeof(test_dummy));
125-
ASSERT_EXCLUSIVE_WRITER(test_dummy);
126-
ASSERT_EXCLUSIVE_ACCESS(test_dummy);
127-
128-
ASSERT_EXCLUSIVE_BITS(test_flags, ~CHANGE_BITS); /* no report */
129-
__kcsan_check_read(&test_flags, sizeof(test_flags)); /* no report */
130-
131-
ASSERT_EXCLUSIVE_BITS(test_flags, CHANGE_BITS); /* report */
132-
__kcsan_check_read(&test_flags, sizeof(test_flags)); /* no report */
133-
134-
/* not actually instrumented */
135-
WRITE_ONCE(test_dummy, iters); /* to observe value-change */
136-
__kcsan_check_write(&test_dummy, sizeof(test_dummy));
137-
138-
test_flags ^= CHANGE_BITS; /* generate value-change */
139-
__kcsan_check_write(&test_flags, sizeof(test_flags));
140-
141-
BUG_ON(current->kcsan_ctx.scoped_accesses.prev);
142-
{
143-
/* Should generate reports anywhere in this block. */
144-
ASSERT_EXCLUSIVE_WRITER_SCOPED(test_scoped);
145-
ASSERT_EXCLUSIVE_ACCESS_SCOPED(test_scoped);
146-
BUG_ON(!current->kcsan_ctx.scoped_accesses.prev);
147-
/* Unrelated accesses. */
148-
__kcsan_check_access(&cycles, sizeof(cycles), 0);
149-
__kcsan_check_access(&cycles, sizeof(cycles), KCSAN_ACCESS_ATOMIC);
150-
}
151-
BUG_ON(current->kcsan_ctx.scoped_accesses.prev);
152-
}
153-
cycles = get_cycles() - cycles;
154-
155-
pr_info("KCSAN: %s end | cycles: %llu\n", __func__, cycles);
156-
157-
/* restore context */
158-
current->kcsan_ctx = ctx_save;
159-
}
160-
161101
static int cmp_filterlist_addrs(const void *rhs, const void *lhs)
162102
{
163103
const unsigned long a = *(const unsigned long *)rhs;
@@ -306,12 +246,6 @@ debugfs_write(struct file *file, const char __user *buf, size_t count, loff_t *o
306246
if (kstrtoul(&arg[strlen("microbench=")], 0, &iters))
307247
return -EINVAL;
308248
microbenchmark(iters);
309-
} else if (str_has_prefix(arg, "test=")) {
310-
unsigned long iters;
311-
312-
if (kstrtoul(&arg[strlen("test=")], 0, &iters))
313-
return -EINVAL;
314-
test_thread(iters);
315249
} else if (!strcmp(arg, "whitelist")) {
316250
set_report_filterlist_whitelist(true);
317251
} else if (!strcmp(arg, "blacklist")) {

0 commit comments

Comments
 (0)