return ret;
}
+/**
+ * tracing_update_buffers - used by tracing facility to expand ring buffers
+ *
+ * To save on memory when the tracing is never used on a system with it
+ * configured in. The ring buffers are set to a minimum size. But once
+ * a user starts to use the tracing facility, then they need to grow
+ * to their default size.
+ *
+ * This function is to be called when a tracer is about to be used.
+ */
+int tracing_update_buffers(void)
+{
+ int ret = 0;
+
+ if (!ring_buffer_expanded)
+ ret = tracing_resize_ring_buffer(trace_buf_size);
+
+ return ret;
+}
+
struct trace_option_dentry;
static struct trace_option_dentry *
}
#endif /* CONFIG_BRANCH_TRACER */
+/* set ring buffers to default size if not already done so */
+int tracing_update_buffers(void);
+
/* trace event type bit fields, not numeric */
enum {
TRACE_EVENT_TYPE_PRINTF = 1,
if (!cnt || cnt < 0)
return 0;
+ ret = tracing_update_buffers();
+ if (ret < 0)
+ return ret;
+
ret = get_user(ch, ubuf++);
if (ret)
return ret;
if (ret < 0)
return ret;
+ ret = tracing_update_buffers();
+ if (ret < 0)
+ return ret;
+
switch (val) {
case 0:
case 1: