Message ID | 20230127001951.3432374-4-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp566317wrn; Thu, 26 Jan 2023 16:35:11 -0800 (PST) X-Google-Smtp-Source: AK7set+S36PdbQlbHAd012EDvmpOnnehM8+PeI1vE7kvldLW9KflE0KAV5XGnwWZN5d/SSYZq6lw X-Received: by 2002:a05:6402:5114:b0:4a0:a850:176c with SMTP id m20-20020a056402511400b004a0a850176cmr11636308edd.11.1674779711111; Thu, 26 Jan 2023 16:35:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674779711; cv=none; d=google.com; s=arc-20160816; b=orbzYmKB6Oo6d9KCPEwc743I0gQpa8QKbVvDQC2HHBarJh8RYkgGNt6kSMoJB7cF+y P2qB43VWImF663AVB2p0K2H04xJP+iXuZXVqSrnbKSiV+j5yFcfY6FsX9BinZN18fEUP XRMnIpKKrCFgFJbIChpV4eX3Bob25/35wL+7fPWfiPJhMt9p4QyXMB+EYeNPWMwR3yAD 4oNjGIkfvhuLHU9Cyyzney+vV+iOVJn02o5NMt7kfah0LXBsUJZOFTEwRCG6or5fgZAs eBOxKGAJw5NQeK0gQSV1MXnao4KnnC2EHVQQzk+juYNhELiFTFWHW8YqhYPObQsFj/jI LAhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=mLtqR2vTJPsyXL+Kk95QTPsvoc9EHhO85tO4NsvnR/s=; b=RXMRQuCphLi6zeImzWxOIJOQc6anOabD9iHCixTbE959SehaL/POWxobo9inPUyCHt NB+K0/OY6nklVr1bUc4me0UQz2zinYs5eb1hjDs+/18t/sCko+KBhilDNVO+rlES8E0o 19/McWzv50BkD5RRzlGtmj4pbmntzALiezIUNR6Y3qltCFOKGpbGy3ktMa0OBkO/4ZNU pyOij1hihh1fC2cWjZ3XDAVrqWFYHlH5NH8ES1nx2F6wnicLjp5b5tTluTLbpjYMRbBV odrCJeLOXIX66t0VQ/y6D/3CUyHX7fwaOwHgdlk4upt+iXvXRR2Zz18dc3Ybs2YBuaCW Nu4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=D4iBm1Ol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a170906748b00b0086b5808d6b4si2873059ejl.717.2023.01.26.16.34.46; Thu, 26 Jan 2023 16:35:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=D4iBm1Ol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233055AbjA0AUp (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Thu, 26 Jan 2023 19:20:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232760AbjA0AUg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 26 Jan 2023 19:20:36 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB3D2B60F; Thu, 26 Jan 2023 16:19:59 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id jm10so3386744plb.13; Thu, 26 Jan 2023 16:19:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=mLtqR2vTJPsyXL+Kk95QTPsvoc9EHhO85tO4NsvnR/s=; b=D4iBm1OlCFLot8f30ioPALHeV1nPkB9M+r03xCKGGLDWICpvxtoxUhGC8wgbGo5xC4 ZMveWAISnon9BSgXnVGxveZ3krPkz6pOsZYanbW4rB9BDr0c2PbODYapGNewpnxwiRip /fAzDiNktmmGLgQojkqqHPKTJ3reuVA74595ClD6E4vrxAojTM4KHcOrLTz7DDS5W7D2 r3/Ie7MgvXLQUUem4YNRel1ZEQMdJ42UkEpBWJeaFJAN8YT93KJ+/Fq9eMvVaCISTNg7 Qj7WDsa0hPFR/59/wY4Kcp2Gjqngo2rzvawG+q7mMdBPEafKbvWtRn4CUpLkbv/bluVa 3o2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mLtqR2vTJPsyXL+Kk95QTPsvoc9EHhO85tO4NsvnR/s=; b=xdV1rriFLEHKtg+bz7BRQjcf10RL2rMsZNb0T+FRInY3oFeaDPn4IHAWbALirBSENt 2vUs++JMGFiATm4bNaIOTo9qX6BJm/4pYGqM4smFGw4oqxjAfwE+Sg3cG/nWeLFJgF0O +BuwtjUiOG9KVoSG8YscPIGUBJ7fpezCs+leG+ZjsN/l30FoQ1yhSDA7ZZivOakvvxHq 4E4Lbdqo6ASll8QtvYNNIrjufoy48ewHswYBdq63GccxMjkE7qtx84Ze1zaZlArClrUP CnCISzUP8sc8HNyt592y0S71nbPYPDn4MDUwXxiClI5GQX+ZKiCMPTnHsxnf+U6aE2SF 3ixg== X-Gm-Message-State: AFqh2kpbIlxzo9it9etDmFgc0y6wd+zJCPQM2OOBOH04ZCxKSfSvEXXj Voh95dnV/FoHT6pfXbocFOU= X-Received: by 2002:a17:90b:4d8e:b0:229:ade0:d0cf with SMTP id oj14-20020a17090b4d8e00b00229ade0d0cfmr37357783pjb.3.1674778798772; Thu, 26 Jan 2023 16:19:58 -0800 (PST) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:1f5d:eee8:d409:8a17]) by smtp.gmail.com with ESMTPSA id v15-20020a17090a088f00b00229f7376247sm1567270pjc.57.2023.01.26.16.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 16:19:58 -0800 (PST) Sender: Namhyung Kim <namhyung@gmail.com> From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>, Adrian Hunter <adrian.hunter@intel.com> Cc: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>, LKML <linux-kernel@vger.kernel.org>, Ian Rogers <irogers@google.com>, linux-perf-users@vger.kernel.org, Leo Yan <leo.yan@linaro.org>, James Clark <james.clark@arm.com>, Stephane Eranian <eranian@google.com> Subject: [PATCH 3/4] perf session: Avoid calling lseek(2) for pipe Date: Thu, 26 Jan 2023 16:19:50 -0800 Message-Id: <20230127001951.3432374-4-namhyung@kernel.org> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230127001951.3432374-1-namhyung@kernel.org> References: <20230127001951.3432374-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756133810355983569?= X-GMAIL-MSGID: =?utf-8?q?1756133810355983569?= |
Series |
perf intel-pt: Fix the pipe mode (v1)
|
|
Commit Message
Namhyung Kim
Jan. 27, 2023, 12:19 a.m. UTC
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 <namhyung@kernel.org>
---
tools/perf/util/session.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
Comments
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 <namhyung@kernel.org> > --- > 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);
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); return tool->auxtrace(session, event); case PERF_RECORD_AUXTRACE_ERROR: perf_session__auxtrace_error_inc(session, event);