Commit b0a45203 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tools: Allow out of order messages in forced flush

In forced flush (OE_FLUSH__HALF) we break the rules of the flush
timestamp via PERF_RECORD_FINISHED_ROUND event, so we could get out of
order event.

Do not force error in this case plus changing the output warning to use
WARN_ONCE.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-8q8794a8nlmpd1u8xrqmcyd2@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent cee3ab9c
...@@ -169,6 +169,7 @@ int ordered_events__flush(struct perf_session *s, struct perf_tool *tool, ...@@ -169,6 +169,7 @@ int ordered_events__flush(struct perf_session *s, struct perf_tool *tool,
{ {
struct ordered_events *oe = &s->ordered_events; struct ordered_events *oe = &s->ordered_events;
static const char * const str[] = { static const char * const str[] = {
"NONE",
"FINAL", "FINAL",
"ROUND", "ROUND",
"HALF ", "HALF ",
...@@ -198,6 +199,7 @@ int ordered_events__flush(struct perf_session *s, struct perf_tool *tool, ...@@ -198,6 +199,7 @@ int ordered_events__flush(struct perf_session *s, struct perf_tool *tool,
} }
case OE_FLUSH__ROUND: case OE_FLUSH__ROUND:
case OE_FLUSH__NONE:
default: default:
break; break;
}; };
...@@ -211,6 +213,8 @@ int ordered_events__flush(struct perf_session *s, struct perf_tool *tool, ...@@ -211,6 +213,8 @@ int ordered_events__flush(struct perf_session *s, struct perf_tool *tool,
if (!err) { if (!err) {
if (how == OE_FLUSH__ROUND) if (how == OE_FLUSH__ROUND)
oe->next_flush = oe->max_timestamp; oe->next_flush = oe->max_timestamp;
oe->last_flush_type = how;
} }
pr_oe_time(oe->next_flush, "next_flush - ordered_events__flush POST %s, nr_events %u\n", pr_oe_time(oe->next_flush, "next_flush - ordered_events__flush POST %s, nr_events %u\n",
......
...@@ -14,6 +14,7 @@ struct ordered_event { ...@@ -14,6 +14,7 @@ struct ordered_event {
}; };
enum oe_flush { enum oe_flush {
OE_FLUSH__NONE,
OE_FLUSH__FINAL, OE_FLUSH__FINAL,
OE_FLUSH__ROUND, OE_FLUSH__ROUND,
OE_FLUSH__HALF, OE_FLUSH__HALF,
...@@ -32,6 +33,7 @@ struct ordered_events { ...@@ -32,6 +33,7 @@ struct ordered_events {
struct ordered_event *last; struct ordered_event *last;
int buffer_idx; int buffer_idx;
unsigned int nr_events; unsigned int nr_events;
enum oe_flush last_flush_type;
}; };
struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp); struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "util.h" #include "util.h"
#include "cpumap.h" #include "cpumap.h"
#include "perf_regs.h" #include "perf_regs.h"
#include "asm/bug.h"
static int perf_session__open(struct perf_session *session) static int perf_session__open(struct perf_session *session)
{ {
...@@ -500,10 +501,15 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event, ...@@ -500,10 +501,15 @@ int perf_session_queue_event(struct perf_session *s, union perf_event *event,
return -ETIME; return -ETIME;
if (timestamp < oe->last_flush) { if (timestamp < oe->last_flush) {
printf("Warning: Timestamp below last timeslice flush\n"); WARN_ONCE(1, "Timestamp below last timeslice flush\n");
pr_oe_time(timestamp, "out of order event"); pr_oe_time(timestamp, "out of order event");
pr_oe_time(oe->last_flush, "last flush"); pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n",
return -EINVAL; oe->last_flush_type);
/* We could get out of order messages after forced flush. */
if (oe->last_flush_type != OE_FLUSH__HALF)
return -EINVAL;
} }
new = ordered_events__new(oe, timestamp); new = ordered_events__new(oe, timestamp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment