Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp924604pxj; Thu, 27 May 2021 15:11:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaIMqPQ4GbOCv5YK4959BjdE7tI8un+C3cIEVZtDK/4ez2p5qQCfGl/boRJAJpz6VwWioA X-Received: by 2002:a05:6402:268f:: with SMTP id w15mr6457456edd.321.1622153491440; Thu, 27 May 2021 15:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622153491; cv=none; d=google.com; s=arc-20160816; b=TSt+Lk5H9TTQM4GsnE2ct/v83rceSBqsvLn5/MXORjtKWkPV8FkqSuiiFM22zFN/D2 S3CtuJCYvFWTjb3m+WejwFD0yGOudRXE6acxmo0jJfMPXQvV1FKGOsZgNZpByLNxsFsJ u1PH1Nd8V65c3WM9hW2b7jmyFdS32XkQkeUXnWX/hrVRjVtcT5nniqKOv65tfdxoV2Wc m4sxNsbYmATLuiMyJPtBL4a2FRAHIa+a1LO0fcyv3eUpuli4t6BzGJeAg61B7WBwiw1O XtMCIZC5ibI2Bci3e7jEZaSXCY2aNMjz+GDabU47qnwL+mpr2QLgfVYHB1WGCFfCSfur M9mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2crjK0WkoLk1yIKgn4T+sf7fuQ4+lslYOkCkxigqz6k=; b=oc90bSyLAIAUs0DboqctZW+eJtokoAE5C5moXlUaDM5Y6jTtnIsgykrDIOPfcb0Cb0 qTaZ2MIb9rdinsZH3NzZ+cWH+4pZMDPq7jzo9uP5JsisVtGffd2zKw8HIFBBrYvCCCHA 1rC1BKlK9rdgbrwcVqMaOcbvzSLV9WCGxP+m66DkH9qB5tXHhRYPhRnbP/J/NoxIX4VC tMUYLnubT2jio/IlD0F18zrPzd2bwqV9hIGAOMll9V5dtRcjrOoKQykecPPnKbJzjzBX mMp1G6a29V3O6KzCPzEDeze85yuC3kz4xOc02lBITzT+qI9Gakv9lURMWeqGjstgV2cx xZbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HZqATLPb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gg22si3306923ejb.70.2021.05.27.15.11.07; Thu, 27 May 2021 15:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HZqATLPb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234675AbhE0Pjo (ORCPT + 99 others); Thu, 27 May 2021 11:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234146AbhE0Pjk (ORCPT ); Thu, 27 May 2021 11:39:40 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5695C061574 for ; Thu, 27 May 2021 08:38:06 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id j30so639670ila.5 for ; Thu, 27 May 2021 08:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2crjK0WkoLk1yIKgn4T+sf7fuQ4+lslYOkCkxigqz6k=; b=HZqATLPbPzHq6IDZSeyW6yH3VLhnhrOp5bu1V+jQffAojleUQIGYzRCLBTyyAF7nTw QZdn6q3lNQvvH94cVuMX6+YSeETwJjiUqVI3hHgZEWGje65RasGlKI9IU2/Qb6W5IpLp 6aUq14d4eX44abInTxfQRMnCoTlWzntjphX6fjdlh9f5UrKWtoqdgrFS6068t/uofmQE C+Had2Qt+I5/EBQaI2YQq1uvB7x5OhaH1Ts6Q1Yg9zqyx1Dj6uD8LBdBx7+tmCU2Kqik QBO9GxjTTyNCd7BpIvdFDrbKyasY2MWTur57x6ZjClfx+FC85KZkhYHcxjjx58ISBnfL m8aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2crjK0WkoLk1yIKgn4T+sf7fuQ4+lslYOkCkxigqz6k=; b=DnKPBNurpSmEcuHrrWu9nFIodQ7oCx3/LN5ybjA7iRFuG4QDEJcuvYC8mX/WdAUnlV VJgrlRMvi+Ra4V24MnRSAeiok+KTiOBqTSsqiggih/yypwVoqTFc9wO8XzSEKx/rs/J4 AgTLkG4xyuU4M8N/Oj8KSFJp1mSMrupSiAL/cwXJYPUalrCC3r9tw70wNBYbdDIMWzw6 MmLwbN80Q7l9AIjBm5w9JGBnEhQ0uKxEL+nfC0HWLgz75HCwp4m9rB/p+FmkFSjzumim z3PFFgKCENHJat0n7RhlTVw2VTNXvomOoQ3Z4Sa2sGfhhr+2szlvwUX1e60YmQ8IcyUC 8uyw== X-Gm-Message-State: AOAM5338X+m+Ef6PH+tK8GjzGbtI5m+3Jh0imbLjyd2q0sl5MJfsGr71 /U8BhKjm7jiCeJcNB85NfDeOqNLDMPZkuo6CbFpRMw== X-Received: by 2002:a92:c54a:: with SMTP id a10mr3421574ilj.140.1622129885983; Thu, 27 May 2021 08:38:05 -0700 (PDT) MIME-Version: 1.0 References: <20210527104234.24313-1-james.clark@arm.com> <11822824-7486-2333-f039-bfd801b86922@arm.com> In-Reply-To: <11822824-7486-2333-f039-bfd801b86922@arm.com> From: Mathieu Poirier Date: Thu, 27 May 2021 09:37:54 -0600 Message-ID: Subject: Re: [RFC PATCH v3] perf cs-etm: Split Coresight decode by aux records To: James Clark Cc: Arnaldo Carvalho de Melo , Coresight ML , Leo Yan , Al Grant , branislav.rankov@arm.com, Denis Nikitin , "Suzuki K. Poulose" , Anshuman Khandual , Mike Leach , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel , linux-perf-users@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 May 2021 at 07:46, James Clark wrote: > > > > On 27/05/2021 13:42, James Clark wrote: > > Populate the auxtrace queues using AUX records rather than whole > > auxtrace buffers. > > > ... > > Snapshot mode still needs to be tested. > > > > Snapshot mode is also working, but needs the following patch applied to reverse aux_offset > from the end of the buffer to the beginning: It might be better to send another revision with this patch included in to make sure everyone is looking at (and testing) the same thing. > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 5d6c03488187..9db556e14dfa 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -2700,6 +2700,7 @@ static int cs_etm__queue_aux_fragment(struct perf_session *session, > struct perf_record_auxtrace *auxtrace_event; > union perf_event auxtrace_fragment; > bool matchesCpuPid; > + __u64 aux_offset; > struct cs_etm_auxtrace *etm = container_of(session->auxtrace, > struct cs_etm_auxtrace, > auxtrace); > @@ -2730,19 +2731,26 @@ static int cs_etm__queue_aux_fragment(struct perf_session *session, > else > matchesCpuPid = auxtrace_event->cpu == sample->cpu; > > + /* > + * In snapshot/overwrite mode, the head points to the end of the buffer so aux_offset needs > + * to have the size subtracted so it points to the beginning as in normal mode. > + */ > + if (aux_event->flags && PERF_AUX_FLAG_OVERWRITE) > + aux_offset = aux_event->aux_offset - aux_event->aux_size; > + else > + aux_offset = aux_event->aux_offset; > + > if (matchesCpuPid && > - aux_event->aux_offset >= auxtrace_event->offset && > - aux_event->aux_offset + aux_event->aux_size <= > - auxtrace_event->offset + auxtrace_event->size) { > + aux_offset >= auxtrace_event->offset && > + aux_offset + aux_event->aux_size <= auxtrace_event->offset + auxtrace_event->size) { > /* > * If this AUX event was inside this buffer somewhere, create a new auxtrace event > * based on the sizes of the aux event, and queue that fragment. > */ > auxtrace_fragment.auxtrace = *auxtrace_event; > auxtrace_fragment.auxtrace.size = aux_event->aux_size; > - auxtrace_fragment.auxtrace.offset = aux_event->aux_offset; > - file_offset += aux_event->aux_offset - auxtrace_event->offset + > - auxtrace_event->header.size; > + auxtrace_fragment.auxtrace.offset = aux_offset; > + file_offset += aux_offset - auxtrace_event->offset + auxtrace_event->header.size; > return auxtrace_queues__add_event(&etm->queues, > session, > &auxtrace_fragment, > >