From patchwork Tue Mar 14 23:42:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 69897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2043167wrd; Tue, 14 Mar 2023 16:46:40 -0700 (PDT) X-Google-Smtp-Source: AK7set9OmlpK6uF5iEq9tnItUbfBp0j/OPZCv3PM2iGb1Hm81NHfwk8jA4lZIxmAVz6DAS9V1Qph X-Received: by 2002:a62:8402:0:b0:623:1396:4611 with SMTP id k2-20020a628402000000b0062313964611mr10907076pfd.9.1678837600096; Tue, 14 Mar 2023 16:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678837600; cv=none; d=google.com; s=arc-20160816; b=u6mTI4TAYJXDTh4RPFs5po5OVND5QQIbmpNJKfQQo1kU+vcjTNS9gCHs1hyo8kZU9/ wysQkMloWrzEqBTpm35uAWhrS3/hH9ZwoG+JFD0XiHOV7VcMQQPftOu0LhiV7sYUx0i7 77xgqZ1LCasJLzsbomAa+PWmNTWFJNLZqzu6/06jwJ5ehy32NgjuFONOaBfMEHkgoGnH xGwx3Z7yKZ7ed3h4QJLHAuUnkUfX4AQfDHA4SD8Tml65IGiiCO7Ssi37eFqiV1Hz0Ob+ PbI3hTmLEhx+5WcnK9ZiBC7i1E91zNctzpYZoz1MbUPUeyMt8/BzrP1dMxulXnzc5o6t aG8w== 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=x3XJiLzYWTl1qdcO6Aoy/MeuV984OrXXQga9tTJym9M=; b=t2gK414V8pJs9es8wD0ZvNwx2iyIexPB9Aj1Vrot8IvuBX77zm5pqKe4+FVV2//Sk5 LJvFWrZesgcATcnvWQxUmRsAYwFNM0pt011KfJoMj/vlTAcs7dpiiv+iWnXwSszldKXN E3avUMVedbo+cNNdS+c1ndaJeYosy4gwTE4AZ++v+87/75s9UNOsDfla+kGplWCaF7EB fhNrY1Gqm9X3UL2W0F4f3gKzOgQv6QOODcRd7V3FczjpZOU9U/gzCmcPfjaqc7bnuoXC PWkHLUa4BYeQODCkxa73IeVfz7vKbagG7EdiLlD1tifd5dDz8VS+XWAfVPqTBAwlhjqF WOtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YfwH9F1l; 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 73-20020a62184c000000b0060bfd9834adsi3361861pfy.212.2023.03.14.16.46.03; Tue, 14 Mar 2023 16:46:40 -0700 (PDT) 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=YfwH9F1l; 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 S230455AbjCNXor (ORCPT + 99 others); Tue, 14 Mar 2023 19:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbjCNXnL (ORCPT ); Tue, 14 Mar 2023 19:43:11 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6781A3D93D; Tue, 14 Mar 2023 16:42:48 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id p20so18249803plw.13; Tue, 14 Mar 2023 16:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678837368; 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=x3XJiLzYWTl1qdcO6Aoy/MeuV984OrXXQga9tTJym9M=; b=YfwH9F1l3G2eOx+tqRFUa5gB29eIlnIQOrF6uSb9KsL2XpNEOWQmorubCoMqQ57bJP O+AYOeY9gLBRyKGvm4ihpiE3x5jtp+Z7LJVE92OTXUHbWgn0u7w9zu4mjgPmoMHnCBC0 MueAdtYt3bDXEugMhsIC0JihNCyZZ2r1LTVuTWCCgn1kXudjxeJYFKSmQuW6vqy5R0+8 SVk9WBcSSOe0xk7HIQaY4s/o64qHreO0U4Is1N9l3T9FFnL6ARax72VWcwTlkpgh5olu MrduIAWItyaArnbirqCA3f3meGvglTJ3nTjJf1tU1/qD/Vr/FuPxLluDMbQnT+wOo/Fz vQ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678837368; 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=x3XJiLzYWTl1qdcO6Aoy/MeuV984OrXXQga9tTJym9M=; b=IdqIUw5JeF21z6SwqPSZnttABGNqVQ+oxnhoVhtSgfM9aev6IZ78bXg/M5qOlvBTRK jbX2UApp9Kd/LbjykEFvIBxuSEoq37bs/EXO3ezug+Ik/ghx8A+4WNbXhgv7Oot7KTck RONj7h1LAM+AFb+GJ+Rki/R6qb615O4cAimG1Xurx0hIucigCetpe5MdNwCI3DtygqBH lrwDGSlDfrz0pUArnMhUj7bcuv1qvzcn5UmVT2rTtnDEtooSR3bJRb9e50dtvyYH6zQI 8teuLzak5PRQnfEHlMnAbHs+rn0cjXQextkY2cWhO2IpgiZNhMVOdjPpbP12L/vU7/P2 /Jtw== X-Gm-Message-State: AO0yUKVteCNQMcSaP7k2MUmhTvmWaOb+GGDFacuMgitTXMoFtzIwL068 JjjQ9j9OlAY9hadhJM7MabI= X-Received: by 2002:a17:902:dac1:b0:19e:b6b0:6b3 with SMTP id q1-20020a170902dac100b0019eb6b006b3mr899832plx.15.1678837367776; Tue, 14 Mar 2023 16:42:47 -0700 (PDT) Received: from moohyul.svl.corp.google.com ([2620:15c:2d4:203:3826:a5cd:1f1d:6c85]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0019f39e4f120sm2280806plb.18.2023.03.14.16.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 16:42:47 -0700 (PDT) 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 06/10] perf bpf filter: Add more weight sample data support Date: Tue, 14 Mar 2023 16:42:33 -0700 Message-Id: <20230314234237.3008956-7-namhyung@kernel.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230314234237.3008956-1-namhyung@kernel.org> References: <20230314234237.3008956-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?1760388815463024528?= X-GMAIL-MSGID: =?utf-8?q?1760388815463024528?= The weight data consists of a couple of fields with the PERF_SAMPLE_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'. Acked-by: Jiri Olsa 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 ec12fc4d2ab8..419f923b35c0 100644 --- a/tools/perf/util/bpf-filter.l +++ b/tools/perf/util/bpf-filter.l @@ -71,6 +71,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 dddf38c27bb7..d930401c5bfc 100644 --- a/tools/perf/util/bpf_skel/sample_filter.bpf.c +++ b/tools/perf/util/bpf_skel/sample_filter.bpf.c @@ -54,6 +54,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: