Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3312888rdh; Thu, 28 Sep 2023 08:16:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJuVVssYYOapqMD79ITlTeRzC45u81ZlfIcixjOUjPN3JUjqq5ZLNA1uo1ssS9Iq3e4TTK X-Received: by 2002:a05:6a00:1394:b0:68f:edfd:2ac6 with SMTP id t20-20020a056a00139400b0068fedfd2ac6mr1851246pfg.0.1695914197908; Thu, 28 Sep 2023 08:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695914197; cv=none; d=google.com; s=arc-20160816; b=psHNPisU3TwrP0XQ6UbmX60fxzidHoIXHUSbczW5ZHjbw6SnNgwWM3CrlqB42N6U21 S8IduQpmJPCZifRe4ofzrok9waWsuWMSZAIDc3GQwGpeyRDUstIN3ByragcmWjROggFG FpUhPQe94ganIfkh4d8jNh5yqF8oZbfV+g5R+tmQC6BCrNF/Oa42HJHOtZX1Pp63zqjb 9WfsQ8/od5R0amDFUufTFbvmXX5jtAhCVkN43nCEGmi8jnXpybE+zhLznNLibN2rqwgz W0QVx5MhgzTrUoeiGyZY+j8eexLAvIIa15WGeYGgxjRMG0AbRj16hnRH5AAzHLYMrwsD 7M6w== 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 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id z19-20020a63e113000000b00580e32f778csi13344084pgh.506.2023.09.28.08.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 08:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; 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 23.128.96.35 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 D4AED80A0E37; Thu, 28 Sep 2023 02:11:32 -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 S231521AbjI1JKu (ORCPT + 99 others); Thu, 28 Sep 2023 05:10:50 -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 Content-Transfer-Encoding: 8bit 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:33 -0700 (PDT) Extend the "dlfilter C API" test to test perf_dlfilter_fns.object_code(). Signed-off-by: Adrian Hunter --- 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) -- 2.34.1