|
@@ -8399,6 +8399,15 @@ SYSCALL_DEFINE5(perf_event_open,
|
|
|
put_ctx(gctx);
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * Precalculate sample_data sizes; do while holding ctx::mutex such
|
|
|
+ * that we're serialized against further additions and before
|
|
|
+ * perf_install_in_context() which is the point the event is active and
|
|
|
+ * can use these values.
|
|
|
+ */
|
|
|
+ perf_event__header_size(event);
|
|
|
+ perf_event__id_header_size(event);
|
|
|
+
|
|
|
perf_install_in_context(ctx, event, event->cpu);
|
|
|
perf_unpin_context(ctx);
|
|
|
|
|
@@ -8414,12 +8423,6 @@ SYSCALL_DEFINE5(perf_event_open,
|
|
|
list_add_tail(&event->owner_entry, ¤t->perf_event_list);
|
|
|
mutex_unlock(¤t->perf_event_mutex);
|
|
|
|
|
|
- /*
|
|
|
- * Precalculate sample_data sizes
|
|
|
- */
|
|
|
- perf_event__header_size(event);
|
|
|
- perf_event__id_header_size(event);
|
|
|
-
|
|
|
/*
|
|
|
* Drop the reference on the group_event after placing the
|
|
|
* new event on the sibling_list. This ensures destruction
|