Lines Matching +full:re +full:- +full:sampling

1 // SPDX-License-Identifier: GPL-2.0
7 * Copyright (C) 2008-2009 Jon Masters, Red Hat, Inc. <jcm@redhat.com>
8 * Copyright (C) 2013-2016 Steven Rostedt, Red Hat, Inc. <srostedt@redhat.com>
12 * DE OLIVEIRA, Daniel Bristot, et al. Demystifying the real-time linux
13 * scheduling latency. In: 32nd Euromicro Conference on Real-Time Systems
14 * (ECRTS 2020). Schloss Dagstuhl-Leibniz-Zentrum fur Informatik, 2020.
91 * osnoise_instance_registered - check if a tr is already registered
100 if (inst->tr == tr) in osnoise_instance_registered()
109 * osnoise_register_instance - register a new trace instance
126 return -ENOMEM; in osnoise_register_instance()
128 INIT_LIST_HEAD_RCU(&inst->list); in osnoise_register_instance()
129 inst->tr = tr; in osnoise_register_instance()
130 list_add_tail_rcu(&inst->list, &osnoise_instances); in osnoise_register_instance()
136 * osnoise_unregister_instance - unregister a registered trace instance
152 if (inst->tr == tr) { in osnoise_unregister_instance()
153 list_del_rcu(&inst->list); in osnoise_unregister_instance()
205 * one sampling thread.
209 bool sampling; member
219 * Per-cpu runtime information.
224 * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
253 * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
261 * tlat_var_reset - Reset the values of the given timerlat_variables
276 if (tlat_var->kthread) in tlat_var_reset()
277 hrtimer_cancel(&tlat_var->timer); in tlat_var_reset()
287 * osn_var_reset - Reset the values of the given osnoise_variables
305 * osn_var_reset_all - Reset the value of all per-cpu osnoise_variables
322 u64 sample_period; /* total sampling period */
323 u64 sample_runtime; /* active sampling portion of period */
357 if (!tlat_var->tracing_thread) { in timerlat_softirq_exit()
358 osn_var->softirq.arrival_time = 0; in timerlat_softirq_exit()
359 osn_var->softirq.delta_start = 0; in timerlat_softirq_exit()
372 if (!tlat_var->tracing_thread) { in timerlat_thread_exit()
373 osn_var->thread.delta_start = 0; in timerlat_thread_exit()
374 osn_var->thread.arrival_time = 0; in timerlat_thread_exit()
404 seq_puts(s, "# _-------=> irqs-off\n"); in print_osnoise_headers()
405 seq_puts(s, "# / _------=> need-resched\n"); in print_osnoise_headers()
406 seq_puts(s, "# | / _-----=> need-resched-lazy\n"); in print_osnoise_headers()
407 seq_puts(s, "# || / _----=> hardirq/softirq\n"); in print_osnoise_headers()
408 seq_puts(s, "# ||| / _---=> preempt-depth\n"); in print_osnoise_headers()
409 seq_puts(s, "# |||| / _--=> preempt-lazy-depth\n"); in print_osnoise_headers()
410 seq_puts(s, "# ||||| / _-=> migrate-disable\n"); in print_osnoise_headers()
419 seq_puts(s, " NOISE %% OF CPU NOISE +-----------------------------+\n"); in print_osnoise_headers()
421 seq_puts(s, "# TASK-PID CPU# ||||||| TIMESTAMP IN US "); in print_osnoise_headers()
433 seq_puts(s, "# _-----=> irqs-off\n"); in print_osnoise_headers()
434 seq_puts(s, "# / _----=> need-resched\n"); in print_osnoise_headers()
435 seq_puts(s, "# | / _---=> hardirq/softirq\n"); in print_osnoise_headers()
436 seq_puts(s, "# || / _--=> preempt-depth\n"); in print_osnoise_headers()
437 seq_puts(s, "# ||| / _-=> migrate-disable "); in print_osnoise_headers()
443 seq_puts(s, " NOISE %% OF CPU NOISE +-----------------------------+\n"); in print_osnoise_headers()
445 seq_puts(s, "# TASK-PID CPU# ||||| TIMESTAMP IN US "); in print_osnoise_headers()
454 * osnoise_taint - report an osnoise error.
462 buffer = inst->tr->array_buffer.buffer; \
483 entry->runtime = sample->runtime; in __record_osnoise_sample()
484 entry->noise = sample->noise; in __record_osnoise_sample()
485 entry->max_sample = sample->max_sample; in __record_osnoise_sample()
486 entry->hw_count = sample->hw_count; in __record_osnoise_sample()
487 entry->nmi_count = sample->nmi_count; in __record_osnoise_sample()
488 entry->irq_count = sample->irq_count; in __record_osnoise_sample()
489 entry->softirq_count = sample->softirq_count; in __record_osnoise_sample()
490 entry->thread_count = sample->thread_count; in __record_osnoise_sample()
507 buffer = inst->tr->array_buffer.buffer; in record_osnoise_sample()
520 seq_puts(s, "# _-------=> irqs-off\n"); in print_timerlat_headers()
521 seq_puts(s, "# / _------=> need-resched\n"); in print_timerlat_headers()
522 seq_puts(s, "# | / _-----=> need-resched-lazy\n"); in print_timerlat_headers()
523 seq_puts(s, "# || / _----=> hardirq/softirq\n"); in print_timerlat_headers()
524 seq_puts(s, "# ||| / _---=> preempt-depth\n"); in print_timerlat_headers()
525 seq_puts(s, "# |||| / _--=> preempt-lazy-depth\n"); in print_timerlat_headers()
526 seq_puts(s, "# ||||| / _-=> migrate-disable\n"); in print_timerlat_headers()
529 seq_puts(s, "# TASK-PID CPU# ||||||| TIMESTAMP ID "); in print_timerlat_headers()
537 seq_puts(s, "# _-----=> irqs-off\n"); in print_timerlat_headers()
538 seq_puts(s, "# / _----=> need-resched\n"); in print_timerlat_headers()
539 seq_puts(s, "# | / _---=> hardirq/softirq\n"); in print_timerlat_headers()
540 seq_puts(s, "# || / _--=> preempt-depth\n"); in print_timerlat_headers()
541 seq_puts(s, "# ||| / _-=> migrate-disable\n"); in print_timerlat_headers()
544 seq_puts(s, "# TASK-PID CPU# ||||| TIMESTAMP ID "); in print_timerlat_headers()
562 entry->seqnum = sample->seqnum; in __record_timerlat_sample()
563 entry->context = sample->context; in __record_timerlat_sample()
564 entry->timer_latency = sample->timer_latency; in __record_timerlat_sample()
581 buffer = inst->tr->array_buffer.buffer; in record_timerlat_sample()
604 * timerlat_save_stack - save a stack trace without printing
616 size = ARRAY_SIZE(fstack->calls); in timerlat_save_stack()
618 nr_entries = stack_trace_save(fstack->calls, size, skip); in timerlat_save_stack()
620 fstack->stack_size = nr_entries * sizeof(unsigned long); in timerlat_save_stack()
621 fstack->nr_entries = nr_entries; in timerlat_save_stack()
640 entry->size = fstack->nr_entries; in __timerlat_dump_stack()
641 memcpy(&entry->caller, fstack->calls, size); in __timerlat_dump_stack()
647 * timerlat_dump_stack - dump a stack trace previously saved
664 size = fstack->stack_size; in timerlat_dump_stack()
668 buffer = inst->tr->array_buffer.buffer; in timerlat_dump_stack()
686 #define time_sub(a, b) ((a) - (b))
689 * cond_move_irq_delta_start - Forward the delta_start of a running IRQ
699 if (osn_var->irq.delta_start) in cond_move_irq_delta_start()
700 osn_var->irq.delta_start += duration; in cond_move_irq_delta_start()
705 * cond_move_softirq_delta_start - Forward the delta_start of a running softirq.
715 if (osn_var->softirq.delta_start) in cond_move_softirq_delta_start()
716 osn_var->softirq.delta_start += duration; in cond_move_softirq_delta_start()
723 * cond_move_thread_delta_start - Forward the delta_start of a running thread
733 if (osn_var->thread.delta_start) in cond_move_thread_delta_start()
734 osn_var->thread.delta_start += duration; in cond_move_thread_delta_start()
738 * get_int_safe_duration - Get the duration of a window
746 * - Know if a given window is being measured.
747 * - Account its duration.
748 * - Discount the interference.
753 * ---> interrupt!
754 * delta_start -= int duration;
755 * <---
756 * duration = now - delta_start;
771 int_counter = local_read(&osn_var->int_counter); in get_int_safe_duration()
776 duration = (now - *delta_start); in get_int_safe_duration()
780 } while (int_counter != local_read(&osn_var->int_counter)); in get_int_safe_duration()
796 * set_int_safe_time - Save the current time on *time, aware of interference
809 int_counter = local_read(&osn_var->int_counter); in set_int_safe_time()
817 } while (int_counter != local_read(&osn_var->int_counter)); in set_int_safe_time()
824 * copy_int_safe_time - Copy *src into *desc aware of interference
832 int_counter = local_read(&osn_var->int_counter); in copy_int_safe_time()
840 } while (int_counter != local_read(&osn_var->int_counter)); in copy_int_safe_time()
847 * trace_osnoise_callback - NMI entry/exit callback
859 if (!osn_var->sampling) in trace_osnoise_callback()
868 osn_var->nmi.delta_start = time_get(); in trace_osnoise_callback()
869 local_inc(&osn_var->int_counter); in trace_osnoise_callback()
871 duration = time_get() - osn_var->nmi.delta_start; in trace_osnoise_callback()
873 trace_nmi_noise(osn_var->nmi.delta_start, duration); in trace_osnoise_callback()
882 osn_var->nmi.count++; in trace_osnoise_callback()
886 * osnoise_trace_irq_entry - Note the starting of an IRQ
888 * Save the starting time of an IRQ. As IRQs are non-preemptive to other IRQs,
889 * it is safe to use a single variable (ons_var->irq) to save the statistics.
898 if (!osn_var->sampling) in osnoise_trace_irq_entry()
904 osn_var->irq.arrival_time = time_get(); in osnoise_trace_irq_entry()
905 set_int_safe_time(osn_var, &osn_var->irq.delta_start); in osnoise_trace_irq_entry()
906 osn_var->irq.count++; in osnoise_trace_irq_entry()
908 local_inc(&osn_var->int_counter); in osnoise_trace_irq_entry()
912 * osnoise_irq_exit - Note the end of an IRQ, sava data and trace
922 if (!osn_var->sampling) in osnoise_trace_irq_exit()
925 duration = get_int_safe_duration(osn_var, &osn_var->irq.delta_start); in osnoise_trace_irq_exit()
926 trace_irq_noise(id, desc, osn_var->irq.arrival_time, duration); in osnoise_trace_irq_exit()
927 osn_var->irq.arrival_time = 0; in osnoise_trace_irq_exit()
933 * trace_irqentry_callback - Callback to the irq:irq_entry traceevent
944 * trace_irqexit_callback - Callback to the irq:irq_exit traceevent
951 osnoise_trace_irq_exit(irq, action->name); in trace_irqexit_callback()
971 * hook_irq_events - Hook IRQ handling events
999 return -EINVAL; in hook_irq_events()
1003 * unhook_irq_events - Unhook IRQ handling events
1017 * trace_softirq_entry_callback - Note the starting of a softirq
1019 * Save the starting time of a softirq. As softirqs are non-preemptive to
1020 * other softirqs, it is safe to use a single variable (ons_var->softirq)
1029 if (!osn_var->sampling) in trace_softirq_entry_callback()
1035 osn_var->softirq.arrival_time = time_get(); in trace_softirq_entry_callback()
1036 set_int_safe_time(osn_var, &osn_var->softirq.delta_start); in trace_softirq_entry_callback()
1037 osn_var->softirq.count++; in trace_softirq_entry_callback()
1039 local_inc(&osn_var->int_counter); in trace_softirq_entry_callback()
1043 * trace_softirq_exit_callback - Note the end of an softirq
1053 if (!osn_var->sampling) in trace_softirq_exit_callback()
1060 duration = get_int_safe_duration(osn_var, &osn_var->softirq.delta_start); in trace_softirq_exit_callback()
1061 trace_softirq_noise(vec_nr, osn_var->softirq.arrival_time, duration); in trace_softirq_exit_callback()
1063 osn_var->softirq.arrival_time = 0; in trace_softirq_exit_callback()
1067 * hook_softirq_events - Hook softirq handling events
1089 return -EINVAL; in hook_softirq_events()
1093 * unhook_softirq_events - Unhook softirq handling events
1117 * thread_entry - Record the starting of a thread noise window
1125 if (!osn_var->sampling) in thread_entry()
1131 osn_var->thread.arrival_time = time_get(); in thread_entry()
1133 set_int_safe_time(osn_var, &osn_var->thread.delta_start); in thread_entry()
1135 osn_var->thread.count++; in thread_entry()
1136 local_inc(&osn_var->int_counter); in thread_entry()
1140 * thread_exit - Report the end of a thread noise window
1149 if (!osn_var->sampling) in thread_exit()
1156 duration = get_int_safe_duration(osn_var, &osn_var->thread.delta_start); in thread_exit()
1158 trace_thread_noise(t, osn_var->thread.arrival_time, duration); in thread_exit()
1160 osn_var->thread.arrival_time = 0; in thread_exit()
1165 * osnoise_stop_exception - Stop tracing and the tracer.
1174 tr = inst->tr; in osnoise_stop_exception()
1175 trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_, in osnoise_stop_exception()
1191 * trace_sched_migrate_callback - sched:sched_migrate_task trace event handler
1194 * timerlat user-space thread migration.
1202 if (osn_var->pid == p->pid && dest_cpu != cpu) { in trace_sched_migrate_callback()
1203 per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1; in trace_sched_migrate_callback()
1204 osnoise_taint("timerlat user-thread migrated\n"); in trace_sched_migrate_callback()
1205 osnoise_stop_exception("timerlat user-thread migrated", cpu); in trace_sched_migrate_callback()
1216 * Timerlat thread migration check is only required when running timerlat in user-space. in register_migration_monitor()
1247 * trace_sched_switch - sched:sched_switch trace event handler
1261 if ((p->pid != osn_var->pid) || !workload) in trace_sched_switch_callback()
1264 if ((n->pid != osn_var->pid) || !workload) in trace_sched_switch_callback()
1269 * hook_thread_events - Hook the instrumentation for thread noise
1280 return -EINVAL; in hook_thread_events()
1290 return -EINVAL; in hook_thread_events()
1294 * unhook_thread_events - unhook the instrumentation for thread noise
1306 * save_osn_sample_stats - Save the osnoise_sample statistics
1308 * Save the osnoise_sample statistics before the sampling phase. These
1310 * before and after the osnoise sampling.
1315 s->nmi_count = osn_var->nmi.count; in save_osn_sample_stats()
1316 s->irq_count = osn_var->irq.count; in save_osn_sample_stats()
1317 s->softirq_count = osn_var->softirq.count; in save_osn_sample_stats()
1318 s->thread_count = osn_var->thread.count; in save_osn_sample_stats()
1322 * diff_osn_sample_stats - Compute the osnoise_sample statistics
1326 * save_osn_sample_stats() before the osnoise sampling.
1331 s->nmi_count = osn_var->nmi.count - s->nmi_count; in diff_osn_sample_stats()
1332 s->irq_count = osn_var->irq.count - s->irq_count; in diff_osn_sample_stats()
1333 s->softirq_count = osn_var->softirq.count - s->softirq_count; in diff_osn_sample_stats()
1334 s->thread_count = osn_var->thread.count - s->thread_count; in diff_osn_sample_stats()
1338 * osnoise_stop_tracing - Stop tracing and the tracer.
1347 tr = inst->tr; in osnoise_stop_tracing()
1348 trace_array_printk_buf(tr->array_buffer.buffer, _THIS_IP_, in osnoise_stop_tracing()
1360 * osnoise_has_tracing_on - Check if there is at least one instance on
1369 trace_is_on += tracer_tracing_is_on(inst->tr); in osnoise_has_tracing_on()
1376 * notify_new_max_latency - Notify a new max latency via fsnotify interface.
1385 tr = inst->tr; in notify_new_max_latency()
1386 if (tracer_tracing_is_on(tr) && tr->max_latency < latency) { in notify_new_max_latency()
1387 tr->max_latency = latency; in notify_new_max_latency()
1395 * run_osnoise - Sample the time and look for osnoise
1400 * osnoise sampling thread, as they would do with a regular thread.
1416 int ret = -1; in run_osnoise()
1427 osn_var->pid = current->pid; in run_osnoise()
1449 * Make sure NMIs see sampling first in run_osnoise()
1451 osn_var->sampling = true; in run_osnoise()
1503 int interference = int_count - last_int_count; in run_osnoise()
1543 * For the non-preemptive kernel config: let threads runs, if in run_osnoise()
1559 osn_var->sampling = false; in run_osnoise()
1562 * Make sure sampling data is no longer updated. in run_osnoise()
1604 * osnoise_sleep - sleep until the next period
1615 interval = osnoise_data.sample_period - osnoise_data.sample_runtime; in osnoise_sleep()
1638 * osnoise_migration_pending - checks if the task needs to migrate
1640 * osnoise/timerlat threads are per-cpu. If there is a pending request to
1648 if (!current->migration_pending) in osnoise_migration_pending()
1664 this_cpu_osn_var()->kthread = NULL; in osnoise_migration_pending()
1672 * osnoise_main - The osnoise detection kernel thread
1689 raw_spin_lock_irqsave(&current->pi_lock, flags); in osnoise_main()
1690 current->flags &= ~(PF_NO_SETAFFINITY); in osnoise_main()
1691 raw_spin_unlock_irqrestore(&current->pi_lock, flags); in osnoise_main()
1713 * timerlat_irq - hrtimer handler for timerlat.
1730 now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer)); in timerlat_irq()
1735 tlat->tracing_thread = true; in timerlat_irq()
1737 osn_var->thread.arrival_time = time_get(); in timerlat_irq()
1760 if (!IS_ENABLED(CONFIG_PREEMPT_RT) && osn_var->softirq.delta_start) { in timerlat_irq()
1761 copy_int_safe_time(osn_var, &osn_var->thread.delta_start, in timerlat_irq()
1762 &osn_var->softirq.delta_start); in timerlat_irq()
1764 copy_int_safe_time(osn_var, &osn_var->softirq.delta_start, in timerlat_irq()
1765 &osn_var->irq.delta_start); in timerlat_irq()
1767 copy_int_safe_time(osn_var, &osn_var->thread.delta_start, in timerlat_irq()
1768 &osn_var->irq.delta_start); in timerlat_irq()
1774 diff = now - tlat->abs_period; in timerlat_irq()
1776 tlat->count++; in timerlat_irq()
1777 s.seqnum = tlat->count; in timerlat_irq()
1801 wake_up_process(tlat->kthread); in timerlat_irq()
1807 wake_up_process(tlat->kthread); in timerlat_irq()
1816 * wait_next_period - Wait for the next period for timerlat
1823 now = hrtimer_cb_get_time(&tlat->timer); in wait_next_period()
1824 next_abs_period = ns_to_ktime(tlat->abs_period + rel_period); in wait_next_period()
1829 tlat->abs_period = (u64) ktime_to_ns(next_abs_period); in wait_next_period()
1835 next_abs_period = ns_to_ktime(tlat->abs_period + rel_period); in wait_next_period()
1836 tlat->abs_period = (u64) ktime_to_ns(next_abs_period); in wait_next_period()
1841 hrtimer_start(&tlat->timer, next_abs_period, HRTIMER_MODE_ABS_PINNED_HARD); in wait_next_period()
1847 * timerlat_main- Timerlat main
1872 raw_spin_lock_irqsave(&current->pi_lock, flags); in timerlat_main()
1873 current->flags &= ~(PF_NO_SETAFFINITY); in timerlat_main()
1874 raw_spin_unlock_irqrestore(&current->pi_lock, flags); in timerlat_main()
1876 tlat->count = 0; in timerlat_main()
1877 tlat->tracing_thread = false; in timerlat_main()
1879 hrtimer_setup(&tlat->timer, timerlat_irq, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); in timerlat_main()
1880 tlat->kthread = current; in timerlat_main()
1881 osn_var->pid = current->pid; in timerlat_main()
1885 tlat->abs_period = hrtimer_cb_get_time(&tlat->timer); in timerlat_main()
1889 osn_var->sampling = 1; in timerlat_main()
1893 now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer)); in timerlat_main()
1894 diff = now - tlat->abs_period; in timerlat_main()
1896 s.seqnum = tlat->count; in timerlat_main()
1906 tlat->tracing_thread = false; in timerlat_main()
1917 hrtimer_cancel(&tlat->timer); in timerlat_main()
1929 * stop_kthread - stop a workload thread
1946 kill_pid(kthread->thread_pid, SIGKILL, 1); in stop_kthread()
1955 per_cpu(per_cpu_osnoise_var, cpu).sampling = false; in stop_kthread()
1962 * stop_per_cpu_kthread - Stop per-cpu threads
1964 * Stop the osnoise sampling htread. Use this on unload and at system
1980 * start_kthread - Start a workload tread
1998 per_cpu(per_cpu_osnoise_var, cpu).sampling = true; in start_kthread()
2008 pr_err(BANNER "could not start sampling thread\n"); in start_kthread()
2009 return -ENOMEM; in start_kthread()
2019 * start_per_cpu_kthread - Kick off per-cpu osnoise sampling kthreads
2090 * osnoise_cpu_init - CPU hotplug online callback function
2099 * osnoise_cpu_die - CPU hotplug offline callback function
2194 * osnoise_options_write - Write function for "options" entry
2212 return -EINVAL; in osnoise_options_write()
2215 return -EFAULT; in osnoise_options_write()
2229 return -EINVAL; in osnoise_options_write()
2254 retval = -EINVAL; in osnoise_options_write()
2270 * osnoise_cpus_read - Read function for reading the "cpus" file
2276 * Prints the "cpus" output into the user-provided buffer.
2290 return -ENOMEM; in osnoise_cpus_read()
2294 return -EINVAL; in osnoise_cpus_read()
2302 * osnoise_cpus_write - Write function for "cpus" entry
2327 return -ENOMEM; in osnoise_cpus_write()
2330 return -EFAULT; in osnoise_cpus_write()
2333 return -ENOMEM; in osnoise_cpus_write()
2376 long cpu = (long) inode->i_cdev; in timerlat_fd_open()
2386 return -EINVAL; in timerlat_fd_open()
2394 * The osn_var->pid holds the single access to this file. in timerlat_fd_open()
2396 if (osn_var->pid) { in timerlat_fd_open()
2399 return -EBUSY; in timerlat_fd_open()
2403 * timerlat tracer is a per-cpu tracer. Check if the user-space too in timerlat_fd_open()
2409 if (current->nr_cpus_allowed > 1 || cpu != smp_processor_id()) { in timerlat_fd_open()
2412 return -EPERM; in timerlat_fd_open()
2418 file->private_data = inode->i_cdev; in timerlat_fd_open()
2422 osn_var->kthread = current; in timerlat_fd_open()
2423 osn_var->pid = current->pid; in timerlat_fd_open()
2431 tlat->count = 0; in timerlat_fd_open()
2433 hrtimer_setup(&tlat->timer, timerlat_irq, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); in timerlat_fd_open()
2440 * timerlat_fd_read - Read function for "timerlat_fd" file
2446 * Prints 1 on timerlat, the number of interferences on osnoise, -1 on error.
2452 long cpu = (long) file->private_data; in timerlat_fd_read()
2464 * While in user-space, the thread is migratable. There is nothing in timerlat_fd_read()
2469 if (tlat->uthread_migrate) { in timerlat_fd_read()
2471 return -EINVAL; in timerlat_fd_read()
2474 per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1; in timerlat_fd_read()
2478 return -EINVAL; in timerlat_fd_read()
2484 * The timerlat in user-space runs in a different order: in timerlat_fd_read()
2491 if (likely(osn_var->sampling)) { in timerlat_fd_read()
2492 now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer)); in timerlat_fd_read()
2493 diff = now - tlat->abs_period; in timerlat_fd_read()
2501 s.seqnum = tlat->count; in timerlat_fd_read()
2509 tlat->tracing_thread = false; in timerlat_fd_read()
2514 tlat->tracing_thread = false; in timerlat_fd_read()
2515 tlat->kthread = current; in timerlat_fd_read()
2518 tlat->abs_period = hrtimer_cb_get_time(&tlat->timer); in timerlat_fd_read()
2520 osn_var->sampling = 1; in timerlat_fd_read()
2527 now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer)); in timerlat_fd_read()
2528 diff = now - tlat->abs_period; in timerlat_fd_read()
2536 s.seqnum = tlat->count; in timerlat_fd_read()
2559 long cpu = (long) file->private_data; in timerlat_fd_release()
2567 if (tlat_var->kthread) in timerlat_fd_release()
2568 hrtimer_cancel(&tlat_var->timer); in timerlat_fd_release()
2571 osn_var->sampling = 0; in timerlat_fd_release()
2572 osn_var->pid = 0; in timerlat_fd_release()
2577 if (osn_var->kthread) { in timerlat_fd_release()
2578 put_task_struct(osn_var->kthread); in timerlat_fd_release()
2579 osn_var->kthread = NULL; in timerlat_fd_release()
2684 return -ENOMEM; in init_timerlat_stack_tracefs()
2711 return -ENOMEM; in osnoise_create_cpu_timerlat_fd()
2725 d_inode(timerlat_fd)->i_cdev = (void *)(cpu); in osnoise_create_cpu_timerlat_fd()
2732 return -ENOMEM; in osnoise_create_cpu_timerlat_fd()
2736 * init_timerlat_tracefs - A function to initialize the timerlat interface files
2746 return -ENOMEM; in init_timerlat_tracefs()
2762 * init_tracefs - A function to initialize the tracefs interface files
2776 return -ENOMEM; in init_tracefs()
2819 return -ENOMEM; in init_tracefs()
2827 * Trace is already hooked, we are re-enabling from in osnoise_hook_events()
2835 return -EINVAL; in osnoise_hook_events()
2851 return -EINVAL; in osnoise_hook_events()
2862 * osnoise_workload_start - start the workload and hook to events
2908 * osnoise_workload_stop - stop the workload and unhook the events
2976 return -EBUSY; in osnoise_tracer_init()
2978 tr->max_latency = 0; in osnoise_tracer_init()
3031 per_cpu(per_cpu_osnoise_var, cpu).sampling = 0; in timerlat_tracer_stop()
3043 return -EBUSY; in timerlat_tracer_init()
3052 tr->max_latency = 0; in timerlat_tracer_init()