linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf auxtrace: Fix auxtrace queue conflict
@ 2021-03-08 15:11 Adrian Hunter
  2021-03-08 16:54 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2021-03-08 15:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa, Andi Kleen; +Cc: linux-kernel

The only requirement of an auxtrace queue is that the buffers are in
time order.  That is achieved by making separate queues for separate
perf buffer or AUX area buffer mmaps.

That generally means a separate queue per cpu for per-cpu contexts,
and a separate queue per thread for per-task contexts.

When buffers are added to a queue, perf checks that the buffer cpu
and thread id (tid) match the queue cpu and thread id.

However, generally, that need not be true, and perf will queue
buffers correctly anyway, so the check is not needed.

In addition, the check gets erroneously hit when using sample mode
to trace multiple threads.

Consequently, fix that case by removing the check.

Reported-by: Andi Kleen <ak@linux.intel.com>
Fixes: e502789302a6 ("perf auxtrace: Add helpers for queuing AUX area tracing data")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/auxtrace.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 953f4afacd3b..5b6ccb90b397 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -298,10 +298,6 @@ static int auxtrace_queues__queue_buffer(struct auxtrace_queues *queues,
 		queue->set = true;
 		queue->tid = buffer->tid;
 		queue->cpu = buffer->cpu;
-	} else if (buffer->cpu != queue->cpu || buffer->tid != queue->tid) {
-		pr_err("auxtrace queue conflict: cpu %d, tid %d vs cpu %d, tid %d\n",
-		       queue->cpu, queue->tid, buffer->cpu, buffer->tid);
-		return -EINVAL;
 	}
 
 	buffer->buffer_nr = queues->next_buffer_nr++;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf auxtrace: Fix auxtrace queue conflict
  2021-03-08 15:11 [PATCH] perf auxtrace: Fix auxtrace queue conflict Adrian Hunter
@ 2021-03-08 16:54 ` Andi Kleen
  2021-03-09 12:35   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2021-03-08 16:54 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Arnaldo Carvalho de Melo, Jiri Olsa, linux-kernel

On Mon, Mar 08, 2021 at 05:11:43PM +0200, Adrian Hunter wrote:
> The only requirement of an auxtrace queue is that the buffers are in
> time order.  That is achieved by making separate queues for separate
> perf buffer or AUX area buffer mmaps.
> 
> That generally means a separate queue per cpu for per-cpu contexts,
> and a separate queue per thread for per-task contexts.
> 
> When buffers are added to a queue, perf checks that the buffer cpu
> and thread id (tid) match the queue cpu and thread id.
> 
> However, generally, that need not be true, and perf will queue
> buffers correctly anyway, so the check is not needed.
> 
> In addition, the check gets erroneously hit when using sample mode
> to trace multiple threads.
> 
> Consequently, fix that case by removing the check.

Thanks!

Reviewed-by: Andi Kleen <ak@linux.intel.com>

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf auxtrace: Fix auxtrace queue conflict
  2021-03-08 16:54 ` Andi Kleen
@ 2021-03-09 12:35   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-03-09 12:35 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Adrian Hunter, Jiri Olsa, linux-kernel

Em Mon, Mar 08, 2021 at 08:54:37AM -0800, Andi Kleen escreveu:
> On Mon, Mar 08, 2021 at 05:11:43PM +0200, Adrian Hunter wrote:
> > The only requirement of an auxtrace queue is that the buffers are in
> > time order.  That is achieved by making separate queues for separate
> > perf buffer or AUX area buffer mmaps.
> > 
> > That generally means a separate queue per cpu for per-cpu contexts,
> > and a separate queue per thread for per-task contexts.
> > 
> > When buffers are added to a queue, perf checks that the buffer cpu
> > and thread id (tid) match the queue cpu and thread id.
> > 
> > However, generally, that need not be true, and perf will queue
> > buffers correctly anyway, so the check is not needed.
> > 
> > In addition, the check gets erroneously hit when using sample mode
> > to trace multiple threads.
> > 
> > Consequently, fix that case by removing the check.
> 
> Thanks!
> 
> Reviewed-by: Andi Kleen <ak@linux.intel.com>

Thanks, applied.

- Arnaldo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-09 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 15:11 [PATCH] perf auxtrace: Fix auxtrace queue conflict Adrian Hunter
2021-03-08 16:54 ` Andi Kleen
2021-03-09 12:35   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).