Lines Matching +full:if +full:- +full:idx
1 // SPDX-License-Identifier: GPL-2.0
17 if ((slots) > get_test_bp_slots()) { \
23 #define TEST_EXPECT_NOSPC(expr) KUNIT_EXPECT_EQ(test, -ENOSPC, PTR_ERR(expr))
31 static struct perf_event *register_test_bp(int cpu, struct task_struct *tsk, int idx) in register_test_bp() argument
35 if (WARN_ON(idx < 0 || idx >= MAX_TEST_BREAKPOINTS)) in register_test_bp()
39 attr.bp_addr = (unsigned long)&break_vars[idx]; in register_test_bp()
47 if (WARN_ON(IS_ERR(*bp))) in unregister_test_bp()
49 if (WARN_ON(!*bp)) in unregister_test_bp()
59 if (!slots) in get_test_bp_slots()
78 * Returns true if this can be called again, continuing at @id.
82 for (int i = 0; i < get_test_bp_slots() - skip; ++i) in fill_bp_slots()
97 if (__other_task) in get_other_task()
113 if (num-- <= 0) in get_test_cpu()
124 int idx = 0; in test_one_cpu() local
126 fill_bp_slots(test, &idx, get_test_cpu(0), NULL, 0); in test_one_cpu()
127 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_one_cpu()
128 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_one_cpu()
133 int idx = 0; in test_many_cpus() local
138 bool do_continue = fill_bp_slots(test, &idx, cpu, NULL, 0); in test_many_cpus()
140 TEST_EXPECT_NOSPC(register_test_bp(cpu, NULL, idx)); in test_many_cpus()
141 if (!do_continue) in test_many_cpus()
148 int idx = 0; in test_one_task_on_all_cpus() local
150 fill_bp_slots(test, &idx, -1, current, 0); in test_one_task_on_all_cpus()
151 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_one_task_on_all_cpus()
152 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_one_task_on_all_cpus()
153 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_one_task_on_all_cpus()
154 /* Remove one and adding back CPU-target should work. */ in test_one_task_on_all_cpus()
156 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_on_all_cpus()
161 int idx = 0; in test_two_tasks_on_all_cpus() local
164 fill_bp_slots(test, &idx, -1, current, 0); in test_two_tasks_on_all_cpus()
165 fill_bp_slots(test, &idx, -1, get_other_task(test), 0); in test_two_tasks_on_all_cpus()
167 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_two_tasks_on_all_cpus()
168 TEST_EXPECT_NOSPC(register_test_bp(-1, get_other_task(test), idx)); in test_two_tasks_on_all_cpus()
169 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_two_tasks_on_all_cpus()
170 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), get_other_task(test), idx)); in test_two_tasks_on_all_cpus()
171 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_two_tasks_on_all_cpus()
172 /* Remove one from first task and adding back CPU-target should not work. */ in test_two_tasks_on_all_cpus()
174 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_two_tasks_on_all_cpus()
179 int idx = 0; in test_one_task_on_one_cpu() local
181 fill_bp_slots(test, &idx, get_test_cpu(0), current, 0); in test_one_task_on_one_cpu()
182 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_one_task_on_one_cpu()
183 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_one_task_on_one_cpu()
184 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_one_task_on_one_cpu()
186 * Remove one and adding back CPU-target should work; this case is in test_one_task_on_one_cpu()
187 * special vs. above because the task's constraints are CPU-dependent. in test_one_task_on_one_cpu()
190 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_on_one_cpu()
195 int idx = 0; in test_one_task_mixed() local
199 fill_one_bp_slot(test, &idx, get_test_cpu(0), current); in test_one_task_mixed()
200 fill_bp_slots(test, &idx, -1, current, 1); in test_one_task_mixed()
201 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_one_task_mixed()
202 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_one_task_mixed()
203 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_one_task_mixed()
205 /* Transition from CPU-dependent pinned count to CPU-independent. */ in test_one_task_mixed()
208 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_mixed()
209 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_mixed()
210 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_one_task_mixed()
215 int idx = 0; in test_two_tasks_on_one_cpu() local
217 fill_bp_slots(test, &idx, get_test_cpu(0), current, 0); in test_two_tasks_on_one_cpu()
218 fill_bp_slots(test, &idx, get_test_cpu(0), get_other_task(test), 0); in test_two_tasks_on_one_cpu()
220 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_two_tasks_on_one_cpu()
221 TEST_EXPECT_NOSPC(register_test_bp(-1, get_other_task(test), idx)); in test_two_tasks_on_one_cpu()
222 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_two_tasks_on_one_cpu()
223 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), get_other_task(test), idx)); in test_two_tasks_on_one_cpu()
224 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_two_tasks_on_one_cpu()
226 fill_bp_slots(test, &idx, get_test_cpu(1), NULL, 0); in test_two_tasks_on_one_cpu()
231 int idx = 0; in test_two_tasks_on_one_all_cpus() local
233 fill_bp_slots(test, &idx, get_test_cpu(0), current, 0); in test_two_tasks_on_one_all_cpus()
234 fill_bp_slots(test, &idx, -1, get_other_task(test), 0); in test_two_tasks_on_one_all_cpus()
236 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_two_tasks_on_one_all_cpus()
237 TEST_EXPECT_NOSPC(register_test_bp(-1, get_other_task(test), idx)); in test_two_tasks_on_one_all_cpus()
238 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_two_tasks_on_one_all_cpus()
239 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), get_other_task(test), idx)); in test_two_tasks_on_one_all_cpus()
240 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_two_tasks_on_one_all_cpus()
242 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(1), NULL, idx)); in test_two_tasks_on_one_all_cpus()
248 int idx = 0; in test_task_on_all_and_one_cpu() local
252 fill_bp_slots(test, &idx, -1, current, 2); in test_task_on_all_and_one_cpu()
254 tsk_on_cpu_idx = idx; in test_task_on_all_and_one_cpu()
255 fill_one_bp_slot(test, &idx, get_test_cpu(0), current); in test_task_on_all_and_one_cpu()
256 fill_one_bp_slot(test, &idx, -1, current); in test_task_on_all_and_one_cpu()
258 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_task_on_all_and_one_cpu()
259 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_task_on_all_and_one_cpu()
260 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_task_on_all_and_one_cpu()
263 cpu_idx = idx; in test_task_on_all_and_one_cpu()
264 fill_one_bp_slot(test, &idx, get_test_cpu(1), NULL); in test_task_on_all_and_one_cpu()
265 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(1), NULL, idx)); in test_task_on_all_and_one_cpu()
270 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_task_on_all_and_one_cpu()
273 fill_one_bp_slot(test, &idx, -1, current); in test_task_on_all_and_one_cpu()
275 TEST_EXPECT_NOSPC(register_test_bp(-1, current, idx)); in test_task_on_all_and_one_cpu()
276 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), current, idx)); in test_task_on_all_and_one_cpu()
277 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), NULL, idx)); in test_task_on_all_and_one_cpu()
278 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(1), NULL, idx)); in test_task_on_all_and_one_cpu()
297 if (num_online_cpus() < 2) in test_init()
301 if (hw_breakpoint_is_used()) in test_init()
310 if (test_bps[i]) in test_exit()
314 if (__other_task) { in test_exit()