From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FB27C6FA8E for ; Thu, 2 Mar 2023 08:36:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2B2B6B0071; Thu, 2 Mar 2023 03:36:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EB7046B0073; Thu, 2 Mar 2023 03:36:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D53CF6B0074; Thu, 2 Mar 2023 03:36:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BF58B6B0071 for ; Thu, 2 Mar 2023 03:36:28 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8662940125 for ; Thu, 2 Mar 2023 08:36:28 +0000 (UTC) X-FDA: 80523301656.21.2B57A08 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf17.hostedemail.com (Postfix) with ESMTP id 9676240002 for ; Thu, 2 Mar 2023 08:36:26 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gy6WYAUh; spf=pass (imf17.hostedemail.com: domain of olsajiri@gmail.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=olsajiri@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677746186; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jeu2rejC7ALr4xJCaVvexwWFSyD3FJ1WGHKuY7P9Vfk=; b=Ojl4Xb9q9c54CH6DWMSCEE68oNfsPUpF53B47zNzjz323k17PzNmToVDfCV/ZEPyVTGxAV e+O25XNa+NC+zZGIYTXNQId2x+YZrbareQCivjU9zU6/4FjRz0IuvQHG/PD1pok/AaBrp+ jObmVMl/EDdzStChBecLlC/+TUx76bI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gy6WYAUh; spf=pass (imf17.hostedemail.com: domain of olsajiri@gmail.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=olsajiri@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677746186; a=rsa-sha256; cv=none; b=cjI1V3JG6SXy/eQGGsGtC+0eEqOYqmP0FaXuz5H+Tqcg/RV9tEVuuMcOG1scDMQrRfmGTb /e+RtVrLxmhUSgPDkZMVPf5leXyhCe4PkldTajolvFF65bDiceU58YggyhPUE5N31eYl4r YkIkN3vq2bo99tChLtN6MeFwSG2C6qY= Received: by mail-ed1-f49.google.com with SMTP id o15so61988795edr.13 for ; Thu, 02 Mar 2023 00:36:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=jeu2rejC7ALr4xJCaVvexwWFSyD3FJ1WGHKuY7P9Vfk=; b=gy6WYAUhPjCzDjYcBcwVYMJZNJqEGdfEtgTsJQdzZFbChfJc6OELVYJw1PDc1gtL78 TYKCZoV7D06fuqQnTdyGeOg3mMHVjTpRu0DibqIvgbzD9UWbFsSJ5Gs13gTkb8D5zb0Z JBMYmdbYtIe7FNDGaMgb18mgrDT50bCu1C1rGjhYpNdxQa1z1VS11aitl/rz3ju9Z7Ts PQhyr0umfdiOkVbj1WfyMmA5biXNmw1qaKOZs1NYVZk/eUiYgU3tWbEU+GJzP66UFbEA zfAIpRA9NVmz55s9SKfRwvnFDgxI7hMVuD/8kT/W/26xmYm/hoULhs3i5FLn9XhsYkdU KJRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jeu2rejC7ALr4xJCaVvexwWFSyD3FJ1WGHKuY7P9Vfk=; b=pNyNBc90m+290DgzcxG59YLTRGA0F7FlsRnjMw2TtJJyrsUN9Xa2vjtsleOYqOs2ry +kERSRMAmHrs5VRqq/dklmDbOGUzdpSFEx+MWsN+qSNAtzVFe5r5g9ejB4tj96ajiDpC VZ6SFKQE87i9OoaaehrSM9/yYzF6WO9Fk/5Lb+Wqc55Qs6MMOsESOs0zPiCo3E47uD76 Xl1255KeDZuQl9jJa9fWejYPDXq2RZLV1K71ejzlptSlFBeGKlDsbxiYZfUtIdnZn/VV RB3ReoR1GFIBjbAVmODeopubP21PbVVb1LI0VgLIqrMqg+Egd299QRJCMoMCkT7uS9EP liHQ== X-Gm-Message-State: AO0yUKU8HhXKiwNeK6dndyacbrZKojLYeMFglfDYuXgU0wxCSXEOwREV fPfX5AbRUmLMksAfc4lKAwA= X-Google-Smtp-Source: AK7set9fLLZJOXn1J6rQFaJEofA0z/w+K8ekwQdW33ZgC+u1ri5CMmPoim+VtKyA56aaChTmNA0unA== X-Received: by 2002:a17:906:190b:b0:8f2:da10:c69e with SMTP id a11-20020a170906190b00b008f2da10c69emr11039594eje.52.1677746184870; Thu, 02 Mar 2023 00:36:24 -0800 (PST) Received: from krava (2001-1ae9-1c2-4c00-726e-c10f-8833-ff22.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:726e:c10f:8833:ff22]) by smtp.gmail.com with ESMTPSA id g19-20020a50d0d3000000b004c09527d62dsm292113edf.30.2023.03.02.00.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 00:36:24 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 2 Mar 2023 09:35:39 +0100 To: Dave Chinner Cc: Alexei Starovoitov , Andrii Nakryiko , Hao Luo , Andrew Morton , Alexander Viro , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Matthew Wilcox , 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 , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Daniel Borkmann , Namhyung Kim Subject: Re: [RFC v2 bpf-next 0/9] mm/bpf/perf: Store build id in inode object Message-ID: References: <20230228093206.821563-1-jolsa@kernel.org> <20230228220714.GJ2825702@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230228220714.GJ2825702@dread.disaster.area> X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 1pnd6dqaoaj9jwuidh66d8iyhgke1snk X-Rspamd-Queue-Id: 9676240002 X-HE-Tag: 1677746186-656997 X-HE-Meta: U2FsdGVkX1/5USJNIv8DsHIR0QNVAJ6Be4/nq16zJ+zUJ8pweGx6vh6yYgu5c8g/7BkDPw0x6D8y+Gv3XeTlR5hy72tPaLG5J/hxxLJXCYUkMerGCKhZjAheSoh2mOt0pBeT8A3owz49bdyWnUJ6Bu+5LEPPanhyYSNqOs73uRdTKLZyuBzivnAAHGyVYakF21MldW0zh1cNxmzeECb0kodTQ9bLBeL+WSER7LkN1clJ2g0Gmq0PDY8E3irmWKZnBxtx626TKw6Z++EgUC2OUrm7bTrlbz31YwQFpBJ8fcaQ2+ZPrj4jkJLfwMBA+9vvvWoAIZxbUdpNbhgQALMf9nw/GpF5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RDD1WVC1+8b1kRCvipEdJcR21FkpmqeNRtn7goAftAAu2rL2B/QOVYM7hfO8J0gkg6vTDnB7RpP02SNdBvVlPJ+g7u5yeWSyuzCu93mhIB/uGje4kkvB0v46xsG/sZRS8h25o1K/k77K3eZZi X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Mar 01, 2023 at 09:07:14AM +1100, Dave Chinner wrote: > On Tue, Feb 28, 2023 at 10:31:57AM +0100, Jiri Olsa wrote: > > hi, > > this is RFC patchset for adding build id under inode's object. > > > > The main change to previous post [1] is to use inode object instead of file > > object for build id data. > > Please explain what a "build id" is, the use case for it, why we > need to store it in VFS objects, what threat model it is protecting > the system against, etc. hum I still did not get your email from mailing list, just saw it from Arnaldo's reply and downloaded it from lore our use case is for hubble/tetragon [1] and we are asked to report buildid of executed binary.. but the monitoring process is running in its own pod and can't access the the binaries outside of it, so we need to be able to read it in kernel we want to read build id from BPF program attached to sched_exec tracepoint, and from BPF iterator we considered adding BPF helper and then kfunc for that, but it turned out it'd be usefull for other use cases (like retrieving build id from atomic context [2]) to have the build id stored in file (or inode) object [1] https://github.com/cilium/tetragon/ [2] https://lore.kernel.org/bpf/CA+khW7juLEcrTOd7iKG3C_WY8L265XKNo0iLzV1fE=o-cyeHcQ@mail.gmail.com/ > > > > > However.. ;-) while using inode as build id storage place saves some memory > > by keeping just one copy of the build id for all file instances, there seems > > to be another problem. > > Yes, the problem being that we can cache hundreds of millions of > inodes in memory, and only a very small subset of them are going to > have open files associated with them. And an even smaller subset are > going to be mmapped. ok, file seems like better option now > > So, in reality, this proposal won't save any memory at all - it > costs memory for every inode that is not currently being used as > a mmapped elf executable, right? right > > > The problem is that we read the build id when the file is mmap-ed. > > Why? I'm completely clueless as to what this thing does or how it's > used.... we need the build id only when the file is mmap-ed, so it seemed like the best way to read it when the file is mmaped > > > Which is fine for our use case, > > Which is? please see above thanks, jirka