Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EECEC61DA4 for ; Fri, 27 Jan 2023 15:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233986AbjA0Pe5 (ORCPT ); Fri, 27 Jan 2023 10:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbjA0Pex (ORCPT ); Fri, 27 Jan 2023 10:34:53 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C49C80003; Fri, 27 Jan 2023 07:34:52 -0800 (PST) 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 0FB132B; Fri, 27 Jan 2023 07:35:34 -0800 (PST) Received: from [10.57.48.133] (unknown [10.57.48.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 94B4B3F64C; Fri, 27 Jan 2023 07:34:50 -0800 (PST) Message-ID: Date: Fri, 27 Jan 2023 15:34:49 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 3/4] perf session: Avoid calling lseek(2) for pipe Content-Language: en-US To: Namhyung Kim , Adrian Hunter Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users@vger.kernel.org, Leo Yan , Stephane Eranian , Arnaldo Carvalho de Melo , Jiri Olsa References: <20230127001951.3432374-1-namhyung@kernel.org> <20230127001951.3432374-4-namhyung@kernel.org> From: James Clark In-Reply-To: <20230127001951.3432374-4-namhyung@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/01/2023 00:19, Namhyung Kim wrote: > We should not call lseek(2) for pipes as it won't work. And we already > in the proper place to read the data for AUXTRACE. Add the comment like > in the PERF_RECORD_HEADER_TRACING_DATA. > > Signed-off-by: Namhyung Kim > --- > tools/perf/util/session.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index 7c021c6cedb9..fdfe772f2699 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -1699,8 +1699,13 @@ static s64 perf_session__process_user_event(struct perf_session *session, > case PERF_RECORD_AUXTRACE_INFO: > return tool->auxtrace_info(session, event); > case PERF_RECORD_AUXTRACE: > - /* setup for reading amidst mmap */ > - lseek(fd, file_offset + event->header.size, SEEK_SET); > + /* > + * Setup for reading amidst mmap, but only when we > + * are in 'file' mode. The 'pipe' fd is in proper > + * place already. > + */ > + if (!perf_data__is_pipe(session->data)) > + lseek(fd, file_offset + event->header.size, SEEK_SET); I'm not sure if it means anything, but Arm SPE works both with and without this change, although I did have to skip the build-id inject part: perf record -o- -e arm_spe// stress -c 1 -t 1 | \ perf report -i- --itrace=i1000 > return tool->auxtrace(session, event); > case PERF_RECORD_AUXTRACE_ERROR: > perf_session__auxtrace_error_inc(session, event);