Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3470519pxj; Tue, 1 Jun 2021 06:10:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj1OOIAYREqrue6gd1SaPhOiDqxWISMUZY/R+Y/5B/c+spLSyhccDiE8d/J56oURpwOIy4 X-Received: by 2002:a92:dd0c:: with SMTP id n12mr8718137ilm.236.1622553007895; Tue, 01 Jun 2021 06:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622553007; cv=none; d=google.com; s=arc-20160816; b=C3XSOVMrmSg4d6CTF2mefwjxsUwYPQrIF8qz7NKkVM2IlgYHh/Cd1dw2irbIOHQEQ1 GcARy6xwYLaQIbUWXaK3dQQkoWQka6Ah1Jr8WrorU1DzWHYlBPGsdUgLwXaYnB6LYjW3 paCAWWSPS1K0eeotFe2TQk0nc7XZS5IAuesM8f9lQjx+Ir3kFaEnaXB1azB6xhOvn9ll AEoqrUvenYOvDIVR0kNW1axSFYsxcB8E04HDw5pL2mMhIyxmH+5p3uAKT7VNjxAGS6Pb H9p8H6JGzvFrVJFvj6nvSWBL4Dqs80B54+ppAfMi+/Z1OXz/TPBV/c8EcjudOp+LJLJ7 snvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=2WPpRsZbSQV72dZyeqFbvgthxD940Hy7u8LPqrQgY3o=; b=jXp+28cNMPht+IQqagBrMcAMVFpUFewN2bmyW9M2vEN10XX/7W+yy787TkFrhMTSwo 6xIgkmtb9zt9VM6Co8GB5Mo2FY0kU0AAZ4zJ7hEEGw2BjCkGBL6f1oG7P45lRn/fmGuK J/58SharL+ulc+WTggHZlgBlG/SAU/Wgo4+q3HWw1vTSBiZ7SkGgb4AsgZsVna3TR2uD c4kBiHBKWtrzGqgUZ4cKS8/0PnpQVby7ru0gEJHaadjHyHfZcUXHBQa7fGX8/YlSj1zh EgA1OuWaXClIHAXETs4mDMfw0mMqVuaKZIauSSM3jNpJdndYVTOpwq/LVt4NtXTy7ogl g+Kw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x14si2197637ilg.28.2021.06.01.06.09.52; Tue, 01 Jun 2021 06:10:07 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233871AbhFANK4 (ORCPT + 99 others); Tue, 1 Jun 2021 09:10:56 -0400 Received: from foss.arm.com ([217.140.110.172]:49652 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbhFANKy (ORCPT ); Tue, 1 Jun 2021 09:10:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 16C2F6D; Tue, 1 Jun 2021 06:09:13 -0700 (PDT) Received: from [10.57.9.215] (unknown [10.57.9.215]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 44B683F719; Tue, 1 Jun 2021 06:09:09 -0700 (PDT) Subject: Re: [RFC PATCH v3] perf cs-etm: Split Coresight decode by aux records To: Mathieu Poirier 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 References: <20210527104234.24313-1-james.clark@arm.com> <11822824-7486-2333-f039-bfd801b86922@arm.com> From: James Clark Message-ID: Date: Tue, 1 Jun 2021 16:09:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/05/2021 18:37, Mathieu Poirier wrote: > 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. I've sent v4 with it applied. There was actually a mistake which broke the normal mode, so it was a good idea to apply it. > >> >> 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, >> >>