Re: [PATCH v6 7/7] tracing: Add a probe that attaches to trace events

From
Steven Rostedt <rostedt@goodmis.org>
Date
2021-08-19 04:10:10
Reply to
Steven Rostedt, 2021-08-19
On Thu, 19 Aug 2021 00:03:42 -0400
Steven Rostedt [off-list ref] wrote:
Probably. I noticed that it was updated under the dyn_event_ops_mutex,
and thought that was enough protection. But I now see the lockdep
assert on the event_mutex in the other functions.
Anyway, here's the new version:

static bool find_event_probe(const char *group, const char *event)
{
	struct trace_eprobe *ep;
	struct dyn_event *ev;
	bool ret = false;

	/*
	 * Must grab the event_mutex to prevent the list from being modified
	 * by other probes. But the event_probe being only created via the
	 * dynamic_events file, is only added under the dyn_event_ops_mutex,
	 * which is currently held. There is no race between this check and
	 * adding the new probe.
	 */
	mutex_lock(&event_mutex);
	for_each_dyn_event(ev) {
		if (ev->ops != &eprobe_dyn_event_ops)
			continue;
		ep = to_trace_eprobe(ev);
		if (strcmp(ep->tp.event->class.system, group) == 0 &&
		    strcmp(ep->tp.event->call.name, event) == 0) {
			ret = true;
			break;
		}
	}
	mutex_lock(&event_mutex);

	return ret;
}


-- Steve
Thread (20 messages) 20 messages, 2 authors, last reply 2021-08-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help