@@ -16,8 +16,6 @@
# @TraceEventState:
# State of a tracing event.
#
-# @unavailable: The event is statically disabled.
-#
# @disabled: The event is dynamically disabled.
#
# @enabled: The event is dynamically enabled.
@@ -25,7 +23,7 @@
# Since: 2.2
##
{ 'enum': 'TraceEventState',
- 'data': ['unavailable', 'disabled', 'enabled'] }
+ 'data': ['disabled', 'enabled'] }
##
# @TraceEventInfo:
@@ -69,6 +67,7 @@
# @enable: Whether to enable tracing.
#
# @ignore-unavailable: Do not match unavailable events with @name.
+# Deprecated: since 11.2
#
# Since: 2.2
#
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#ifndef SDT_USE_VARIADIC
#define SDT_USE_VARIADIC 1
#endif
@@ -57,17 +55,17 @@ static inline void trace_test_blah(void *context, const char *filename)
qemu_loglevel_mask(LOG_TRACE)) {
#line 4 "trace-events"
qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 61 "all.h"
+#line 59 "all.h"
}
tracepoint(qemu, test_blah, context, filename);
if (trace_event_get_state(TRACE_TEST_BLAH)) {
#line 4 "trace-events"
ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
-#line 67 "all.h"
+#line 65 "all.h"
_simple_trace_test_blah(context, filename);
#line 4 "trace-events"
syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
-#line 71 "all.h"
+#line 69 "all.h"
}
}
@@ -86,17 +84,17 @@ static inline void trace_test_wibble(void *context, int value)
qemu_loglevel_mask(LOG_TRACE)) {
#line 5 "trace-events"
qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 90 "all.h"
+#line 88 "all.h"
}
tracepoint(qemu, test_wibble, context, value);
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
#line 5 "trace-events"
ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
-#line 96 "all.h"
+#line 94 "all.h"
_simple_trace_test_wibble(context, value);
#line 5 "trace-events"
syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
-#line 100 "all.h"
+#line 98 "all.h"
}
}
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#ifndef SDT_USE_VARIADIC
#define SDT_USE_VARIADIC 1
#endif
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#include "trace/ftrace.h"
@@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)
if (trace_event_get_state(TRACE_TEST_BLAH)) {
#line 4 "trace-events"
ftrace_write("test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
-#line 28 "ftrace.h"
+#line 26 "ftrace.h"
}
}
@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
#line 5 "trace-events"
ftrace_write("test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
-#line 41 "ftrace.h"
+#line 39 "ftrace.h"
}
}
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#include "qemu/log-for-trace.h"
@@ -26,7 +24,7 @@ static inline void trace_test_blah(void *context, const char *filename)
qemu_loglevel_mask(LOG_TRACE)) {
#line 4 "trace-events"
qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
-#line 30 "log.h"
+#line 28 "log.h"
}
}
@@ -41,7 +39,7 @@ static inline void trace_test_wibble(void *context, int value)
qemu_loglevel_mask(LOG_TRACE)) {
#line 5 "trace-events"
qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
-#line 45 "log.h"
+#line 43 "log.h"
}
}
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
@@ -8,8 +8,6 @@
#define _TRACE_TEST_BLAH_DSTATE 0
#define _TRACE_TEST_WIBBLE_DSTATE 0
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
false)
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
void _simple_trace_test_blah(void *context, const char *filename);
void _simple_trace_test_wibble(void *context, int value);
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#include <syslog.h>
@@ -24,7 +22,7 @@ static inline void trace_test_blah(void *context, const char *filename)
if (trace_event_get_state(TRACE_TEST_BLAH)) {
#line 4 "trace-events"
syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
-#line 28 "syslog.h"
+#line 26 "syslog.h"
}
}
@@ -37,7 +35,7 @@ static inline void trace_test_wibble(void *context, int value)
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
#line 5 "trace-events"
syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
-#line 41 "syslog.h"
+#line 39 "syslog.h"
}
}
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
@@ -10,8 +10,6 @@ extern TraceEvent _TRACE_TEST_BLAH_EVENT;
extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
extern uint8_t _TRACE_TEST_BLAH_DSTATE;
extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
-#define TRACE_TEST_BLAH_ENABLED 1
-#define TRACE_TEST_WIBBLE_ENABLED 1
#include <lttng/tracepoint.h>
#include "trace-ust-testsuite.h"
@@ -33,12 +33,6 @@ static inline const char * trace_event_get_name(TraceEvent *ev)
return ev->name;
}
-static inline bool trace_event_get_state_static(TraceEvent *ev)
-{
- assert(ev != NULL);
- return ev->sstate;
-}
-
/* it's on fast path, avoid consistency checks (asserts) */
#define trace_event_get_state_dynamic_by_id(id) \
(unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE)
@@ -102,39 +102,21 @@ static const char * trace_event_get_name(TraceEvent *ev);
* @id: Event identifier name.
*
* Get the tracing state of an event, both static and the QEMU dynamic state.
- *
- * If the event has the disabled property, the check will have no performance
- * impact.
*/
#define trace_event_get_state(id) \
- ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(id))
+ (trace_event_get_state_dynamic_by_id(id))
/**
* trace_event_get_state_backends:
* @id: Event identifier name.
*
- * Get the tracing state of an event, both static and dynamic state from all
+ * Get the tracing state of an event from all
* compiled-in backends.
*
- * If the event has the disabled property, the check will have no performance
- * impact.
- *
- * Returns: true if at least one backend has the event enabled and the event
- * does not have the disabled property.
+ * Returns: true if at least one backend has the event enabled
*/
#define trace_event_get_state_backends(id) \
- ((id ##_ENABLED) && id ##_BACKEND_DSTATE())
-
-/**
- * trace_event_get_state_static:
- * @id: Event identifier.
- *
- * Get the static tracing state of an event.
- *
- * Use the define 'TRACE_${EVENT_NAME}_ENABLED' for compile-time checks (it will
- * be set to 1 or 0 according to the presence of the disabled property).
- */
-static bool trace_event_get_state_static(TraceEvent *ev);
+ (id ##_BACKEND_DSTATE())
/**
* trace_event_get_state_dynamic:
@@ -148,7 +130,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev);
*
* Set the dynamic tracing state of an event.
*
- * Pre-condition: trace_event_get_state_static(ev) == true
*/
void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
@@ -14,7 +14,6 @@
* TraceEvent:
* @id: Unique event identifier.
* @name: Event name.
- * @sstate: Static tracing state.
* @dstate: Dynamic tracing state
*
* Opaque generic description of a tracing event.
@@ -24,7 +23,6 @@ typedef struct TraceEvent {
uint32_t id;
#endif
const char * name;
- const bool sstate;
uint8_t *dstate;
} TraceEvent;
@@ -14,7 +14,6 @@
void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
{
bool state_pre;
- assert(trace_event_get_state_static(ev));
/*
* We ignore the "vcpu" property here, since there's no target code. Then
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,7 +12,6 @@ TraceEvent _TRACE_TEST_BLAH_EVENT = {
.id = 0,
#endif
.name = "test_blah",
- .sstate = TRACE_TEST_BLAH_ENABLED,
.dstate = &_TRACE_TEST_BLAH_DSTATE
};
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
@@ -20,7 +19,6 @@ TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
.id = 0,
#endif
.name = "test_wibble",
- .sstate = TRACE_TEST_WIBBLE_ENABLED,
.dstate = &_TRACE_TEST_WIBBLE_DSTATE
};
TraceEvent *testsuite_trace_events[] = {
@@ -12,8 +12,6 @@
void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
{
- assert(trace_event_get_state_static(ev));
-
bool state_pre = *ev->dstate;
if (state_pre != state) {
if (state) {
@@ -167,15 +167,6 @@ static void do_trace_enable_events(const char *line_buf)
trace_event_iter_init_pattern(&iter, line_ptr);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
- if (!trace_event_get_state_static(ev)) {
- if (!is_pattern) {
- warn_report("trace event '%s' is not traceable",
- line_ptr);
- return;
- }
- continue;
- }
-
/* start tracing */
trace_event_set_state_dynamic(ev, enable);
if (!is_pattern) {
@@ -11,9 +11,10 @@
#include "qapi/error.h"
#include "qapi/qapi-commands-trace.h"
#include "control.h"
+#include "qemu/error-report.h"
-static bool check_events(bool ignore_unavailable, bool is_pattern,
+static bool check_events(bool is_pattern,
const char *name, Error **errp)
{
if (!is_pattern) {
@@ -24,27 +25,8 @@ static bool check_events(bool ignore_unavailable, bool is_pattern,
error_setg(errp, "unknown event \"%s\"", name);
return false;
}
-
- /* error for unavailable event */
- if (!ignore_unavailable && !trace_event_get_state_static(ev)) {
- error_setg(errp, "event \"%s\" is disabled", name);
- return false;
- }
-
- return true;
- } else {
- /* error for unavailable events */
- TraceEventIter iter;
- TraceEvent *ev;
- trace_event_iter_init_pattern(&iter, name);
- while ((ev = trace_event_iter_next(&iter)) != NULL) {
- if (!ignore_unavailable && !trace_event_get_state_static(ev)) {
- error_setg(errp, "event \"%s\" is disabled", trace_event_get_name(ev));
- return false;
- }
- }
- return true;
}
+ return true;
}
TraceEventInfoList *qmp_trace_event_get_state(const char *name,
@@ -56,7 +38,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
bool is_pattern = trace_event_is_pattern(name);
/* Check events */
- if (!check_events(true, is_pattern, name, errp)) {
+ if (!check_events(is_pattern, name, errp)) {
return NULL;
}
@@ -68,14 +50,10 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
value = g_new(TraceEventInfo, 1);
value->name = g_strdup(trace_event_get_name(ev));
- if (!trace_event_get_state_static(ev)) {
- value->state = TRACE_EVENT_STATE_UNAVAILABLE;
+ if (trace_event_get_state_dynamic(ev)) {
+ value->state = TRACE_EVENT_STATE_ENABLED;
} else {
- if (trace_event_get_state_dynamic(ev)) {
- value->state = TRACE_EVENT_STATE_ENABLED;
- } else {
- value->state = TRACE_EVENT_STATE_DISABLED;
- }
+ value->state = TRACE_EVENT_STATE_DISABLED;
}
QAPI_LIST_PREPEND(events, value);
}
@@ -91,18 +69,19 @@ void qmp_trace_event_set_state(const char *name, bool enable,
TraceEvent *ev;
bool is_pattern = trace_event_is_pattern(name);
+ if (has_ignore_unavailable && ignore_unavailable) {
+ warn_report_once("the 'ignore-unavailable' property is deprecated "
+ "and has no effect");
+ }
+
/* Check events */
- if (!check_events(has_ignore_unavailable && ignore_unavailable,
- is_pattern, name, errp)) {
+ if (!check_events(is_pattern, name, errp)) {
return;
}
/* Apply changes (all errors checked above) */
trace_event_iter_init_pattern(&iter, name);
while ((ev = trace_event_iter_next(&iter)) != NULL) {
- if (!trace_event_get_state_static(ev)) {
- continue;
- }
trace_event_set_state_dynamic(ev, enable);
}
}
@@ -39,12 +39,10 @@ def generate(events, backend, group):
' .id = 0,',
'#endif',
' .name = \"%(name)s\",',
- ' .sstate = %(sstate)s,',
' .dstate = &%(dstate)s',
'};',
event = e.api(e.QEMU_EVENT),
name = e.name,
- sstate = "TRACE_%s_ENABLED" % e.name.upper(),
dstate = e.api(e.QEMU_DSTATE))
out('TraceEvent *%(group)s_trace_events[] = {',
@@ -38,14 +38,6 @@ def generate(events, backend, group):
for e in events:
out('#define %s 0' % e.api(e.QEMU_DSTATE))
- # static state
- for e in events:
- if 'disable' in e.properties:
- enabled = 0
- else:
- enabled = 1
- out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
-
backend.generate_begin(events, group)
for e in events: