Received: by 2002:a19:651b:0:0:0:0:0 with SMTP id z27csp26150lfb; Mon, 2 May 2022 11:31:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFYC4Tnt+KIbzP9LTK+uVIdTsLaaKU3/6KQSGv+XKOAfmURzfZniDJI54uwOJz8Dz7kXaa X-Received: by 2002:a63:88:0:b0:3c1:7261:9110 with SMTP id 130-20020a630088000000b003c172619110mr10608653pga.9.1651516313998; Mon, 02 May 2022 11:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651516313; cv=none; d=google.com; s=arc-20160816; b=TpYL2cLXQXYnU4kco7njmYG04wvuynyMQm6go7a3knhyUJ8ehB6C2zHj4U/Ho6M9RJ 5L5vP8wV7qfm00Z5YdR+jWEFM/D2PO/ZUAaW56wMogiv9BRTZSoCvZVW3KUlMap12wmA Acq3e8cYJmyrdBgYV1vrriP8yU9/3xVDwHZ75hi6qpp694PbGAiTYhTon1LtFcTkEsW7 899lqsbTkzO83SFoCJ+O8v7XdKZU3VumFwZyqzkwTObSph/c0F44FDi7KEAz5cEEgGxQ g7iQGwxTTgddHyzuavfUd+3EtmIBbUe5c2w8nAiY0QwsTflSAtUOZgqIIHCwptbCjXxn z3sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/jfovHtyZZT8UGa+5lJb6NNtCHtSd4My+TA0EpMI4Fk=; b=xjOLqRY04HqyjRXwFQ35tsDYsOJV8VYKmhvjYQKYK7HKTHQPMLj/HxQpDvR3G2t3SW bsyxrBUSgLvNy5ao92QyePyfTF0M3HUgycT8ypUsuwdAX4GncR4n8GFx/E1whW2ez7WA 6TArYbBvLZbVGtDO5iWuhdbp36UV9y8HKSCBysC5U4KqGWApo3lKOmKirkxsQKGplOeE l5QITKTl1ULDou5fCOt4fxsYS5AG7eyoCVLlakHrIz38aS98LQcYr6XaJQejMNxkw8Y8 LsNHaO0LwFKVwI9+ZvXSwh3TrvRUurBGeJomHNFT3Zl8qeQUduZMhfp2bsH+r/pQSFqC RsjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GuEpnbw6; 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 l12-20020a65560c000000b0039daee7ecf1si14369065pgs.318.2022.05.02.11.31.16; Mon, 02 May 2022 11:31:53 -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=GuEpnbw6; 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 S241659AbiD3MRi (ORCPT + 99 others); Sat, 30 Apr 2022 08:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230208AbiD3MRh (ORCPT ); Sat, 30 Apr 2022 08:17:37 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B08EE5DA15; Sat, 30 Apr 2022 05:14:15 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id g6so19982717ejw.1; Sat, 30 Apr 2022 05:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/jfovHtyZZT8UGa+5lJb6NNtCHtSd4My+TA0EpMI4Fk=; b=GuEpnbw6PUM0fvvsV8VKpTrflzI0jE2Ah706hdy5wqmqBfJdWPFvEZ5aZ7SzNLDGNG bd/DqjsLcC8bxVwibuwthI0A92PxO2Q3NswE0wyKPuaXD4OK20kmvddIRkm9VnfIeZtS qDogt5WIGokcrT/vTb6q6R4nttbH6538QObpmQK3jE8lYCMxS9SivsRZ3yUbzZJm3J1U xlJDuQkZICmCHEIufP5pYnJ4L7GB3e7wB695yTfFGx15YQr9DepHyWnkK8b/ZA2Xr+Cp LYqfZLOY7WT7v3iuYbnxGG2mnt78blhxAX9PMphHm3Do4EWurw9aA+qvljh3NmlY5brQ 9AhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/jfovHtyZZT8UGa+5lJb6NNtCHtSd4My+TA0EpMI4Fk=; b=VHfeMLQTQZBxhS22I3c/DcopSaDJe3oZ1ajACIu89u3ByRVNwGCK1Rn5XOE6+MdJ6N GdKbMLUigLfN5P1k9gd9709xh9s3+MDMidvV/zzXQw3iMuf+NX3bjKsFQ0y3JgUaTjal Ten3zkdQcpsGc3Pqp+3MJoiV3cBhKyzFI+y66iAVPTzjyxVe2AJyPFXaRGcr5XKtOE60 dqfrEyvmUNhvJVHUBrlnKW6ZSaRst14xUojdHMQWEJp/Ehj9wgt12S41UIQcZakuSPWm qr4QGfiBVwvSX62Zm3ylNQI57Jn3fzkWi+yp48rYgo9Vo2QCCm6SiQwupn2U53rbZnwp 5Wnw== X-Gm-Message-State: AOAM532oAoQ9mMQuYqan4KFGFQQ5bjN81vpxTLNR+WNlJxItRkhNHl8d gqoy79Gj01MEI2D0jJqeA1U= X-Received: by 2002:a17:906:b006:b0:6f3:dcf0:6f6f with SMTP id v6-20020a170906b00600b006f3dcf06f6fmr3776553ejy.649.1651320854150; Sat, 30 Apr 2022 05:14:14 -0700 (PDT) Received: from krava ([95.82.134.228]) by smtp.gmail.com with ESMTPSA id zp15-20020a17090684ef00b006f3ef214e4esm1539083ejb.180.2022.04.30.05.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 05:14:13 -0700 (PDT) Date: Sat, 30 Apr 2022 14:14:10 +0200 From: Jiri Olsa To: Andrii Nakryiko Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , Networking , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt Subject: Re: [PATCHv4 bpf-next 0/5] bpf: Speed up symbol resolving in kprobe multi link Message-ID: References: <20220428201207.954552-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 Fri, Apr 29, 2022 at 07:28:11AM -0700, Andrii Nakryiko wrote: > On Thu, Apr 28, 2022 at 1:12 PM 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% ) > > > > v4 changes: > > - fix compile issue [kernel test robot] > > - added acks [Andrii] > > > > v3 changes: > > - renamed kallsyms_lookup_names to ftrace_lookup_symbols > > and moved it to ftrace.c [Masami] > > - added ack [Andrii] > > - couple small test fixes [Andrii] > > > > v2 changes (first version [2]): > > - removed the 2 seconds check [Alexei] > > - moving/forcing symbols sorting out of kallsyms_lookup_names function [Alexei] > > - skipping one array allocation and copy_from_user [Andrii] > > - several small fixes [Masami,Andrii] > > - build fix [kernel test robot] > > > > thanks, > > jirka > > > > > > [1] https://lore.kernel.org/bpf/CAEf4BzZtQaiUxQ-sm_hH2qKPRaqGHyOfEsW96DxtBHRaKLoL3Q@mail.gmail.com/ > > [2] https://lore.kernel.org/bpf/20220407125224.310255-1-jolsa@kernel.org/ > > --- > > Jiri Olsa (5): > > kallsyms: Fully export kallsyms_on_each_symbol function > > ftrace: Add ftrace_lookup_symbols function > > fprobe: Resolve symbols with ftrace_lookup_symbols > > bpf: Resolve symbols with ftrace_lookup_symbols for kprobe multi link > > selftests/bpf: Add attach bench test > > > > Please check [0], it reports rcu_read_unlock() misuse > > [0] https://github.com/kernel-patches/bpf/runs/6223167405?check_suite_focus=true hm, first I though it might be related to the bench test attaching to 'bad' function, but the the warning showed before that will try to reproduce with the CI .config jirka > > > include/linux/ftrace.h | 6 ++++++ > > include/linux/kallsyms.h | 7 ++++++- > > kernel/kallsyms.c | 3 +-- > > kernel/trace/bpf_trace.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- > > kernel/trace/fprobe.c | 32 ++++++++++++-------------------- > > kernel/trace/ftrace.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > tools/testing/selftests/bpf/progs/kprobe_multi_empty.c | 12 ++++++++++++ > > 8 files changed, 298 insertions(+), 69 deletions(-) > > create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi_empty.c