From patchwork Thu Sep 28 09:10:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 145957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3229805vqu; Thu, 28 Sep 2023 04:13:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJSjA96mk+7PG7Dq5gB2iL10H8jVaaxLYI++V+c5QChYjF2ZjEpKUNCtDYXhJSZ5DN8lSc X-Received: by 2002:a17:903:4284:b0:1ab:11c8:777a with SMTP id ju4-20020a170903428400b001ab11c8777amr786631plb.13.1695899589521; Thu, 28 Sep 2023 04:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695899589; cv=none; d=google.com; s=arc-20160816; b=Mw7HNUkrbWcmhIVyC1i8zd8ySpPeYvm0mT6mEZuGgARb2Zpp0M1DYDPAv2+PC7UZts FEG0M2JpXmmSxQRzBL7UEmUqImrmsQTQr+7Obtm2IA36QvLFgyGsZnvk9dIQlQM3zHQt qWPEY6x2/chyBMMLRAUByJZS0LDEwtoZ6Swv+WMK8oGmwqGQ9LaEYik/ntpe0ZAVKimx PUGg5l/o447fnruO+vFUfJNpmoWts975he5qMRbkFGB6xRt1X/jtY3qNTdQMy5pMolvm cR6mWlrRSkNQhvibIjNL9mrklUFkYL7Lz2ib8jFBqm3mCJrvNQeuhD4Tjm28GtbJHI8k 98aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=FVK41D3pjUkLmPBG8mi+/b/Hqyt6FcmuWJUqD1xxiGg=; fh=7ueK1huCq2Lf3LMjc8i3Ob70zhQl+8ZRdqYzG6swRYY=; b=VLDGN5WPQjBqtqPPwpFrrqVs4Vy/WYMITjK+s39zAhvmRZ3xY3NX1k3Amt5tf3Nz7b c19pyNRXU3iLkT+V5Okpbuza8egstfuNp3Aqg48Fi64tf3/tfyp/1trjiOP/Wkz2tmst TBdQEXn+seR5m9TNshAji5hL6AbJ9glSM9hvn8DXQH2GL045S/ww8EeAzOhlhEfnahnJ 1+5iApJJI9TgLoWPIkH2Qy/rbtp9YATRspJ5ZwzhSASdFHLGgFTaRCGIWTdXZ5uCc2Re LwJC3lwZY4R5/usTY3+cQgeHyUszdbsuPfDPN1w5NYBGwDFkStMGSPgp3QhNwOLgnT/b 8Klg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ayAqwZBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m1-20020a170902db0100b001c73e886f68si317264plx.316.2023.09.28.04.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 04:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ayAqwZBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0747980984BB; Thu, 28 Sep 2023 02:11:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231474AbjI1JKv (ORCPT + 21 others); Thu, 28 Sep 2023 05:10:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbjI1JKs (ORCPT ); Thu, 28 Sep 2023 05:10:48 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9DEC194; Thu, 28 Sep 2023 02:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695892248; x=1727428248; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3DmYCdj9rDpzb950+X8flSrseHZqV9/9+OWeCGl4lCo=; b=ayAqwZBLwc3nuaYIx3qwfN/0s2UXPo4uKlfuW/nGEpcFEUe7EV5hmu84 FuUQIJ9ttqy2bpLLVAJEGlyMambx5At0MEAEqXttLtCFGXCrOfcq6l/rP S6SlDFd6pLVAouTgGhdtDPEiP/YDnWmd09Y0XUyh562Kde+QjD5C+YCYs ZTadMA/FXrniU7F82GZcI1oP62Y6OEJ2MvAwla+xXPPJEVKoD4+YcVu6Q XsOMhkSJtEQsuEuTap8wPAhBCBpulLNn05HvE5ABjuXg/F88vwasxJRNa pxr2Blfu8vfV3E+AXSoJAfSWk3Fd4Mjw1ViE3Uzw1nWTsGCXR9jMU2E+H Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="625001" X-IronPort-AV: E=Sophos;i="6.03,183,1694761200"; d="scan'208";a="625001" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 02:10:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="726166133" X-IronPort-AV: E=Sophos;i="6.03,183,1694761200"; d="scan'208";a="726166133" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.53.62]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2023 02:10:44 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH] perf dlfilter: Add a test for object_code() Date: Thu, 28 Sep 2023 12:10:33 +0300 Message-Id: <20230928091033.33998-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 02:11:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778279607928303054 X-GMAIL-MSGID: 1778279607928303054 Extend the "dlfilter C API" test to test perf_dlfilter_fns.object_code(). Signed-off-by: Adrian Hunter Tested-by: Ian Rogers --- tools/perf/dlfilters/dlfilter-test-api-v0.c | 12 +++++++++++- tools/perf/dlfilters/dlfilter-test-api-v2.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/perf/dlfilters/dlfilter-test-api-v0.c b/tools/perf/dlfilters/dlfilter-test-api-v0.c index 72f263d49121..4083b1abeaab 100644 --- a/tools/perf/dlfilters/dlfilter-test-api-v0.c +++ b/tools/perf/dlfilters/dlfilter-test-api-v0.c @@ -289,6 +289,15 @@ static int check_attr(void *ctx) return 0; } +static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample) +{ + __u8 buf[15]; + + CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0); + + return 0; +} + static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early) { struct filter_data *d = data; @@ -314,7 +323,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void if (early && !d->do_early) return 0; - if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample)) + if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) || + check_object_code(ctx, sample)) return -1; if (early) diff --git a/tools/perf/dlfilters/dlfilter-test-api-v2.c b/tools/perf/dlfilters/dlfilter-test-api-v2.c index 38e593d92920..32ff619e881c 100644 --- a/tools/perf/dlfilters/dlfilter-test-api-v2.c +++ b/tools/perf/dlfilters/dlfilter-test-api-v2.c @@ -308,6 +308,15 @@ static int check_attr(void *ctx) return 0; } +static int check_object_code(void *ctx, const struct perf_dlfilter_sample *sample) +{ + __u8 buf[15]; + + CHECK(perf_dlfilter_fns.object_code(ctx, sample->ip, buf, sizeof(buf)) > 0); + + return 0; +} + static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void *ctx, bool early) { struct filter_data *d = data; @@ -333,7 +342,8 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void if (early && !d->do_early) return 0; - if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample)) + if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample) || + check_object_code(ctx, sample)) return -1; if (early)