Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3370199yba; Tue, 16 Apr 2019 09:59:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7liD4RaMzzEcZ40cdN+UFZuSwf5orNmkwVVVoouEVlS2uB61i0i1T5aZOqB5N7cKFrdF7 X-Received: by 2002:a17:902:be04:: with SMTP id r4mr84831415pls.218.1555433964809; Tue, 16 Apr 2019 09:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555433964; cv=none; d=google.com; s=arc-20160816; b=jMErhPKNU3yZZ84+Jn+Eg1c9MgN9piBdrzUF+vbgLwoJwk4Z7HMivzOVKnLIJtH9Dg S4WtaSLsFWsY5hQ9cn/08yMqjMJSKXkIXk3l/N/I1D0ipBzty0YdSGRCO5rvYY8mS6FC 8CrdnAicoI1xKxCDzDmA3ZnBMRWBi8aNBc4zRD6TN00t4HGDBkPZW3DtFHzqRQbxOmBN v63yKwHj2PTGy/UsdpJ0c7FFpQU1ydCT9c0UKEf8Seq8+HO+ROOrfG4wnxTxxdPrHbxX M21Ri+N+FNNGe6wxDbcTOfbpuL/3Yf9keYsMZ5novjkxJh3Djj4IrsXkVi8Ndv4E2ve+ 0y9A== 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 :in-reply-to:references:mime-version:dkim-signature; bh=EU46mLQQ7G089XieiXXUNG+kvC8Kcv5wsXaiLDfWNPM=; b=BoEUVcH6Put/6mOZWJ+0uPppsXjA6QhnD4wV8FAtHm8WRt3zrC9DdzkaMWzwyyYaaV VnK3rCTsH2H22oP3an23LmPtiayH3hGt5TatZeQkmkPFvM5CADhtD1yvmmXPOPu0tW1a X58jalkx1WY3QmfTkPqR4hjZ5mTMcEDI/uovjAAaiPb0YVhbgA/o043wPHjhXEE5dcP0 I3nD78s0TGF1iD2UwTvM6CrnewO+D7+269Z8j9JARHhJhQYoBcMvNYUbDuZTOMAPTjtc eyerodlNKgM8bDxjb30mWOEjsJxckjYhxabVDsjDr73Rfq5O7ZjqMc0iMKPcZdoZL9KT 1cXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=hmZzhUQ1; 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 m10si47849292pll.355.2019.04.16.09.59.09; Tue, 16 Apr 2019 09:59:24 -0700 (PDT) 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=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=hmZzhUQ1; 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 S1729406AbfDPQ5V (ORCPT + 99 others); Tue, 16 Apr 2019 12:57:21 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:38812 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728052AbfDPQ5V (ORCPT ); Tue, 16 Apr 2019 12:57:21 -0400 Received: by mail-it1-f193.google.com with SMTP id f22so33715588ita.3 for ; Tue, 16 Apr 2019 09:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EU46mLQQ7G089XieiXXUNG+kvC8Kcv5wsXaiLDfWNPM=; b=hmZzhUQ1FwKF58/BA7qKfuPVO7YbSv0RBE33RVGiBatJnffk3jyClBySbZoneDLHaU 17pi5JG572jswpbG3sm3Yy+GTH0OLGDDyudPCL2O7/hOvS9mIU8IgtEm1/ZbnII+5T1q GDdCEPcXsulbIEM6uYikY9Lealf8lno5CoThLmUg6v7WHv5mv9WgNBWIl2eOagfhvJhH zOlpODIhHJg0VqCtGk9OtDfx5yZkWZI8HLAFS9u8Q3lepbHr9VSjzROvVVSxaNq8Swuc eF0AfeR7boqKeBlAhtCA6cKFpFrMIsaCnXj4ohfJ8E1e8JYuB05X7/sg6ingMGk4WH9U mvNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EU46mLQQ7G089XieiXXUNG+kvC8Kcv5wsXaiLDfWNPM=; b=VfPNTvR5K9+yrI170kJQ2S6KXBzsyncysyI2SKJchbhEq7PwBMRLBUO9gAAvEPCRKv sugQgf3/Du5UskHJOl1ZnqdRsyjwr+xLMT+mRcDGg5bH/X9XYHP78rHaVKPpHmlEqUE1 U7K3vfT4a2mevfTRBzZ4Q+zueun8NDm53kIO7EyiGehhX8xsmBy2qrlZe0wYM+Oafy+7 tlF3qZUM1ovsI51i/9Y7GRvv8TRCdsWii8y6BeiGxfnjeuK3va7clkk0BOhmxAXKfhaX k2wG/yObgoxc182q/bIC24Ie0ZuclHmSHuw6pyRANB+AhojZUXr1+D5tA+qLMT5TwzUd cbCg== X-Gm-Message-State: APjAAAV1T2R/eBXTNJw8o9GGNsH0rVD/xrca7+zMH6XjlUV3TH6UTY+T QGyTEaaW+oB9jaumK7ob7AKb5OR4BcAKjiRak5tMSg== X-Received: by 2002:a24:2458:: with SMTP id f85mr29260925ita.83.1555433839807; Tue, 16 Apr 2019 09:57:19 -0700 (PDT) MIME-Version: 1.0 References: <20190411031540.ehezr6kq7ouobpzx@ast-mbp.dhcp.thefacebook.com> <20190415104109.64d914f3@gandalf.local.home> <20190416083306.5646a687@gandalf.local.home> <20190416124939.GB6027@kroah.com> <20190416130440.GA7944@localhost> <20190416094509.1af6326b@gandalf.local.home> <20190416142240.GA31920@kroah.com> <20190416164642.krptlz32zusr4pgn@ast-mbp.dhcp.thefacebook.com> In-Reply-To: <20190416164642.krptlz32zusr4pgn@ast-mbp.dhcp.thefacebook.com> From: Olof Johansson Date: Tue, 16 Apr 2019 09:57:08 -0700 Message-ID: Subject: Re: [PATCH v5 1/3] Provide in-kernel headers to make extending kernel easier To: Alexei Starovoitov Cc: Greg Kroah-Hartman , Steven Rostedt , Karim Yaghmour , Joel Fernandes , Kees Cook , Olof Johansson , Joel Fernandes , Linux Kernel Mailing List , Qais Yousef , Dietmar Eggemann , Manoj Rao , Andrew Morton , Alexei Starovoitov , atish patra , Daniel Colascione , Dan Williams , Guenter Roeck , Jonathan Corbet , Android Kernel Team , "open list:DOCUMENTATION" , "open list:KERNEL SELFTEST FRAMEWORK" , linux-trace-devel@vger.kernel.org, Masahiro Yamada , Masami Hiramatsu , Randy Dunlap , Shuah Khan , Yonghong Song 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 Tue, Apr 16, 2019 at 9:46 AM Alexei Starovoitov wrote: > > On Tue, Apr 16, 2019 at 04:22:40PM +0200, Greg Kroah-Hartman wrote: > > On Tue, Apr 16, 2019 at 09:45:09AM -0400, Steven Rostedt wrote: > > > On Tue, 16 Apr 2019 09:32:37 -0400 > > > Karim Yaghmour wrote: > > > > > > > >>> Then we should perhaps make a new file system call tarballs ;-) > > > > >>> > > > > >>> /sys/kernel/tarballs/ > > > > >>> > > > > >>> and place everything there. That way it removes it from /proc (which is > > > > >>> the worse place for that) and also makes it something other than debug. > > > > >>> That's what I did for tracefs. > > > > >> > > > > >> As horrible as that suggestion is, it does kind of make sense :) > > > > >> > > > > >> We can't put this in debugfs as that's only for debugging and systems > > > > >> should never have that mounted for normal operations (users want to > > > > >> build ebpf programs), and /proc really should be for processes but that > > > > >> horse is long left the barn. > > > > >> > > > > >> But, I'm willing to consider putting this either in a system-fs-like > > > > >> filesystem, or just in sysfs itself, we do have /sys/kernel/ to play > > > > >> around in if the main objection is that we should not be cluttering up > > > > >> /proc with stuff like this. > > > > >> > > > > > > > > > > I am ok with the suggestion of /sys/kernel for the archive. That also seems > > > > > to fit well with the idea that the headers are kernel related and probably > > > > > belong here more strictly speaking, than /proc. > > > > > > > > This makes sense. And if it alleviates concerns regarding extending > > > > /proc ABIs then might as well switch to this. > > > > > > > > Olof, what do you think of this? > > > > > > BTW, the name "tarballs" was kind of a joke. Probably should come up > > > with a better name. Although, I'm fine with tarballsfs ;-) > > > > No need to have this be a separate filesystem, we can use a binary sysfs > > file in /sys/kernel/ for this as the kernel is not doing any "parsing" > > of the data, it is just dumping it out to userspace. > > What folks keep saying that an fs of header files is easier to use > than tarball from bcc and cleaner from architectural pov. > That's not the case. > From bcc side I'd rather have a single precompiled headers blob > that I can feed into clang and improve bpf program compilation time. > Having a set of headers is a step to generate such .pch file, > but once generated the headers can be removed from fs and kheaders > module unloaded. > The sequence is: bcc checks standard /lib/module location, > if not there loads kheader mod, extracts into known location, and unloads. May I suggest keeping the bcc-populated headers somewhere else? Ideally something cleaned out on every reboot in case kernel changes without version string doing it. That way you can by default prefer the module-exported tarball, and fall back to /lib/module/$(uname -r)/ if not available, instead of the other way around and instead of having to check creation times on the dir vs boot time of the kernel, etc. Anyway, that's just an implementation detail. But it's the kind of detail that all tools that use this would need to get right, instead of doing it right once by exporting it in a way that it can be directly used. > The extraced headers are in plain fs cache and will be evicted from memory > when bcc is done compiling progs. > imo much cleaner than kernel maintaining headers-fs and wasting memory. So, in my original proposal I recommended unmounting when not needing it, which would remove the memory usage as well. > Where kheaders.tar.xz is placed doesn't really matter. > /proc or /sys/kernel makes no real difference. If done in a location that isn't a perpetual ABI commitment, a tarball solution is something we can work with. -Olof