Received: by 10.223.164.202 with SMTP id h10csp376385wrb; Thu, 30 Nov 2017 00:25:36 -0800 (PST) X-Google-Smtp-Source: AGs4zMbXYKSAlc9rXsSvm4o1DSL7/RNkdtT8nAr+911hqdjBjGV3vKDycFhrfNsWLzyOzxN0nNDI X-Received: by 10.84.248.1 with SMTP id p1mr1784243pll.50.1512030335910; Thu, 30 Nov 2017 00:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512030335; cv=none; d=google.com; s=arc-20160816; b=q94gOAimq2S/fixWdqQGXKS9+EtWYNj9vOCNGmTnWMMN9RQTr3S+KLwgRbH/ce5W2l uuJ9jTQQImH9Z6SGpKBi1N+d+JLpMeNoo74fqMSBdozQ7BCSI/5DWHrPqsRmxkOvc+Wd L7iIidb+VQcuGUwmRVc65Wsc9AmsskAnIWQpUa5NLmGwKUaoN88TcPyEG8wqJMmH3PmC 5rMxT9NExjruFOj3jmoLoRePrtB8eONtB8Pz5FLO7ouhpCZW/FwbBl1tX+/2ZpMloARs ZkwTV24iTx/9C1/kFGvrxqBu9As7uuk2YVsAeSCLQJLJEDIRjkg8d9R0Eko0luMBipFa 7tzg== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=LrfRSyZACN8zvBCeODjk3i+Spckkgi3I8qtUu/2CTMc=; b=txihmdQuRxYFuC0Ocx069hO8aeKYFp6zYsuH5dGviUuSYyWyw2/y57ZGB+ondm209t nYwhvFvFP/r2Fg5IRxpNFoWIe35odH8bgMW4BvGXBiYUjqKqsDhtgsx8MLuq6zLzZ6gB 4HFlWYQPa3B3R8UYf+rmcMO6MWohn06ihq9a+lJYYBrS1g6FTHpDYULM0CDInPhx+dJC 5NmVONmhMUBH+paeNgLCIPTrwule2bxyD1GEMY/8GEF9lfNGjRf06+ejJ9h16fGXyypo pEcM2r7RjWqTM/sfNUectZToTKoPKHvK/YLydHkZZ9knvFk/XoabLoxh+YbWpHy23qud Rm1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexb-com.20150623.gappssmtp.com header.s=20150623 header.b=sWPTc8+D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si2829055pfb.244.2017.11.30.00.25.22; Thu, 30 Nov 2017 00:25:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nexb-com.20150623.gappssmtp.com header.s=20150623 header.b=sWPTc8+D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751990AbdK3IZC (ORCPT + 99 others); Thu, 30 Nov 2017 03:25:02 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:42806 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065AbdK3IZA (ORCPT ); Thu, 30 Nov 2017 03:25:00 -0500 Received: by mail-wm0-f67.google.com with SMTP id l141so11316007wmg.1 for ; Thu, 30 Nov 2017 00:24:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LrfRSyZACN8zvBCeODjk3i+Spckkgi3I8qtUu/2CTMc=; b=sWPTc8+DHyD640wjxwOPyt45kG1leSA4XVkElKMlqX7BpDigFkrmKYte2guWm7o0lc svY97ExEMjHuWwvBr7YUrs7WjFIIwL7tirGpMEsX1UpXw/ahldnb/IALgV92fEgPDQ3u hv04JN9pDxoGECfqnzrWb/1VmQiXWpWF1te1QNDeLKjzqrMyOnS+/YO11++DYMsdPRDj sx37d4QyzM9OQW11hkTR1wexa5Cnn7QhiZ9UhVyHuXkqPCn2+uLDcKbfqGbZxswZ2gDB kpspAOxg0tPn3lVXwIthTIuVk8054JT2JYcJmud84SJ9XfWmJv8fcB2kwZluWphz8p52 A81w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LrfRSyZACN8zvBCeODjk3i+Spckkgi3I8qtUu/2CTMc=; b=dmWaAjSk1AoKzmjq4+GNhnel7JBKaHLWEv0VgbMhWcJGMq9Zg0Zf0dr+z4h4jNYvf0 C9ghnDdUrYaxptBzq8LnKps/5mEXHdVgFcnBDN9zPFeM2Hn1wMZQgECS2F/w2yAOIkZJ SpIGL4eR6DStUeHj8OFaj9DdUsfKtWYUXmFgh61o/s7/Qa2b+DHzxcKBcA6ibIGO60sq DY0QqmCJI+EjjKQ7kXcXtUNm/eIt/h8XoF4GD8ZrAk+rMjI5Cbe/dIYCDWikjZyS01c5 126aYA8/jVS+jT4Y3zd2RX9gh8NLyO05aOhR9JBjhs21zEWQrWrUMcvoQylg2ckcOzyi 40tA== X-Gm-Message-State: AJaThX4fxL+Q6mlW8mZ7ar6u3F2gNbvdIAkskiZvXLmvE1jIJIZbxRDk Y/rRqAaZmjbEiG+m4KYi+dMrsoWwaHfmYL/Fgx/FyA== X-Received: by 10.28.168.133 with SMTP id r127mr1112234wme.83.1512030298884; Thu, 30 Nov 2017 00:24:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.157.195 with HTTP; Thu, 30 Nov 2017 00:24:18 -0800 (PST) In-Reply-To: <20171130014447.190229-9-songliubraving@fb.com> References: <20171130014447.190229-1-songliubraving@fb.com> <20171130014447.190229-9-songliubraving@fb.com> From: Philippe Ombredanne Date: Thu, 30 Nov 2017 09:24:18 +0100 Message-ID: Subject: Re: [PATCH v2 6/6] bpf: add new test test_many_kprobe To: Song Liu Cc: peterz@infradead.org, rostedt@goodmis.org, mingo@redhat.com, "David S. Miller" , netdev@vger.kernel.org, LKML , daniel@iogearbox.net, kernel-team@fb.com 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 Thu, Nov 30, 2017 at 2:44 AM, Song Liu wrote: > The test compares old text based kprobe API with PERF_TYPE_KPROBE. > > Here is a sample output of this test: > > Creating 1000 kprobes with text-based API takes 6.979683 seconds > Cleaning 1000 kprobes with text-based API takes 84.897687 seconds > Creating 1000 kprobes with PERF_TYPE_KPROBE (function name) takes 5.077558 seconds > Cleaning 1000 kprobes with PERF_TYPE_KPROBE (function name) takes 81.241354 seconds > Creating 1000 kprobes with PERF_TYPE_KPROBE (function addr) takes 5.218255 seconds > Cleaning 1000 kprobes with PERF_TYPE_KPROBE (function addr) takes 80.010731 seconds > > Signed-off-by: Song Liu > Reviewed-by: Josef Bacik > --- > samples/bpf/Makefile | 3 + > samples/bpf/bpf_load.c | 5 +- > samples/bpf/bpf_load.h | 4 + > samples/bpf/test_many_kprobe_user.c | 182 ++++++++++++++++++++++++++++++++++++ > 4 files changed, 191 insertions(+), 3 deletions(-) > create mode 100644 samples/bpf/test_many_kprobe_user.c > > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile > index 9b4a66e..ec92f35 100644 > --- a/samples/bpf/Makefile > +++ b/samples/bpf/Makefile > @@ -42,6 +42,7 @@ hostprogs-y += xdp_redirect > hostprogs-y += xdp_redirect_map > hostprogs-y += xdp_monitor > hostprogs-y += syscall_tp > +hostprogs-y += test_many_kprobe > > # Libbpf dependencies > LIBBPF := ../../tools/lib/bpf/bpf.o > @@ -87,6 +88,7 @@ xdp_redirect-objs := bpf_load.o $(LIBBPF) xdp_redirect_user.o > xdp_redirect_map-objs := bpf_load.o $(LIBBPF) xdp_redirect_map_user.o > xdp_monitor-objs := bpf_load.o $(LIBBPF) xdp_monitor_user.o > syscall_tp-objs := bpf_load.o $(LIBBPF) syscall_tp_user.o > +test_many_kprobe-objs := bpf_load.o $(LIBBPF) test_many_kprobe_user.o > > # Tell kbuild to always build the programs > always := $(hostprogs-y) > @@ -172,6 +174,7 @@ HOSTLOADLIBES_xdp_redirect += -lelf > HOSTLOADLIBES_xdp_redirect_map += -lelf > HOSTLOADLIBES_xdp_monitor += -lelf > HOSTLOADLIBES_syscall_tp += -lelf > +HOSTLOADLIBES_test_many_kprobe += -lelf > > # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: > # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang > diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c > index 872510e..caba9bc 100644 > --- a/samples/bpf/bpf_load.c > +++ b/samples/bpf/bpf_load.c > @@ -635,9 +635,8 @@ void read_trace_pipe(void) > } > } > > -#define MAX_SYMS 300000 > -static struct ksym syms[MAX_SYMS]; > -static int sym_cnt; > +struct ksym syms[MAX_SYMS]; > +int sym_cnt; > > static int ksym_cmp(const void *p1, const void *p2) > { > diff --git a/samples/bpf/bpf_load.h b/samples/bpf/bpf_load.h > index e7a8a21..16bc263 100644 > --- a/samples/bpf/bpf_load.h > +++ b/samples/bpf/bpf_load.h > @@ -67,6 +67,10 @@ static inline __u64 ptr_to_u64(const void *ptr) > return (__u64) (unsigned long) ptr; > } > > +#define MAX_SYMS 300000 > +extern struct ksym syms[MAX_SYMS]; > +extern int sym_cnt; > + > int load_kallsyms(void); > struct ksym *ksym_search(long key); > int set_link_xdp_fd(int ifindex, int fd, __u32 flags); > diff --git a/samples/bpf/test_many_kprobe_user.c b/samples/bpf/test_many_kprobe_user.c > new file mode 100644 > index 0000000..1f3ee07 > --- /dev/null > +++ b/samples/bpf/test_many_kprobe_user.c > @@ -0,0 +1,182 @@ > +/* Copyright (c) 2017 Facebook > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of version 2 of the GNU General Public > + * License as published by the Free Software Foundation. > + */ I think an SPDX id would be better here e.g. just this may be? > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (c) 2017 Facebook It should be on the first line as requested by Linus and documented by Thomas (tglx) and Greg (greg-kh). And it should use // comments. See threads on these topics. -- Cordially Philippe Ombredanne From 1585453701316454613@xxx Thu Nov 30 01:47:54 +0000 2017 X-GM-THRID: 1585453701316454613 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread