From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-6.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id AA7317D04D for ; Sat, 2 Mar 2019 02:39:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbfCBCjo (ORCPT ); Fri, 1 Mar 2019 21:39:44 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:36034 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfCBCjn (ORCPT ); Fri, 1 Mar 2019 21:39:43 -0500 Received: by mail-qk1-f193.google.com with SMTP id c2so14823457qkb.3 for ; Fri, 01 Mar 2019 18:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5Temr26glEFV5oBvptkrenNBwbSVXvaTPHPZBdA7hho=; b=fevPHetGuRxApcOMs7+xRchWUctf+oj1jQqEq46J109zotdV7Y2+0pdX4q79SgjvX5 UVzx1FJ/2GGQCg4V9qIjmPNHu8BA5s6eZJtubMrLUEIeyc/al1fnL48cn4TibRFZT0ym bNUWQQUM1tpWtBk2SDHB1B8LQPEAHQm/OHd+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5Temr26glEFV5oBvptkrenNBwbSVXvaTPHPZBdA7hho=; b=WFqqWkoC0CjTmLm88pqF93x1GqafNT8loiuF0WBUtJd2n1QVxXfjHns4MLU77isD8m wvQYmPvv3wsnkza8vUWiyJag1MaKMrGJH8g0vSmGQoF4gZdXwhaCDujE27qk9sCOhMAm RcSR3bZLoVyZE8ysS3r1NzTm9NKX/O4pvvu00tT6orS93H2sZ4+RjdUIiJUWFH+9RY+E hafi4poxeHCfhzXHCinokTixTZvfzQPkA4H+XHyyxyVqRW2trvLmKOAiHK4gSATcIvsu iWsZJHp6nh1y+SVBBE+dMTRgfrJ5F9MU4Q50Myw4CJJ/4oJrT12eVmkCt6r1PDhCCg3c JawA== X-Gm-Message-State: APjAAAXgR14+49BOfgkNqXwVjPzR+JmD21MDdMkGfJYpw0SlQ2eNxSOl 637ye3/dOSOThe0F+VfRN53T2YJ/UP4= X-Google-Smtp-Source: APXvYqws/TPWsG/bS5u7wD2HdripLz6HAVECeBO8vtpK9O2+uSxGPz857GonmrvABkuB4UebSYCU1w== X-Received: by 2002:a37:f506:: with SMTP id l6mr6466129qkk.110.1551494382200; Fri, 01 Mar 2019 18:39:42 -0800 (PST) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id h10sm24209069qta.3.2019.03.01.18.39.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2019 18:39:41 -0800 (PST) Date: Fri, 1 Mar 2019 21:39:40 -0500 From: Joel Fernandes To: Masahiro Yamada Cc: Linux Kernel Mailing List , Andrew Morton , Alexei Starovoitov , atish patra , Daniel Colascione , Dan Williams , Greg Kroah-Hartman , Guenter Roeck , Jonathan Corbet , Karim Yaghmour , Kees Cook , kernel-team@android.com, "open list:DOCUMENTATION" , "open list:KERNEL SELFTEST FRAMEWORK" , linux-trace-devel@vger.kernel.org, Manoj Rao , Masami Hiramatsu , Paul McKenney , "Peter Zijlstra (Intel)" , qais.yousef@arm.com, Randy Dunlap , Steven Rostedt , Shuah Khan , Thomas Gleixner , Yonghong Song Subject: Re: [PATCH v3 1/2] Provide in-kernel headers for making it easy to extend the kernel Message-ID: <20190302023940.GA55262@google.com> References: <20190227193748.132301-1-joel@joelfernandes.org> <20190228144306.GA138215@google.com> <20190301171954.GA217990@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Sat, Mar 02, 2019 at 11:13:07AM +0900, Masahiro Yamada wrote: > On Sat, Mar 2, 2019 at 3:03 AM Joel Fernandes wrote: > > > > On Fri, Mar 01, 2019 at 03:25:05PM +0900, Masahiro Yamada wrote: > > [...] > > > > > I am guessing the user will run these commands > > > > > on the target system. > > > > > In other words, external modules are native-compiled. > > > > > So, > > > > > > > > > > target-arch: arm64 > > > > > host-arch: arm64 > > > > > > > > > > > > > > > Is this correct? > > > > > > > > > > > > > > > If I understood the assumed use-case correctly, > > > > > kheaders.tar.xw will contain host-programs compiled for x86, > > > > > which will not work on the target system. > > > > > > > > > > > > > You are right, the above commands in the commit message work only if the > > > > host/target are same arch due to scripts. > > > > > > > > However we can build with arm64 device connected to a host, like this (which > > > > I tested): > > > > > > > > adb shell modprobe kheaders; adb pull /proc/kheaders.tar.xz > > > > rm -rf $HOME/headers; mkdir -p $HOME/headers > > > > tar -xvf /proc/kheaders.tar.xz -C $HOME/headers >/dev/null > > > > cd my-kernel-module > > > > make -C $HOME/headers M=$(pwd) ARCH=arm64 CROSS_COMPILE=aarch64- modules > > > > adb push test.ko /data/; adb shell rmmod kheaders > > > > > > > > The other way we can make this work is using x86 usermode emulation inside a > > > > chroot on the Android device which will make the earlier commands work. One > > > > thing to note is that Android also runs on x86 hardware so the commands in > > > > the commit message will work even for x86 Android targets already. > > > > > > > > Also note that this the "module building" part is really only one of the > > > > usecases. eBPF is another which needs the headers - and the headers are vast > > > > majority of the archive. Headers take 3.1MB out of 3.6MB of the archive on > > > > arm64 builds. > > > > > > > > How do you want to proceed here, should I mention these points in the commit > > > > message? > > > > > > > > > > > > I do not request a re-spin just for a matter of commit log, > > > but this version produces an empty tarball. > > > So, you will have a chance to update the patch anyway. > > > > > > In the next version, it would be nice to note that > > > "external modules must be built on the same host arch > > > as built vmlinux". > > > > Ok, I respun it with 1 more minor nit for arm64 building. Please take a look. > > > I have not checked code-diff in v3 yet. > > Anyway, I will add comments to v4 > if I notice something. Ok. Since all your comments from previous series were addressed, it would be nice to get your Acked-by tag for v4 unless you have further comments or concerns. > > > Let me ask one more question. > > > > > > I guess this patch is motivated by > > > how difficult to convey kernel headers > > > from vendors to users. > > > > > > In that situation, how will the user find > > > the right compiler to use for building external modules? > > > > > > > > > > > > > > > Greg KH said: > > > > > > We don't ever support the system of loading a module built with anything > > > other than the _exact_ same compiler than the kernel was. > > > > > > > > > For the full context, see this: > > > https://lore.kernel.org/patchwork/patch/836247/#1031547 > > > > IMO this issue is not related to this patch but is just an issue with > > building external modules in general. > > > I do not think it is an issue of the build system, at least. > > As far as I understood Greg's comment, it is troublesome > without the assumption that vmlinux and modules are built > by the same compiler. > It is related to this patch since this patch assumes use-cases > where external modules are built in a completely different environment, > where a different compiler is probably installed. Yes, but what I'm trying to say is the same issue exists with all other solutions today that do this. Such as debian you have linux-headers package. A user could totally use the build artifacts obtained from somewhere to build a kernel module with a completely different compiler. That issue has just to do with the reality, and isn't an issue caused by any one solution such as this one. I agree care must be taken whenever user is building external kernel modules independent of kernel sources. Did I miss something else? thanks a lot, - Joel