Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1729231pxa; Sun, 2 Aug 2020 19:01:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOS+1dP+kIzvdt44CBfi+i/ysoR9E/TzkROik31lDpi/X+iWEv79ymSR6WmeoLd/GptGf4 X-Received: by 2002:a05:6402:2031:: with SMTP id ay17mr13369423edb.46.1596420101547; Sun, 02 Aug 2020 19:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596420101; cv=none; d=google.com; s=arc-20160816; b=qYf+Zt2twAc8NGHq5RCWGZuZaaTRxs2xYUFxgK9cMlWjJQwRha7DgSjAeko1nIpHZs lHd4RxSjOJlA1C/1POVfPc8u7lxIFBy36ysmLPjOoybkZ6kqn892i5YeBvo2WgY8DOQW 3Q459pbE5Bq4cNOH9AEdcG34vItKjnjSF2n1Y43cu82sI38V8qzgaps2z0Fnq291pAHX I4WeX8g503g+QmSam22viu/mXioRmbf+Wtqgb+/dbOBtqXdNR0tvsz16RlwkICTdUNzM ljYnAfbUkQuL7pqP+0as7feUj9/OGyfn1UotbG/BYJ5W35+elPixJ1KB8xI1Ht/PS/zH inZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rSlvuBkhKI8ZfP2CG2gpFzW6Sro8x7VblhmK9hkVZx0=; b=eESj5e98aKkJgrVms8tSqVmbLAB9nYKyAADs2HPJAjNM/45pSt0eWwkA5hponu3VlE OV74MN+z/w2Cf6+ehlpLfaRJxq+mhWIwp2ftBdgX1Ji2jV8w5XShzb9kQsAmirsVexqp z4aoop6J86fWRtECcRabY+HOGQ69T2J0y59Hgpp4J9svwmVmYJeyjsXOP9Rz43Bu2nje a6ndwgoVRzkDMRxEeElpwKHYi7Ceh8TpQLeOCCKVGXqf3GQ7DTaEgFbFvj4z4E0QX+Zg PQG+Ns1vgrjCpd+Kmqwd5rAbO/BTS1nIxeOOXfNWbFEc0lv2b9wuwJROPOrua/A8hehD rr4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cyOcAwQi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si9798965edv.492.2020.08.02.19.01.07; Sun, 02 Aug 2020 19:01:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cyOcAwQi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727006AbgHCBvo (ORCPT + 99 others); Sun, 2 Aug 2020 21:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgHCBvo (ORCPT ); Sun, 2 Aug 2020 21:51:44 -0400 Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3748AC06174A; Sun, 2 Aug 2020 18:51:44 -0700 (PDT) Received: by mail-yb1-xb43.google.com with SMTP id y134so14115896yby.2; Sun, 02 Aug 2020 18:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rSlvuBkhKI8ZfP2CG2gpFzW6Sro8x7VblhmK9hkVZx0=; b=cyOcAwQisRYt3bU2sWtyXgkBcHFLudWMY801kGb9j/mfVmEZ7+VtagXdSYpmDDIxef AWDcXoUjPF2vY44Mnh/ZmzViLICYpIKNPGawjr968PWZePsSsYbJnok/f4634SGoWtLJ WlfaptLiN2VBEHEhd412h3eBTCU6znetWu7/SWMxSaIyJjQkmIOAM3J+/FyjoWLTappk V9OaCMSD+6J/T5q2GEuQVVB1OHKECxV0pT6dzG1CwEVBRy2Qa7AColon08YeVepKGQwC KQyST25rihRWggpRqXnvN5lo7J+dy+yVTSzgS0dYTF+Vwi1Q8RAFTjCzC0ng5qzhiRdP d9Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rSlvuBkhKI8ZfP2CG2gpFzW6Sro8x7VblhmK9hkVZx0=; b=X1OiKD3Jelp/1JXUbCm4ZweajmZo1KJFK0ReQaff351Kr4Qdm+6qsZlDinbytMKH7n fYZ1+6CbMXRR1Cj6OsndRAyWiQv8np15MXbIyEH8kcAETVqDa2Rk9O1OXrGAWYP/QxxO SIQyW+UyCAEPA9G9flbjNkzs4CKcf/ywPae2VzCBhmUIIYpCJGvpRtxqIjsZXMBHuiA7 vZfzn86gsOZ3G5mQWxxfPXiXFxV2P5MJ/b91aWAkifACQTwEurIT8pW09FWkQmtpQ/8T m29r+ZIRhHcajbzzAjNxWbBunlknAM6EFF9fPLKrrI6rdjfk8cn7QsO7W4Pn+g38TKBs Iieg== X-Gm-Message-State: AOAM530c+dSApTdhF2QBcYipjZvlOm4rnxlH459nCweX2Imb33U+miMe k+xpj2xZyctVn0b9awGDcj0j1RD68fko+T6yt7hwsQ== X-Received: by 2002:a25:37c8:: with SMTP id e191mr20873804yba.230.1596419503535; Sun, 02 Aug 2020 18:51:43 -0700 (PDT) MIME-Version: 1.0 References: <20200801084721.1812607-1-songliubraving@fb.com> <20200801084721.1812607-6-songliubraving@fb.com> In-Reply-To: <20200801084721.1812607-6-songliubraving@fb.com> From: Andrii Nakryiko Date: Sun, 2 Aug 2020 18:51:32 -0700 Message-ID: Subject: Re: [PATCH bpf-next 5/5] selftests/bpf: add benchmark for uprobe vs. user_prog To: Song Liu Cc: open list , bpf , Networking , Alexei Starovoitov , Daniel Borkmann , Kernel Team , john fastabend , KP Singh , Jesper Dangaard Brouer , Daniel Xu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 1, 2020 at 1:50 AM Song Liu wrote: > > Add a benchmark to compare performance of > 1) uprobe; > 2) user program w/o args; > 3) user program w/ args; > 4) user program w/ args on random cpu. > Can you please add it to the existing benchmark runner instead, e.g., along the other bench_trigger benchmarks? No need to re-implement benchmark setup. And also that would also allow to compare existing ways of cheaply triggering a program vs this new _USER program? If the performance is not significantly better than other ways, do you think it still makes sense to add a new BPF program type? I think triggering KPROBE/TRACEPOINT from bpf_prog_test_run() would be very nice, maybe it's possible to add that instead of a new program type? Either way, let's see comparison with other program triggering mechanisms first. > Sample output: > > ./test_progs -t uprobe_vs_user_prog -v > test_uprobe_vs_user_prog:PASS:uprobe_vs_user_prog__open_and_load 0 nsec > test_uprobe_vs_user_prog:PASS:get_base_addr 0 nsec > test_uprobe_vs_user_prog:PASS:attach_uprobe 0 nsec > run_perf_test:PASS:uprobe 0 nsec > Each uprobe uses 1419 nanoseconds > run_perf_test:PASS:user_prog_no_args 0 nsec > Each user_prog_no_args uses 313 nanoseconds > run_perf_test:PASS:user_prog_with_args 0 nsec > Each user_prog_with_args uses 335 nanoseconds > run_perf_test:PASS:user_prog_with_args_on_cpu 0 nsec > Each user_prog_with_args_on_cpu uses 2821 nanoseconds > Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED > > Signed-off-by: Song Liu > --- > .../bpf/prog_tests/uprobe_vs_user_prog.c | 101 ++++++++++++++++++ > .../selftests/bpf/progs/uprobe_vs_user_prog.c | 21 ++++ > 2 files changed, 122 insertions(+) > create mode 100644 tools/testing/selftests/bpf/prog_tests/uprobe_vs_user_prog.c > create mode 100644 tools/testing/selftests/bpf/progs/uprobe_vs_user_prog.c > [...]