From nobody Sun Sep 14 03:29:41 2025 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 B6BCDC05027 for ; Fri, 27 Jan 2023 00:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232910AbjA0AUj (ORCPT ); Thu, 26 Jan 2023 19:20:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232512AbjA0AUg (ORCPT ); Thu, 26 Jan 2023 19:20:36 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9460638661; Thu, 26 Jan 2023 16:19:57 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id m7-20020a17090a71c700b0022c0c070f2eso6313847pjs.4; Thu, 26 Jan 2023 16:19:57 -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=egmLJ0P+nkdiEwtD39Tt2932c4Qbx1PdrWuvIbe74LM=; b=ie0A8zcKF9j7TIX3g9qM+PTdY7uRmKhAZxVglnX5CBztBqYSwewEz/OYuEi4robx5R 1p1Pnm24h61+vaD8Hlpx4BzxToI05Abkb1Di3rnKD24EUlL5hzTrr7Ehl8qp2buU+OJc MA7qCpsl2MLSwRuFoRBdwxQaRtMzJsEWd9GljRL/xGL0nZ2ymNi6/y77nKyhrM1uf6uP e8AP+KVsYP4Myop9q6Ver4WM5TuJGpRedpH1iBjaXQcUvIsk36+l1jE6PyVU0zLIMOr9 AlGnEgwlARX9JN1qnUQCOjMK+Z0NGQIR3zYuZCOVpMffkw536QFyKgcw64bRU9gv8QtW oZIQ== 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=egmLJ0P+nkdiEwtD39Tt2932c4Qbx1PdrWuvIbe74LM=; b=ZPcM6/go/9sGsYOMz9hPUA0AQ/6NQL9F4B67/U6gzQuMLyEqVT6hW9MYOadLIeaORp HDmSLoH/atRbLo9xClVfEalkRJPNne00xqhFV+X3vMRvitkiH3GE+oe2Ki1FPG5GgTe+ qC6bMNUQ4bKT8443mmj7tA5HW+wLS+a0sCjTh0sT1b21yFkbwHwjE7VhAVAcDA/WZfBz 9NgTLPDJMgJkAh3jFxYg0lTZfUuxtCZLuziSFORiBAVr5DddDNCL/nGKr92sfgjxipCx lgt58nd6Fof1Ny9Og8TuGJAlhSgSmElWMfDBS7u1pEsDYSEAgqyU94rWGaV2prWePBSb QXsg== X-Gm-Message-State: AFqh2kosUeg/Yv591aM1kTyIvJbrzAOsAv+L5kSwVKqKAYdzoMpXpu9I AOTLSrzCGVluQ12+Teuyg5E= X-Google-Smtp-Source: AMrXdXt9mkHJz7PniYBygy2W6ShGWQkHJ03NWwlEOckobh8UPWyxKMydEFMa+Gd+xO7b+EhaTU9eZw== X-Received: by 2002:a17:90a:aa83:b0:226:102:2dc9 with SMTP id l3-20020a17090aaa8300b0022601022dc9mr39248610pjq.14.1674778796351; Thu, 26 Jan 2023 16:19:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 16:19:55 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users@vger.kernel.org, Leo Yan , James Clark , Stephane Eranian Subject: [PATCH 1/4] perf inject: Use perf_data__read() for auxtrace Date: Thu, 26 Jan 2023 16:19:48 -0800 Message-Id: <20230127001951.3432374-2-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In copy_bytes(), it reads the data from the (input) fd and writes it to the output file. But it does with the read(2) unconditionally which caused a problem of mixing buffered vs unbuffered I/O together. You can see the problem when using pipes. $ perf record -e intel_pt// -o- true | perf inject -b > /dev/null [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB - ] 0x45c0 [0x30]: failed to process type: 71 It should use perf_data__read() to honor the 'use_stdio' setting. Fixes: 601366678c93 ("perf data: Allow to use stdio functions for pipe mode= ") Signed-off-by: Namhyung Kim Reviewed-by: James Clark --- tools/perf/builtin-inject.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 3f4e4dd5abf3..f8182417b734 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -215,14 +215,14 @@ static int perf_event__repipe_event_update(struct per= f_tool *tool, =20 #ifdef HAVE_AUXTRACE_SUPPORT =20 -static int copy_bytes(struct perf_inject *inject, int fd, off_t size) +static int copy_bytes(struct perf_inject *inject, struct perf_data *data, = off_t size) { char buf[4096]; ssize_t ssz; int ret; =20 while (size > 0) { - ssz =3D read(fd, buf, min(size, (off_t)sizeof(buf))); + ssz =3D perf_data__read(data, buf, min(size, (off_t)sizeof(buf))); if (ssz < 0) return -errno; ret =3D output_bytes(inject, buf, ssz); @@ -260,7 +260,7 @@ static s64 perf_event__repipe_auxtrace(struct perf_sess= ion *session, ret =3D output_bytes(inject, event, event->header.size); if (ret < 0) return ret; - ret =3D copy_bytes(inject, perf_data__fd(session->data), + ret =3D copy_bytes(inject, session->data, event->auxtrace.size); } else { ret =3D output_bytes(inject, event, --=20 2.39.1.456.gfc5497dd1b-goog From nobody Sun Sep 14 03:29:41 2025 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 9C37CC05027 for ; Fri, 27 Jan 2023 00:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbjA0AUm (ORCPT ); Thu, 26 Jan 2023 19:20:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbjA0AUg (ORCPT ); Thu, 26 Jan 2023 19:20:36 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF01214496; Thu, 26 Jan 2023 16:19:58 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id jm10so3386705plb.13; Thu, 26 Jan 2023 16:19:58 -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=l7c2k3JxwqHMLdDHaXxYBGINQa6xWp1S+b3x47KyaT4=; b=cLcixg53FrGqCZqahgbnaolNOkBAznVNgsgxBHrcm79QRm3mpWoYXfT3kM+6YfFd4o v9giZWvcrCVZlqcUCzBDv7xLXsZWBtq9RjcRotaic1QfAoo4gO7L0yeCDJLrIDca+AiJ uXsiQ3C3MKlY7JAMHh71O6x5XN5YgAwbo3geqdiE8GTfW8WvLfs/E6Vb4sEJ5m5DolIy LmKjZygNcmGn2ylmsot4kBqjfdbXO1yvjCCUoJKYx5k7fZNbcl2Ifr5p6VpHalkGy9Ul d931pvRMHlY3URQTdg2Xh8GkmTbKMfnubK1vevbZTHC/9BNs4s0F9UnqiBS4jqEyZYWa c2Ow== 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=l7c2k3JxwqHMLdDHaXxYBGINQa6xWp1S+b3x47KyaT4=; b=OFLqVa4WuKx9w8o0hc9xRcaDLlif43k8noQCDyjPevP6IJh8owO6XrsPqpT9LworF9 PH0UQF7vgztKPijGtMN8EUBKYnZ3C6ptauCvQeD5ipgFsfADiLDt9VX/x7zk1nZsxsXD KbozIrs9TfOt5BiH4M5Y3U5GO4DxMYWGn3W+FHwLiHxxecfvDahdLz3Td/C/4lyI2lX8 QNq0HQxlWc+llWWcB1MGuw3lNPh8lql3abi04cw4Xgvt/P732wdYtL75Te7H0DrjLpPl 7Xfc1sqo9ECL41TX2SZ9dXRf0dN8nKy+7DHypd2WNGVk0xLX29Y1rLrs5H42YcGLS0Bq Rlww== X-Gm-Message-State: AO0yUKVNDx6wvys7zQ+tO5h6jfUhQ5xOsyvkcpXTCOJaOmIDxznjowJo A+549oOiRA53MYIQEEa5lUw= X-Google-Smtp-Source: AK7set93PhuwHuth1EbjmCP60if7aPKCOjq8EXFgfdq5G8iXDZdrbce0yn82EqOK/7xHJ3JLJEJh1Q== X-Received: by 2002:a17:90b:3b52:b0:22c:b32:4806 with SMTP id ot18-20020a17090b3b5200b0022c0b324806mr4628545pjb.27.1674778797587; Thu, 26 Jan 2023 16:19:57 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 16:19:57 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users@vger.kernel.org, Leo Yan , James Clark , Stephane Eranian Subject: [PATCH 2/4] perf intel-pt: Do not try to queue auxtrace data on pipe Date: Thu, 26 Jan 2023 16:19:49 -0800 Message-Id: <20230127001951.3432374-3-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When it processes AUXTRACE_INFO, it calls to auxtrace_queue_data() to collect AUXTRACE data first. That won't work with pipe since it needs lseek() to read the scattered aux data. $ perf record -o- -e intel_pt// true | perf report -i- --itrace=3Di100 # To display the perf.data header info, please use --header/--header-only= options. # 0x4118 [0xa0]: failed to process type: 70 Error: failed to process sample For the pipe mode, it can handle the aux data as it gets. Fixes: dbd134322e74 ("perf intel-pt: Add support for decoding AUX area samp= les") Signed-off-by: Namhyung Kim Reviewed-by: James Clark --- tools/perf/util/auxtrace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index c2e323cd7d49..d4b04fa07a11 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -1133,6 +1133,9 @@ int auxtrace_queue_data(struct perf_session *session,= bool samples, bool events) if (auxtrace__dont_decode(session)) return 0; =20 + if (perf_data__is_pipe(session->data)) + return 0; + if (!session->auxtrace || !session->auxtrace->queue_data) return -EINVAL; =20 --=20 2.39.1.456.gfc5497dd1b-goog From nobody Sun Sep 14 03:29:41 2025 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 5501FC05027 for ; Fri, 27 Jan 2023 00:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjA0AUp (ORCPT ); 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 ); 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-Google-Smtp-Source: AMrXdXvkUR5oRbtsV5mWjJFH2P+uge3F8ZbD/MTQdfjQ29IbZjd8stskDXG0epzqIWhCEjZtb5NXhA== 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 From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users@vger.kernel.org, Leo Yan , James Clark , Stephane Eranian 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: James Clark --- 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 p= erf_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); --=20 2.39.1.456.gfc5497dd1b-goog From nobody Sun Sep 14 03:29:41 2025 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 4489AC05027 for ; Fri, 27 Jan 2023 00:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233130AbjA0AUt (ORCPT ); Thu, 26 Jan 2023 19:20:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbjA0AUj (ORCPT ); Thu, 26 Jan 2023 19:20:39 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EB0A3B0EC; Thu, 26 Jan 2023 16:20:01 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id z1-20020a17090a66c100b00226f05b9595so3398828pjl.0; Thu, 26 Jan 2023 16:20:01 -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=HRrV7TjTlPA/BkPaOPUYQ8wwbHiOpKT0qv7GK3Tslrg=; b=JPVvykV4MhgTf7Tw6GyypSnxNUhsiEiGHYhsEUqj/dj/oY4wZ6DjIqykUAAQRoi9aM etlaTcQ17oDUiRwR/JpFDZcivnt3IE+Fydm9QJOrqIncAHnAhvNAJ0YFCXzUjLmKGFko SnTKNCgB+gb7avdiA1X8r17hkBzJBoGAsR3ZtaYrADLWrWU2OLYh30c69NfAg7QpvbNB C+5DEdUXbdHap9B0da+1KD03J5KYkgx4EgtR0rkY53+7do8BysYsPzKZBzrqyK64JJn7 O0gXL5ApOoj8XukHkGKGrgrg8YmwkAaNq7ddEWxAXB3UgpR+MSnRzf9i4CO7OzlyELzY RfCA== 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=HRrV7TjTlPA/BkPaOPUYQ8wwbHiOpKT0qv7GK3Tslrg=; b=xp5EdG48cM9z/BuIRqcyhZUwxhC2Kg7yU0s81HB2jcvp4Kqp4a9XwutyzicPgpGWUG +QKmB5NSS+lDe7YN2TIUkQb8RGmEQa9Wr0iuOdyA/s0Mo5EKjRi3iHZU56GnxLu+F2Nl /qa8898CMSniDzzs0w1c8In1vaJnFebZVyi52KaVqjoepIUZtl5Bu7PGvpgjBnkQWm6w n/7IK0gwId3Y7GNGExQrd9cV16hkvN7wD3GDlpdDsbMWSxuvr8/LLyBr4pcnBh679RYx J7WXEW7T7VkuXxp61EdfFR0N/il6ocszCBHJ75/X/CWPrnj4bcXkeoPJOGcfrWXu7r9+ Iv4w== X-Gm-Message-State: AFqh2krsrufWwEGXxGATq2YiEjlCZoODNA9ULMFDC5XTnqejZFZWrxaB +vzLRtFPXc615XSnD8rbOow= X-Google-Smtp-Source: AMrXdXt150PwiZkkD0pHSBQ3CST0AJEU92tONX9WSdl1dAeFrnlea4VXE1Z24xjN26lvrT9LNFb4dw== X-Received: by 2002:a17:90b:1c0e:b0:22b:b5c7:4fc with SMTP id oc14-20020a17090b1c0e00b0022bb5c704fcmr25339679pjb.46.1674778800033; Thu, 26 Jan 2023 16:20:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 16:19:59 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users@vger.kernel.org, Leo Yan , James Clark , Stephane Eranian Subject: [PATCH 4/4] perf test: Add pipe mode test to the Intel PT test suite Date: Thu, 26 Jan 2023 16:19:51 -0800 Message-Id: <20230127001951.3432374-5-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The test_pipe() function will check perf report and perf inject with pipe input. Signed-off-by: Namhyung Kim Reviewed-by: James Clark --- tools/perf/tests/shell/test_intel_pt.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/she= ll/test_intel_pt.sh index f5ed7b1af419..4ddb17cb83c5 100755 --- a/tools/perf/tests/shell/test_intel_pt.sh +++ b/tools/perf/tests/shell/test_intel_pt.sh @@ -620,6 +620,22 @@ test_event_trace() return 0 } =20 +test_pipe() +{ + echo "--- Test with pipe mode ---" + # Check if it works with pipe + if ! perf_record_no_bpf -o- -e intel_pt//u uname | perf report -q -i- --i= trace=3Di10000 ; then + echo "perf record + report failed with pipe mode" + return 1 + fi + if ! perf_record_no_bpf -o- -e intel_pt//u uname | perf inject -b > /dev/= null ; then + echo "perf record + inject failed with pipe mode" + return 1 + fi + echo OK + return 0 +} + count_result() { if [ "$1" -eq 2 ] ; then @@ -647,6 +663,7 @@ test_virtual_lbr || ret=3D$? ; count_result $ret ; re= t=3D0 test_power_event || ret=3D$? ; count_result $ret ; ret=3D0 test_no_tnt || ret=3D$? ; count_result $ret ; ret=3D0 test_event_trace || ret=3D$? ; count_result $ret ; ret=3D0 +test_pipe || ret=3D$? ; count_result $ret ; ret=3D0 =20 cleanup =20 --=20 2.39.1.456.gfc5497dd1b-goog