Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1599586imc; Mon, 11 Mar 2019 18:23:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJwi2qxhMMf4Cnk9sP0jTuS8EskH4nyoRrjPdJJ+RcaN0R5EIIgAKvofZ5slwygTFIZ+rg X-Received: by 2002:aa7:8251:: with SMTP id e17mr35968672pfn.96.1552353791937; Mon, 11 Mar 2019 18:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552353791; cv=none; d=google.com; s=arc-20160816; b=VBDlujFCZWgmeAPRdfmJbQUIWWfsMbbvBVVnQXHIWuZDc+5bKPO6kH+Pwd6XDbTFxF FKEccIc0B0XKNpsnb55Gt0tLKfcyCeG8ialmrFd9bKwm2dR/0+yz5MZC7JZNzDkoYhjI +Cy7R80PdJFioLdRQOAj6PWdy754x1AB+z8HRFsWK4K/Ui4NQc44DP4YGdbdzfyKePtw zAk57Kq55qlHfCpqoHsYNJ/JmgMHOOGyzQPtmctKoPL5uomOAl7QfEJiVbd9K751BzOE QSNinwovByw2QBFwApMwXpFSzMIJqBcYZSBxbwqvvOckeOyGQpLK+e8gOhpBzTaLWzaG KIIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=KgGH/hh9fkZBNvA8NI4/cnp122yHum0sPIfEqF5iCgA=; b=RnXygJak6T04kjBTUcO32YI2m16S5juq/100jQdJW5wnEtgZhQWujFZ878uwCfdA4S lO8/BXYUTlhHZq4fmyyZKng+4XAVTcVFBEX25kNgSnA+tVp4vazZPl4xE1tdZT2JEp71 1pGnNyslkt05R+Wwx8xoV8Li5NAiq3CopGj4GzKCe8DP05VWksNTMwjTpb/OSnCgTS2e w9pPP9sGTkM/mrKSGz6ElShRtyOoSegpIk/wZ0LI+ylTq4cKmEx4dW6+YeDaO+FL8mcv K2MZ/94pJciQxpoEX6fnk31C2XvTICrw6ri/KNOmHlzgNb5/wBQk3rPr0UsvUxOF44kC 8UxQ== ARC-Authentication-Results: i=1; mx.google.com; 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 v3si6662941plo.147.2019.03.11.18.22.55; Mon, 11 Mar 2019 18:23:11 -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; 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 S1726624AbfCLBWS (ORCPT + 99 others); Mon, 11 Mar 2019 21:22:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:54782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbfCLBWS (ORCPT ); Mon, 11 Mar 2019 21:22:18 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C181214AF; Tue, 12 Mar 2019 01:22:12 +0000 (UTC) Date: Mon, 11 Mar 2019 21:22:06 -0400 From: Steven Rostedt To: Daniel Colascione Cc: Karim Yaghmour , Geert Uytterhoeven , Greg KH , Joel Fernandes , LKML , Andrew Morton , Alexei Starovoitov , atish patra , Dan Williams , Dietmar Eggemann , Guenter Roeck , Jonathan Corbet , Kees Cook , Android Kernel Team , "open list:DOCUMENTATION" , "open list:KERNEL SELFTEST FRAMEWORK" , linux-trace-devel@vger.kernel.org, Manoj Rao , Masahiro Yamada , Masami Hiramatsu , Qais Yousef , Randy Dunlap , Shuah Khan , Yonghong Song Subject: Re: [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel Message-ID: <20190311211952.129c5821@oasis.local.home> In-Reply-To: References: <20190301160856.129678-1-joel@joelfernandes.org> <20190307150343.GB258852@google.com> <20190308140251.GC25768@kroah.com> <20190309071648.GE3882@kroah.com> <20190309121141.GA30173@kroah.com> <3e84e1ef-e266-e983-5874-6c26ac7f38b8@opersys.com> <20190311193612.4f09bf11@oasis.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Mar 2019 16:58:28 -0700 Daniel Colascione wrote: > On Mon, Mar 11, 2019 at 4:37 PM Steven Rostedt wrote: > > > > On Sat, 9 Mar 2019 16:44:31 -0500 > > Karim Yaghmour wrote: > > > > > > > Sorry, I should've been clearer. I'm including eBPF/BCC into the > > > "user-space tools" here. That was in fact my prime motivation in > > > encouraging Joel at the last LPC to look at this. I've been integrating > > > the teaching of eBPF into my AOSP debugging and performance analysis > > > class (see CC courseware here: > > > http://www.opersys.com/training/android-debug-and-performance), and it > > > was pretty messy trying to show people how to benefit from such tools > > > under Android. Joel's present set of patches would obviate this problem. > > > > I've been reading this thread and staying out for the most part. But I > > was thinking about how I could use kernel headers for things like > > kprobes, and I want to mention the pony that I would like to have :-) > > > > Are headers really needed, and more importantly, are they enough? What > > if userspace is 32bit and the kernel is 64bit. Can ebpf scripts handle > > that? > > Why would eBPF care about the bit width of userspace? I've thought a How do you know the difference between long if you are running on a 64bit kernel in 32bit userspace? I haven't compiled into ebpf byte code, so I'm clueless here, but I know other tools (PowerTop) got burnt when it assumed "long" was 4 bytes when digging into the kernel via trace events, when the kernel was 64bit and user was 32bit. > lot about inspecting user state from the kernel and have some weird > ideas in that area (e.g., why not register eBPF programs to unwind > user stacks?) --- but I think that Joel's work is independent of all > that. I'm curious what you think we can do about userspace. I wish we > could just compile the world with frame pointers, but we can't. I don't care about user space here. I'm talking about the tools that need to dig into the kernel, but the tools are 32bit and the kernel is 64bit. Of course, if the tools know the kernel is 64bit regardless, then it doesn't matter. > > > What I would love, is a table that has all structures and their > > fields with information about their types, size and signed types. > > Like the format fields in the events directory. This way ebpf (and > > kprobes, internally in the kernel) could access this table and be > > able to know what the data structures of the kernel is). > > Think of the headers as encoding this information and more and the C > compiler as a magical decoder ring. :-) I totally get the desire for a > metadata format a little less messy than C code, but as a practical > matter, a rich C-compilation pipeline already exists, and the > debuginfo you're proposing doesn't, except in the form of DWARF, which > I think would be even more controversial to embed in the kernel memory > image than headers are. A header blob provides a strict superset of > the information your scheme provides. We already embed dwarf like information in the kernel. It's called ORC, and is used by bpf (as well as perf, ftrace and stack dumps) when we need to read functions. A very small subset of dwarf like data would be used. Just the data structures, nothing else. -- Steve