| 1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
| 2 | * |
| 3 | * lttng-cpuhotplug.h |
| 4 | * |
| 5 | * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef LTTNG_CPUHOTPLUG_H |
| 9 | #define LTTNG_CPUHOTPLUG_H |
| 10 | |
| 11 | struct lttng_cpuhp_node; |
| 12 | |
| 13 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) |
| 14 | |
| 15 | #include <linux/cpuhotplug.h> |
| 16 | |
| 17 | enum lttng_cpuhp_component { |
| 18 | LTTNG_RING_BUFFER_FRONTEND, |
| 19 | LTTNG_RING_BUFFER_BACKEND, |
| 20 | LTTNG_RING_BUFFER_ITER, |
| 21 | LTTNG_CONTEXT_PERF_COUNTERS, |
| 22 | }; |
| 23 | |
| 24 | struct lttng_cpuhp_node { |
| 25 | enum lttng_cpuhp_component component; |
| 26 | struct hlist_node node; |
| 27 | }; |
| 28 | |
| 29 | extern enum cpuhp_state lttng_hp_prepare; |
| 30 | extern enum cpuhp_state lttng_hp_online; |
| 31 | |
| 32 | int lttng_cpuhp_rb_backend_prepare(unsigned int cpu, |
| 33 | struct lttng_cpuhp_node *node); |
| 34 | int lttng_cpuhp_rb_frontend_dead(unsigned int cpu, |
| 35 | struct lttng_cpuhp_node *node); |
| 36 | int lttng_cpuhp_rb_frontend_online(unsigned int cpu, |
| 37 | struct lttng_cpuhp_node *node); |
| 38 | int lttng_cpuhp_rb_frontend_offline(unsigned int cpu, |
| 39 | struct lttng_cpuhp_node *node); |
| 40 | int lttng_cpuhp_rb_iter_online(unsigned int cpu, |
| 41 | struct lttng_cpuhp_node *node); |
| 42 | |
| 43 | /* Ring buffer is a separate library. */ |
| 44 | void lttng_rb_set_hp_prepare(enum cpuhp_state val); |
| 45 | void lttng_rb_set_hp_online(enum cpuhp_state val); |
| 46 | |
| 47 | extern enum cpuhp_state lttng_rb_hp_prepare; |
| 48 | extern enum cpuhp_state lttng_rb_hp_online; |
| 49 | |
| 50 | #endif |
| 51 | |
| 52 | #endif /* LTTNG_CPUHOTPLUG_H */ |