Lines Matching refs:u

160 	struct unwindme *u = unwindme;
162 if (!(u->flags & UWM_KRETPROBE_HANDLER))
165 u->ret = test_unwind(NULL, (u->flags & UWM_REGS) ? regs : NULL,
166 (u->flags & UWM_SP) ? u->sp : 0);
171 static noinline notrace int test_unwind_kretprobed_func(struct unwindme *u)
175 if (!(u->flags & UWM_KRETPROBE))
179 return test_unwind(NULL, (u->flags & UWM_REGS) ? &regs : NULL,
180 (u->flags & UWM_SP) ? u->sp : 0);
183 static noinline int test_unwind_kretprobed_func_caller(struct unwindme *u)
185 return test_unwind_kretprobed_func(u);
188 static int test_unwind_kretprobe(struct unwindme *u)
196 u->ret = -1; /* make sure kprobe is called */
197 unwindme = u;
211 ret = test_unwind_kretprobed_func_caller(u);
214 if (u->flags & UWM_KRETPROBE_HANDLER)
215 ret = u->ret;
221 struct unwindme *u = unwindme;
223 u->ret = test_unwind(NULL, (u->flags & UWM_REGS) ? regs : NULL,
224 (u->flags & UWM_SP) ? u->sp : 0);
239 static int test_unwind_kprobe(struct unwindme *u)
246 if (!IS_ENABLED(CONFIG_KPROBES_ON_FTRACE) && u->flags & UWM_KPROBE_ON_FTRACE)
249 u->ret = -1; /* make sure kprobe is called */
250 unwindme = u;
253 kp.addr = u->flags & UWM_KPROBE_ON_FTRACE ?
265 return u->ret;
273 struct unwindme *u = (struct unwindme *)arch_ftrace_regs(fregs)->regs.gprs[2];
275 u->ret = test_unwind(NULL, (u->flags & UWM_REGS) ? &arch_ftrace_regs(fregs)->regs : NULL,
276 (u->flags & UWM_SP) ? u->sp : 0);
279 static noinline int test_unwind_ftraced_func(struct unwindme *u)
281 return READ_ONCE(u)->ret;
284 static int test_unwind_ftrace(struct unwindme *u)
308 ret = test_unwind_ftraced_func(u);
319 static noinline int unwindme_func4(struct unwindme *u)
321 if (!(u->flags & UWM_CALLER))
322 u->sp = current_frame_address();
323 if (u->flags & UWM_THREAD) {
324 complete(&u->task_ready);
325 wait_event(u->task_wq, kthread_should_park());
328 } else if (u->flags & (UWM_PGM | UWM_KPROBE_ON_FTRACE)) {
329 return test_unwind_kprobe(u);
330 } else if (u->flags & (UWM_KRETPROBE | UWM_KRETPROBE_HANDLER)) {
331 return test_unwind_kretprobe(u);
332 } else if (u->flags & UWM_FTRACE) {
333 return test_unwind_ftrace(u);
338 (u->flags & UWM_REGS) ? &regs : NULL,
339 (u->flags & UWM_SP) ? u->sp : 0);
344 static noinline int unwindme_func3(struct unwindme *u)
346 u->sp = current_frame_address();
347 return unwindme_func4(u);
351 static noinline int unwindme_func2(struct unwindme *u)
356 if (u->flags & UWM_SWITCH_STACK) {
360 int, unwindme_func3, struct unwindme *, u);
365 return unwindme_func3(u);
370 static noinline int unwindme_func1(void *u)
372 return unwindme_func2((struct unwindme *)u);
377 struct unwindme *u = READ_ONCE(unwindme);
379 if (u) {
381 u->task = NULL;
382 u->ret = unwindme_func1(u);
383 complete(&u->task_ready);
389 static int test_unwind_irq(struct unwindme *u)
391 unwindme = u;
392 init_completion(&u->task_ready);
395 wait_for_completion(&u->task_ready);
396 return u->ret;
400 static int test_unwind_task(struct unwindme *u)
406 init_completion(&u->task_ready);
407 init_waitqueue_head(&u->task_wq);
413 task = kthread_run(unwindme_func1, u, "%s", __func__);
422 wait_for_completion(&u->task_ready);
425 ret = test_unwind(task, NULL, (u->flags & UWM_SP) ? u->sp : 0);
496 struct unwindme u;
501 u.flags = params->flags;
502 if (u.flags & UWM_THREAD)
503 KUNIT_EXPECT_EQ(test, 0, test_unwind_task(&u));
504 else if (u.flags & UWM_IRQ)
505 KUNIT_EXPECT_EQ(test, 0, test_unwind_irq(&u));
507 KUNIT_EXPECT_EQ(test, 0, unwindme_func1(&u));