X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=lttng-probes.c;h=24f76f355560bb926438c0fe63908b2750704945;hb=refs%2Fheads%2Fsow-2019-0002-rev1;hp=0385a79cdf94d780b6ca0b88809b263fb3e0296b;hpb=a1031097400268ccb8e02855da46a1efeb88ecdc;p=deliverable%2Flttng-modules.git diff --git a/lttng-probes.c b/lttng-probes.c index 0385a79c..24f76f35 100644 --- a/lttng-probes.c +++ b/lttng-probes.c @@ -1,23 +1,10 @@ -/* +/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) + * * lttng-probes.c * * Holds LTTng probes registry. * * Copyright (C) 2010-2012 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -25,7 +12,7 @@ #include #include -#include "lttng-events.h" +#include /* * probe list is protected by sessions lock. @@ -44,6 +31,10 @@ static LIST_HEAD(lazy_probe_init); */ static int lazy_nesting; +DEFINE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack); + +EXPORT_PER_CPU_SYMBOL_GPL(lttng_dynamic_len_stack); + /* * Called under sessions lock. */ @@ -133,6 +124,8 @@ void fixup_lazy_probes(void) } ret = lttng_fix_pending_events(); WARN_ON_ONCE(ret); + ret = lttng_fix_pending_triggers(); + WARN_ON_ONCE(ret); lazy_nesting--; } @@ -182,7 +175,7 @@ int lttng_probe_register(struct lttng_probe_desc *desc) * the probe immediately, since we cannot delay event * registration because they are needed ASAP. */ - if (lttng_session_active()) + if (lttng_session_active() || lttng_trigger_active()) fixup_lazy_probes(); end: lttng_unlock_sessions(); @@ -207,7 +200,7 @@ EXPORT_SYMBOL_GPL(lttng_probe_unregister); * Called with sessions lock held. */ static -const struct lttng_event_desc *find_event(const char *name) +const struct lttng_event_desc *find_event_desc(const char *name) { struct lttng_probe_desc *probe_desc; int i; @@ -224,28 +217,28 @@ const struct lttng_event_desc *find_event(const char *name) /* * Called with sessions lock held. */ -const struct lttng_event_desc *lttng_event_get(const char *name) +const struct lttng_event_desc *lttng_event_desc_get(const char *name) { - const struct lttng_event_desc *event; + const struct lttng_event_desc *event_desc; int ret; - event = find_event(name); - if (!event) + event_desc = find_event_desc(name); + if (!event_desc) return NULL; - ret = try_module_get(event->owner); + ret = try_module_get(event_desc->owner); WARN_ON_ONCE(!ret); - return event; + return event_desc; } -EXPORT_SYMBOL_GPL(lttng_event_get); +EXPORT_SYMBOL_GPL(lttng_event_desc_get); /* * Called with sessions lock held. */ -void lttng_event_put(const struct lttng_event_desc *event) +void lttng_event_desc_put(const struct lttng_event_desc *event_desc) { - module_put(event->owner); + module_put(event_desc->owner); } -EXPORT_SYMBOL_GPL(lttng_event_put); +EXPORT_SYMBOL_GPL(lttng_event_desc_put); static void *tp_list_start(struct seq_file *m, loff_t *pos) @@ -322,3 +315,12 @@ const struct file_operations lttng_tracepoint_list_fops = { .llseek = seq_lseek, .release = seq_release, }; + +int lttng_probes_init(void) +{ + int cpu; + + for_each_possible_cpu(cpu) + per_cpu_ptr(<tng_dynamic_len_stack, cpu)->offset = 0; + return 0; +}