Message ID | 20230201135737.800527-3-jolsa@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp314692wrn; Wed, 1 Feb 2023 06:38:47 -0800 (PST) X-Google-Smtp-Source: AK7set/7ujbwPwyx3Lh1aslTot+oH94GjkEhRM5eVPTz8KIKI9Szlbxe9xpbHDehpfF4dpLFV9kW X-Received: by 2002:a17:906:5181:b0:885:dd71:89b5 with SMTP id y1-20020a170906518100b00885dd7189b5mr2311484ejk.41.1675262327732; Wed, 01 Feb 2023 06:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675262327; cv=none; d=google.com; s=arc-20160816; b=yNvSICMXig3W9SF2nAdk8sYDdxu2KdHp6AWg/9CwM+CVytgApeBC7Y+XFZO0bcCDew FKsg38wkTvrH7sroNdNOrQcl07piMoFYlNRk38apm74x9yAJ0ohrUi2hfeU4mk7qJ0Ey /zKlPCv0YlyNpHNerhfOZlE80M435nUQk0ViGwNJt+JoHW9WmrpDCNvNUTYfoBBJOYOG Ru7j4jLQ6VbPf3XNum7DFX/DRqZYIDfTSSOTvEP/AHFW1B6muvunehSFDQh4/1kEBV++ teFWXodBiXl729tihJ8OOXqCLTcNrjrSPB31LyIfiIDGSAqbEzqiXYFwtkNjXb1/1BCJ DnUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gSnnt4fgX2I9uu82kp63+YnlF3N0Lzc/HDoxGN8vSwA=; b=xB8thMiK4ZGTu+iVYMTHHRpP3idVWKO24WbSqM+9gmyGgdaFj9GcAmMZRxoXusNb1V WXLnOWg2zbtFDOP1xNL++0mwEMfChRbfe7cmw8Pl6xrU7Zj34H9fOBGmzPFwAnT9+bWO ZMjrDekSlixb5qWipN60ddl256ZnkC9nY8UC3zrbXYKSzMfcWlH4Ef2C383FKuSg4GE0 0Ry0LMtdBY7if8/A9xFI9pNdF/s0HytugSyCvO97MACXWlys7MarxcoueG40BqoFGygw Chc9pARjWmaXks80STxlZRKmF0B6UY3UeyVzNTpOeNkh7W0eb7SRIw6IkBBs+us0bR/9 z/Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JnHy4CCn; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gc14-20020a1709072b0e00b0088adcfbd9basi6611617ejc.988.2023.02.01.06.38.24; Wed, 01 Feb 2023 06:38:47 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=JnHy4CCn; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbjBAN6i (ORCPT <rfc822;duw91626@gmail.com> + 99 others); Wed, 1 Feb 2023 08:58:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbjBAN6c (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Feb 2023 08:58:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A8C769E; Wed, 1 Feb 2023 05:58:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E60E617B0; Wed, 1 Feb 2023 13:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF1C7C4339B; Wed, 1 Feb 2023 13:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675259889; bh=ut4TSVh/smk46JzyD72UAqn8UMJWTZ29FILHTx+yUwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JnHy4CCnRASBpAW99dtJkbPX2oqBQQXDvGScvJq3o+/FaodL245/D9NJYxQNfNUsZ CMfE08ZZyQxrXuSMX6uO4lScYcc/QgQO6IdbezuEiloYTYdTdeMjt/DHZ2tJVA2nro lM9RoLjYSHdt9TmUMwqAm/Jx30Kz6WwRjHo/AuFSjgOjBt0zv5V5lx9CuomjQ881Pv eYXBR/aNwaA5hZTHvCZ/bRuaC72f8SSsEJPVdQGeMITJheap/wLUx3bYuvBMl9MFhH ye62SNud97XMHzIXR5+WUMVs3uW1p8/qPvccJ8q++3h1uCmOiECCYxs54/JclrE3nt NOavObpiK6Nlw== From: Jiri Olsa <jolsa@kernel.org> To: Alexei Starovoitov <ast@kernel.org>, Andrii Nakryiko <andrii@kernel.org>, Hao Luo <haoluo@google.com>, Andrew Morton <akpm@linux-foundation.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org> Cc: bpf@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@chromium.org>, Stanislav Fomichev <sdf@google.com>, Daniel Borkmann <daniel@iogearbox.net> Subject: [PATCH RFC 2/5] bpf: Use file object build id in stackmap Date: Wed, 1 Feb 2023 14:57:34 +0100 Message-Id: <20230201135737.800527-3-jolsa@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201135737.800527-1-jolsa@kernel.org> References: <20230201135737.800527-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756639870110558494?= X-GMAIL-MSGID: =?utf-8?q?1756639870110558494?= |
Series |
mm/bpf/perf: Store build id in file object
|
|
Commit Message
Jiri Olsa
Feb. 1, 2023, 1:57 p.m. UTC
Use build id from file object in stackmap if it's available.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
kernel/bpf/stackmap.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Wed, Feb 1, 2023 at 5:58 AM Jiri Olsa <jolsa@kernel.org> wrote: > > Use build id from file object in stackmap if it's available. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- Can we insert the lookup from vma->vm_file in build_id_parse() rather than its callers? > kernel/bpf/stackmap.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c > index aecea7451b61..944cb260a42c 100644 > --- a/kernel/bpf/stackmap.c > +++ b/kernel/bpf/stackmap.c > @@ -156,7 +156,15 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, > goto build_id_valid; > } > vma = find_vma(current->mm, ips[i]); > +#ifdef CONFIG_FILE_BUILD_ID > + if (vma && vma->vm_file && vma->vm_file->f_bid) { > + memcpy(id_offs[i].build_id, > + vma->vm_file->f_bid->data, > + vma->vm_file->f_bid->sz); > + } else { > +#else > if (!vma || build_id_parse(vma, id_offs[i].build_id, NULL)) { > +#endif > /* per entry fall back to ips */ > id_offs[i].status = BPF_STACK_BUILD_ID_IP; > id_offs[i].ip = ips[i]; > -- > 2.39.1 >
On Wed, Feb 08, 2023 at 11:23:13PM -0800, Hao Luo wrote: > On Wed, Feb 1, 2023 at 5:58 AM Jiri Olsa <jolsa@kernel.org> wrote: > > > > Use build id from file object in stackmap if it's available. > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > --- > > Can we insert the lookup from vma->vm_file in build_id_parse() rather > than its callers? that might simplify also the perf code.. we might need to rename it though.. maybe build_id_read(vma,...), I'll check thanks, jirka > > > kernel/bpf/stackmap.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c > > index aecea7451b61..944cb260a42c 100644 > > --- a/kernel/bpf/stackmap.c > > +++ b/kernel/bpf/stackmap.c > > @@ -156,7 +156,15 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, > > goto build_id_valid; > > } > > vma = find_vma(current->mm, ips[i]); > > +#ifdef CONFIG_FILE_BUILD_ID > > + if (vma && vma->vm_file && vma->vm_file->f_bid) { > > + memcpy(id_offs[i].build_id, > > + vma->vm_file->f_bid->data, > > + vma->vm_file->f_bid->sz); > > + } else { > > +#else > > if (!vma || build_id_parse(vma, id_offs[i].build_id, NULL)) { > > +#endif > > /* per entry fall back to ips */ > > id_offs[i].status = BPF_STACK_BUILD_ID_IP; > > id_offs[i].ip = ips[i]; > > -- > > 2.39.1 > >
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index aecea7451b61..944cb260a42c 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -156,7 +156,15 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, goto build_id_valid; } vma = find_vma(current->mm, ips[i]); +#ifdef CONFIG_FILE_BUILD_ID + if (vma && vma->vm_file && vma->vm_file->f_bid) { + memcpy(id_offs[i].build_id, + vma->vm_file->f_bid->data, + vma->vm_file->f_bid->sz); + } else { +#else if (!vma || build_id_parse(vma, id_offs[i].build_id, NULL)) { +#endif /* per entry fall back to ips */ id_offs[i].status = BPF_STACK_BUILD_ID_IP; id_offs[i].ip = ips[i];