From patchwork Fri May 8 07:05:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Nakryiko X-Patchwork-Id: 219639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D656C4724C for ; Fri, 8 May 2020 07:06:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 117B520735 for ; Fri, 8 May 2020 07:06:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="hjzUswQN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbgEHHGG (ORCPT ); Fri, 8 May 2020 03:06:06 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:57714 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726883AbgEHHGF (ORCPT ); Fri, 8 May 2020 03:06:05 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 048762jx020938 for ; Fri, 8 May 2020 00:06:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=facebook; bh=baFpFbIDHaKMImJSdN+7dpCGgUiU8qjtIMJ347QphjM=; b=hjzUswQNPhbI4djz9GFbmaNGAWp550U/UPWZ/OOVA8KXVgKdbQeWtqjcZZVVkRyo+uHY JiNYr0WEf5VCMAy/joeFAw6+URdIiiDOok86S8EaWJ9+TY0IJzAFLibT5ilVJoJE7uIc OX/5KXygAJnfhpMlxgS7s7aRX0yzVPOitwU= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 30vtdfa52w-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 08 May 2020 00:06:05 -0700 Received: from intmgw002.03.ash8.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Fri, 8 May 2020 00:05:55 -0700 Received: by devbig012.ftw2.facebook.com (Postfix, from userid 137359) id B34052EC3844; Fri, 8 May 2020 00:05:49 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Andrii Nakryiko Smtp-Origin-Hostname: devbig012.ftw2.facebook.com To: , , , CC: , , Andrii Nakryiko Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH bpf-next 0/3] Add benchmark runner and few benchmarks Date: Fri, 8 May 2020 00:05:45 -0700 Message-ID: <20200508070548.2358701-1-andriin@fb.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-08_08:2020-05-07,2020-05-08 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 bulkscore=0 impostorscore=0 suspectscore=8 mlxlogscore=999 clxscore=1015 phishscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005080061 X-FB-Internal: deliver Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add generic benchmark runner framework which simplifies writing various performance benchmarks in a consistent fashion. This framework will be used in follow up patches to test performance of perf buffer and ring buffer as well. Patch #1 adds generic runner implementation and atomic counter benchmarks to validate benchmark runner's behavior. Patch #2 implements test_overhead benchmark as part of bench runner. It also add fmod_ret BPF program type to a set of benchmarks. Patch #3 tests faster alternatives to set_task_comm() approach, tested in test_overhead, in search for minimal-overhead way to trigger BPF program execution from user-space on demand. Andrii Nakryiko (3): selftests/bpf: add benchmark runner infrastructure selftest/bpf: fmod_ret prog and implement test_overhead as part of bench selftest/bpf: add BPF triggring benchmark tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile | 15 +- tools/testing/selftests/bpf/bench.c | 390 ++++++++++++++++++ tools/testing/selftests/bpf/bench.h | 74 ++++ tools/testing/selftests/bpf/bench_count.c | 91 ++++ tools/testing/selftests/bpf/bench_rename.c | 195 +++++++++ tools/testing/selftests/bpf/bench_trigger.c | 167 ++++++++ .../selftests/bpf/prog_tests/test_overhead.c | 14 +- .../selftests/bpf/progs/test_overhead.c | 6 + .../selftests/bpf/progs/trigger_bench.c | 47 +++ 10 files changed, 998 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/bpf/bench.c create mode 100644 tools/testing/selftests/bpf/bench.h create mode 100644 tools/testing/selftests/bpf/bench_count.c create mode 100644 tools/testing/selftests/bpf/bench_rename.c create mode 100644 tools/testing/selftests/bpf/bench_trigger.c create mode 100644 tools/testing/selftests/bpf/progs/trigger_bench.c