From patchwork Tue Feb 14 05:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 56668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2767891wrn; Mon, 13 Feb 2023 21:09:05 -0800 (PST) X-Google-Smtp-Source: AK7set+4zTzYNE83+RdymEqiaz9kLbxNf47hwr++C/3SL/SdrY3x98gqZ9H4F7VsdLEGEijlMfEl X-Received: by 2002:a17:906:d7b3:b0:8a4:e0a2:e774 with SMTP id pk19-20020a170906d7b300b008a4e0a2e774mr1513040ejb.29.1676351345292; Mon, 13 Feb 2023 21:09:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676351345; cv=none; d=google.com; s=arc-20160816; b=L6lULIoMhMZdL2Vp4hjs2K06HrkcKLcTsNKOMleIjCNFTww+Ia1ZQsZhVTBMeosGv4 ZmWAWP5wnIVUJijPYeJtYKOzcNeD3lMWd7hmeTKPOc5xT1CFIa1axA6DtiKvXtE90KLA KReKEIS6dh9uYA/mWGZjdtaGdLC4f+3yAWx87+vMvzAlXTjcwN69ZEAXJP//nYpOC5yF efkosQc0GD84SMXJb4SZlZk83J41UZgx9ysUQ3B2vpCqkOBVrV12D/f8RpdSFsQeCN6e yQEtLfsfdviUcxtklB2ShFK9Y7DNq1e5Y/RhjVcxjxbyrMUTQm1unnX+fg9suvlDrMKC fdXw== 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=6GgY8PAE7TX9qFf4QOA0TPUy0m2n+TuiK45QUolCwnM=; b=YZGe8lBUyWUhkbhpo689+9twqHJf0By+b0H+2nSxyDu6cdKTl5LsBZNrsvmWe3VyMn AJmFLvhN3B0Ff5FLh8IkOW+HqclgvzJAhvUtu+9cDYNZuA/vhhNNpeWqjKWnwrscTW+m q+AfMraNuR9LvJN9lM1/yPAd39UYv5zKnwMI63aJ3kQpYv8av4zyE89QdHpz7oOUFgrT VrAXdNQlpd/0l/qnl0PDMBhN4D4OGE1RpNJWBukP2BWoB4ZYE38Si1RjpNLKkyKadM6J qdkP0tz0Am7a0eveaVf9nQ3suQrzz9bf2ThTdV3FlwdK26N5gwqhBvOAjBJxIPTq3bcR IyrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Vtzu2Jd8; 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 um5-20020a170907cb0500b00870ecd1a334si18246988ejc.889.2023.02.13.21.08.42; Mon, 13 Feb 2023 21:09:05 -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=Vtzu2Jd8; 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 S231263AbjBNFFh (ORCPT + 99 others); Tue, 14 Feb 2023 00:05:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjBNFFL (ORCPT ); Tue, 14 Feb 2023 00:05:11 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 474E51284B; Mon, 13 Feb 2023 21:05:05 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id gd1so3233084pjb.1; Mon, 13 Feb 2023 21:05:05 -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=6GgY8PAE7TX9qFf4QOA0TPUy0m2n+TuiK45QUolCwnM=; b=Vtzu2Jd84dLUVnnINxxKqlgfaHwv55D/YSQ0RnG4ylwfeDuCwcBRf3ImNHVyTuf5b0 CdQDwpmCcNwZtacR/cxiaSFYC6EzAvWYJ2qnjryscVq9LtJQBh4hrmKmYAsR8HT3whB/ lyOfjy3z2js4V6LDt/CAUHIAJmqM5MGR+6gCKDPSwRHge73uz4OYw88ax3LzuQj5NhAL QLG+N4O9uEPruinvmEuZDyi5Bga4ITpQC5eE1IKFj/gB54yqd5p8vqRR6FFHKcki7IiS PVXws6nmYmdPPwV9XunX/0Z3nxhJ/fwrEZRpmNNL4bIX6LiyKXlNU8ocHib+6dDBkYc9 /2sQ== 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=6GgY8PAE7TX9qFf4QOA0TPUy0m2n+TuiK45QUolCwnM=; b=sqsmsL6BsNTyFCEuD8c1gMvOur4sl1KHbmREoGXeKQwMPv7SVZfhlnBqQZ+UMgxepZ nz31z9N88GLYhWT0k6/bsKXposfnrbAdOc59/pCIHxCHAmv+8am4M0+RtTiN5eGnrRjD y63+PF/yTuqX4t3rY7P1oIevfWqSkyIxrJ+x+ibO4qKHHVsLvgXsrPHFyCbTMD0bwMuw +tOCL5FPGBasqpFiIBySXG99tbmyNwo4c0lliYgVEYbqIPhemaya68O0q0f0AmJpQqjd +ufQF0sE0OPjJKJEZCUWIThu75fCxJVaWGEwlQ7i8u6ihUH2EP0VRgF65DvKswUM+ID7 ueng== X-Gm-Message-State: AO0yUKUG51GHLeOsklStoGEXCb8dhtrygJkCn569WpLcCEHWivW6v1Gi wJdk3WJKrhwXkGMm2FihMiM= X-Received: by 2002:a17:902:7081:b0:199:2e01:13fb with SMTP id z1-20020a170902708100b001992e0113fbmr15106661plk.20.1676351104859; Mon, 13 Feb 2023 21:05:04 -0800 (PST) Received: from moohyul.svl.corp.google.com ([2620:15c:2d4:203:de3c:c4c2:3f15:764d]) by smtp.gmail.com with ESMTPSA id k18-20020a170902761200b001932a9e4f2csm9045593pll.255.2023.02.13.21.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 21:05:04 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Peter Zijlstra , Ingo Molnar , Ian Rogers , Adrian Hunter , Andi Kleen , Kan Liang , Song Liu , Stephane Eranian , Ravi Bangoria , Leo Yan , James Clark , Hao Luo , LKML , linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 6/7] perf bpf filter: Add more weight sample data support Date: Mon, 13 Feb 2023 21:04:51 -0800 Message-Id: <20230214050452.26390-7-namhyung@kernel.org> X-Mailer: git-send-email 2.39.1.581.gbfd45094c4-goog In-Reply-To: <20230214050452.26390-1-namhyung@kernel.org> References: <20230214050452.26390-1-namhyung@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757781788481010175?= X-GMAIL-MSGID: =?utf-8?q?1757781788481010175?= The weight data consists of a couple of fields with the PERF_SAMPE_WEIGHT_STRUCT. Add weight{1,2,3} term to select them separately. Also add their aliases like 'ins_lat', 'p_stage_cyc' and 'retire_lat'. Signed-off-by: Namhyung Kim --- tools/perf/util/bpf-filter.l | 6 ++++++ tools/perf/util/bpf_skel/sample_filter.bpf.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/tools/perf/util/bpf-filter.l b/tools/perf/util/bpf-filter.l index 5117c76c7c7a..bdc06babb028 100644 --- a/tools/perf/util/bpf-filter.l +++ b/tools/perf/util/bpf-filter.l @@ -61,6 +61,12 @@ addr { return sample(PERF_SAMPLE_ADDR); } period { return sample(PERF_SAMPLE_PERIOD); } txn { return sample(PERF_SAMPLE_TRANSACTION); } weight { return sample(PERF_SAMPLE_WEIGHT); } +weight1 { return sample_part(PERF_SAMPLE_WEIGHT_STRUCT, 1); } +weight2 { return sample_part(PERF_SAMPLE_WEIGHT_STRUCT, 2); } +weight3 { return sample_part(PERF_SAMPLE_WEIGHT_STRUCT, 3); } +ins_lat { return sample_part(PERF_SAMPLE_WEIGHT_STRUCT, 2); } /* alias for weight2 */ +p_stage_cyc { return sample_part(PERF_SAMPLE_WEIGHT_STRUCT, 3); } /* alias for weight3 */ +retire_lat { return sample_part(PERF_SAMPLE_WEIGHT_STRUCT, 3); } /* alias for weight3 */ phys_addr { return sample(PERF_SAMPLE_PHYS_ADDR); } code_pgsz { return sample(PERF_SAMPLE_CODE_PAGE_SIZE); } data_pgsz { return sample(PERF_SAMPLE_DATA_PAGE_SIZE); } diff --git a/tools/perf/util/bpf_skel/sample_filter.bpf.c b/tools/perf/util/bpf_skel/sample_filter.bpf.c index e9a0633d638d..5b239f194fa9 100644 --- a/tools/perf/util/bpf_skel/sample_filter.bpf.c +++ b/tools/perf/util/bpf_skel/sample_filter.bpf.c @@ -46,6 +46,14 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx, return kctx->data->period; case PERF_SAMPLE_TRANSACTION: return kctx->data->txn; + case PERF_SAMPLE_WEIGHT_STRUCT: + if (entry->part == 1) + return kctx->data->weight.var1_dw; + if (entry->part == 2) + return kctx->data->weight.var2_w; + if (entry->part == 3) + return kctx->data->weight.var3_w; + /* fall through */ case PERF_SAMPLE_WEIGHT: return kctx->data->weight.full; case PERF_SAMPLE_PHYS_ADDR: