Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp648410lfv; Tue, 12 Apr 2022 00:55:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjze3kwro2EMVHrPt2rYYC0TC2N82QFHawjGqf8xEHBM3/o4XG0/Qw9YGVNERIE3I+Pkkn X-Received: by 2002:a17:902:7445:b0:158:4bda:a594 with SMTP id e5-20020a170902744500b001584bdaa594mr12828681plt.16.1649750142801; Tue, 12 Apr 2022 00:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649750142; cv=none; d=google.com; s=arc-20160816; b=Ego1N7c6/Lr3dZU0sfr+y27PV0SksQ0KkGI4z16jS7mPy9zYlsSU1rc0qa+P3nfCJu SYZ3TBs9KtjFtQ2uWPEmC3nhOj1YBMeFTY+QeEUal44t5jA9eZu97o5S9hzsiURx8Ds5 cpMA6cGInheFbBOoOfGL/UI6K05Hs1yJFcmFqk9si97A+V6mCA0ByTakh8BP+Bjhv5O/ Hulo0j24imL9bbVLmvPAWr8X/oyDl6dBARTlF48WorVcCo0oIPz7LkJG+IXjCmA6vRI3 pQ4tIFNKSr0aR/oRxvre26G3uXTKA7lPcaY7nEz8VIm4decSidtrEwVqUmCpjMFWHIB8 r6bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g7ssmbicXhxLGtEZMln9w3mBi5v8MseNWcKzGLM3lmg=; b=xfSv49jNgMCaABRzil5UOC6X/7kOs6PzAQPiFn7xoXeakes8sN7UNK+W/X6GPAmCHx dbwvxOQYyt52GosTxRKDOiMMWeNLU4t4+hjJwtSPNc6C5q2q1G7MKoPzZ7L9KPk13LNZ +EclIspaRMtUqt3NQlApk59iYkNx8vsVJh+Pd/by/BLUQMEtFj1r1qsoaDjOMBu4w891 F7pH3s42SZzd/98dZcL9TDi+nodJD2rSQp9vBcuPZ/D76Y4mAz9IMpyCDGAePVvQByvl 6wzD1FZXrcmSBO3AfZ7Vf31viFMlsh2HeofLrnFiK7D/CBD9JEcecNYgucQs1KGfQ8ax Xdig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oBdDL9gN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a170902848c00b0015415173078si9775737plo.220.2022.04.12.00.55.14; Tue, 12 Apr 2022 00:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oBdDL9gN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1350294AbiDKWRh (ORCPT + 99 others); Mon, 11 Apr 2022 18:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiDKWRf (ORCPT ); Mon, 11 Apr 2022 18:17:35 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 131E7DEE8; Mon, 11 Apr 2022 15:15:20 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id 125so20336437iov.10; Mon, 11 Apr 2022 15:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g7ssmbicXhxLGtEZMln9w3mBi5v8MseNWcKzGLM3lmg=; b=oBdDL9gNuHStJN1VZPf6NZy5rO0aWRZkD7c3AdMooQ8lHzP/QfcwM3Lw+1FOQ0Uy6w nULa6eS13L1Ydz9pUu1RB+M63pIIZJZLD3QV5ItOhO8kGqgE53x5Lv37UgeKGpeJZO5i m0V6xIaHv+RcM32g1kbQMZ+OJPstaFiSxu7/F/LEwg2vcLKjiSLdqdB0VpzqRqi5ZpBv wpFWpKSVelhKxxvbl68hH5ZVo0v+QKTNQZ+MixAUVJ8PEAAEqTsC6JR7gEU8hQghtXBj a9dLou/R9Trdmzz84wBWq7uNWvk5qUM0RBNuSHxZfZIJ/PZeeY7Zz5x6N7vKV/VaiwX0 Oisg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g7ssmbicXhxLGtEZMln9w3mBi5v8MseNWcKzGLM3lmg=; b=XSBI8uoU+p3JTwzEi634cioeMlp7LD6Fym2KBPKXhCh7DNUqC9I5FE3cIn3g1bP5d2 fde1Y1xIEAEf/Vgl3UYPWRlzWbKDV3lv6BIOUvZUe6aKWJWQoKUHF//PHazCNX4XV2Fa SvDH2FdY3n5sxfVUFcaLD/69hqHw+2QfFYFhkJF045MFj1eCfO+zqV8noSv3cNCtYB6M yUzNKLIhXIDTbRlUQL4hB2/PkJYMFhNANQEjoM5trruapXg4YpLyAyS2rwukOy10N4xr lSVA/HasGWHuEWZTkgz0cBw6U+UnG8o5D3vZtLOme8/nu/5uLpVrgo15DmwkbQH3ODI7 FkxA== X-Gm-Message-State: AOAM532HYqzW+2xuwxffTpd4GbaF+BlWc+1gSrjO9wbLPpmJBs46TRx5 wjdlX378E4cRQOsoCd0CXkSQEO0+KB0O7q2owvw= X-Received: by 2002:a05:6638:1696:b0:326:2d59:7b40 with SMTP id f22-20020a056638169600b003262d597b40mr4219180jat.103.1649715319123; Mon, 11 Apr 2022 15:15:19 -0700 (PDT) MIME-Version: 1.0 References: <20220407125224.310255-1-jolsa@kernel.org> <20220408232922.mz2vi2oaxf2fvnvt@MBP-98dd607d3435.dhcp.thefacebook.com> In-Reply-To: From: Andrii Nakryiko Date: Mon, 11 Apr 2022 15:15:08 -0700 Message-ID: Subject: Re: [RFC bpf-next 0/4] bpf: Speed up symbol resolving in kprobe multi link To: Jiri Olsa Cc: Alexei Starovoitov , Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , Networking , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 9, 2022 at 1:24 PM Jiri Olsa wrote: > > On Fri, Apr 08, 2022 at 04:29:22PM -0700, Alexei Starovoitov wrote: > > On Thu, Apr 07, 2022 at 02:52:20PM +0200, Jiri Olsa wrote: > > > hi, > > > sending additional fix for symbol resolving in kprobe multi link > > > requested by Alexei and Andrii [1]. > > > > > > This speeds up bpftrace kprobe attachment, when using pure symbols > > > (3344 symbols) to attach: > > > > > > Before: > > > > > > # perf stat -r 5 -e cycles ./src/bpftrace -e 'kprobe:x* { } i:ms:1 { exit(); }' > > > ... > > > 6.5681 +- 0.0225 seconds time elapsed ( +- 0.34% ) > > > > > > After: > > > > > > # perf stat -r 5 -e cycles ./src/bpftrace -e 'kprobe:x* { } i:ms:1 { exit(); }' > > > ... > > > 0.5661 +- 0.0275 seconds time elapsed ( +- 4.85% ) > > > > > > > > > There are 2 reasons I'm sending this as RFC though.. > > > > > > - I added test that meassures attachment speed on all possible functions > > > from available_filter_functions, which is 48712 functions on my setup. > > > The attach/detach speed for that is under 2 seconds and the test will > > > fail if it's bigger than that.. which might fail on different setups > > > or loaded machine.. I'm not sure what's the best solution yet, separate > > > bench application perhaps? > > > > are you saying there is a bug in the code that you're still debugging? > > or just worried about time? > > just the time, I can make the test fail (cross the 2 seconds limit) > when the machine is loaded, like with running kernel build > > but I couldn't reproduce this with just paralel test_progs run > > > > > I think it's better for it to be a part of selftest. > > CI will take extra 2 seconds to run. > > That's fine. It's a good stress test. I agree it's a good stress test, but I disagree on adding it as a selftests. The speed will depend on actual host machine. In VMs it will be slower, on busier machines it will be slower, etc. Generally, depending on some specific timing just causes unnecessary maintenance headaches. We can have this as a benchmark, if someone things it's very important. I'm impartial to having this regularly executed as it's extremely unlikely that we'll accidentally regress from NlogN back to N^2. And if there is some X% slowdown such selftest is unlikely to alarm us anyways. Sporadic failures will annoy us way before that to the point of blacklisting this selftests in CI at the very least. > > ok, great > > thanks, > jirka > > > > > > - copy_user_syms function potentially allocates lot of memory (~6MB in my > > > tests with attaching ~48k functions). I haven't seen this to fail yet, > > > but it might need to be changed to allocate memory gradually if needed, > > > do we care? ;-) > > > > replied in the other email. > > > > Thanks for working on this!