From patchwork Sun Feb 19 06:13:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 59082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp716370wrn; Sat, 18 Feb 2023 22:17:46 -0800 (PST) X-Google-Smtp-Source: AK7set9W1NBLhbg9uU8MNjSCjqYfXOh4W9ZjCtV+rfYK31uNiZ4SMjeIOCF+9YnWMo6tescKrpVJ X-Received: by 2002:a17:90b:4ad1:b0:233:f354:e7df with SMTP id mh17-20020a17090b4ad100b00233f354e7dfmr1370883pjb.18.1676787465941; Sat, 18 Feb 2023 22:17:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676787465; cv=none; d=google.com; s=arc-20160816; b=DCu3wP8KTWfu8JhFpHfWqnGy58nT5vjbClS2/VaSG9+Ui60nuk5JKyfCMy8NZCGjaM 5RodRtObK+NF+3RmrE3Pd+cLbBcU79XFBFvrdmk4kO6/L602jQFU+V7mtHRziAzRULWe zlGtRcpPPExnGMLxzT0QqNzQ1eL4F74HkQLoUbsXuoN2IsizNNCaYrPVrapcc4XmvaPL AqRgzzslOTgb4HXYnxvV5HoP9tIR3QaPgsMZsEkBMa/WvsgEtUBn7LKhuvCNMWJd8CYU rd0TiujMvR3A6O6FMRiuQkGTfUybRCVWhsZNAsP6ePkbC+1ZTRp9p24H2POUDbuhZVkt dU0Q== 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=nMq0efOV3O0JcHMyIb01UsH1mIURqWe7SgZ9n1XJn8E=; b=Y6RUOOP3DFJQT11vMUsVmUqrXhHwq/OXRRvvXlBzzFvgz/au85sMJMSS5/Q2QlncIl /1tzUelXdLZBtffEGAFsdow+EOjnutUbu2plv68Ba7h8FZBMIAIuDH816kUJJvRNkpk1 f12OIVjR8mOfzerfQsVGsH5hNjCRz0NZ/+Asee3OxzgGBUP1TcVFA1m2+AsrjNDvbFh0 bJOSzQciVNhAVNms2KjfgYICdli+FfouIfLOWhT6X1fh7SQ7vskk4kwX0BzAYSY00U6P I/9TDD2wCRK5ZScfrGq1AWlsygU6XC7seWZef7COPjRSOMyeTzsLsy3i28oZ+oN7dNjk t1tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=frkM1tQ7; 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 pg6-20020a17090b1e0600b00230c06399e8si12530493pjb.89.2023.02.18.22.17.33; Sat, 18 Feb 2023 22:17:45 -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=frkM1tQ7; 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 S229821AbjBSGNx (ORCPT + 99 others); Sun, 19 Feb 2023 01:13:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjBSGNp (ORCPT ); Sun, 19 Feb 2023 01:13:45 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 399BB12BD8; Sat, 18 Feb 2023 22:13:44 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id t4so577358pjy.1; Sat, 18 Feb 2023 22:13:44 -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=nMq0efOV3O0JcHMyIb01UsH1mIURqWe7SgZ9n1XJn8E=; b=frkM1tQ7mKrrCH7Sb53gTTNdy/doRYn0LX5IbsMRi7Ln5IobqBXI0WoEZciIinIwj9 fjcIApJ+/QVVsu3uYdmIFk3XXFKZK/jzBa7OoyjJmN6t6RoJjQJJBcvYeKnArAZLYvPn WxQEJDXWV7yBw+I2ZeTyH0l8GCI4FRnmIVl3JUF3lBamrsk/Zt5a6PHHgeN7Kg+sRZ3v D1ukJzDybnwO1suEYQZSdktM9A2u+iM3yh8YNivS6ihTMGTULPBODS6NIL+XtR1HToeO 3/NQ3ToFyOQwUCyePauOUZZDwRA1UyrkbUdmMdSkJVA5qb3qf7HwBt7V8M8AD32ugEuV dJKw== 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=nMq0efOV3O0JcHMyIb01UsH1mIURqWe7SgZ9n1XJn8E=; b=Zu0EXhhgIbpB9bARIjc+OV5rwsaaDXKfHn9E9/DrcU56PwPprQbMmuwz/FRw/GANFx lBuFj1qFrZd3beRLoR8lirshGpeph95AltzHvM0ahYnq7j6dYXEb7fqBZTg1dS4GtVhA GU4ICFhGrFPQ91BmIEOlzm1e/Mvjh8Igkh8JxhZSqbxold66Fs3Mt4hKg0mk8FkJGH9l KOqhj0FFSoMZwC1GrHj4EP+1eZdoaiFM4nI6lBYKaHO+yayyPLXaILuD2SpHep9vRd1M rUZSfDTr8UYqxJKOvv+hrQXFb4ivws5Hs2zecPn4Ou7M82gCHvstpG92ve3CaHyoVhRR cefg== X-Gm-Message-State: AO0yUKUEoQkYwE6z+zNMiWs76uBd96RPtQ4TVFngGIh454Qe7IMm+Cy9 DKVnhErctbLr3S/KkMVCqB0= X-Received: by 2002:a05:6a20:394e:b0:bc:6ef3:1e74 with SMTP id r14-20020a056a20394e00b000bc6ef31e74mr6120093pzg.37.1676787223536; Sat, 18 Feb 2023 22:13:43 -0800 (PST) Received: from moohyul.svl.corp.google.com ([2620:15c:2d4:203:70ac:ab5:11d3:d785]) by smtp.gmail.com with ESMTPSA id q16-20020a170902dad000b00189ac5a2340sm1182140plx.124.2023.02.18.22.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 22:13:43 -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/8] perf bpf filter: Add more weight sample data support Date: Sat, 18 Feb 2023 22:13:27 -0800 Message-Id: <20230219061329.1001079-7-namhyung@kernel.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230219061329.1001079-1-namhyung@kernel.org> References: <20230219061329.1001079-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?1758239094188636265?= X-GMAIL-MSGID: =?utf-8?q?1758239094188636265?= 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: