Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6742368imm; Tue, 24 Jul 2018 02:10:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdxn1ZH/jMvKTJJg504pP6UZ4p2FLk5jGrjHPOjrEdtD7tRYwa9Ldp6xb7F8aKBPJnaVxcl X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr1967740plb.189.1532423408293; Tue, 24 Jul 2018 02:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532423408; cv=none; d=google.com; s=arc-20160816; b=haeHfMPhB0IbwFlQ35lguLN0xjuRl0pqqoFJ1vQPMuzUor514DIkVL3y+N5/aSjSZT /F8Ix4zebm4JQmanVImz2vWwVBLwjfP+r2pFDedyA3kK5bZfzEj+9KXYdBxGxljM5vWT rQA71oJuxQ/oAgWXCH95GdWg/d92pmJGxjZQ+DiPoh2N3TIvQgbHZ9rS1GqWSAZ+490L 7UqifnKJe3EqblIGhi+4TQS4bx5nrOJ2gloH86nk67kaHjW1g1VmJmGTnWt79vNk9lWn qSE/BAXLEze3Ce5ae/7v1GeEFJYCoUXEpAzpQSp8wL9/iPnQhlJDBs4OB9RNMqLe48vh 95aA== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=tldQM/OLlJ9qEjeJ+cPEjKb0f/dDCy9sPytvqBK3IdQ=; b=Era3W0gm6bIYhYLictf4eLKqHZt+Df43fNguaIjz/GwyDeKdjI6RdtesqFGbniKXK5 udhwoXC/RdsUSo72GVNOhimdBk0Dji4NG65m9LXDEEt9YqNks8SDn1MuRSluOUv61hH9 0BgP+iPN5bltoLQ4jCF0IceSXYNtZNv5e/Gqof7h1hONWIfEq6JFZoZn6MHcylcnvAKH u+lndqvY+gaJkcYmE8Nf/4Fc/naYyEzCBj8V2/QUpk60aq7bVzJJuKWwhxXJSJkI/aZ/ srbt88cY9oG9MDwkyDJF1l2LmA+yY4GnKMEVJjNxVmOxVhhr0kBaXmgEiZj6SaaQE+mY 9LJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WesUxG8q; 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 q13-v6si10590651pgq.526.2018.07.24.02.09.53; Tue, 24 Jul 2018 02:10:08 -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=fail header.i=@gmail.com header.s=20161025 header.b=WesUxG8q; 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 S2388334AbeGXKNw (ORCPT + 99 others); Tue, 24 Jul 2018 06:13:52 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:45308 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725723AbeGXKNv (ORCPT ); Tue, 24 Jul 2018 06:13:51 -0400 Received: by mail-qt0-f196.google.com with SMTP id y5-v6so3371856qti.12; Tue, 24 Jul 2018 02:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=tldQM/OLlJ9qEjeJ+cPEjKb0f/dDCy9sPytvqBK3IdQ=; b=WesUxG8qPh2ecmBJWJIBU0rlWVCFRlI4HbjYyMM6tnVNwzlT/i9UZLe7Wcxk0BM0RV 6Gw9J6r2pFA0oTuWKZmYa5QbrRrMkLtrF/99elcZYY/E1FQk59WPicsntl+KUY4mNbul 8tOHkxrk35rWHvybUNJufNhlmbDaRV0WHm3s+aZSOSsDDrFQkhyZX2UBKYIW5hFrUHo7 UlqMJ9BPW2RGnK2fcdUEdgXOTxD0F4kQRUn4POsb/lXKL6W6aS19cF6RJA9aKHZmgSoa rjyzaSBhLggCMF5h1HWq3nDkMDy8cAmBYw9MMSEdqRNGv6Z/bH+PWUsTP7asVT/o0hbA tCmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=tldQM/OLlJ9qEjeJ+cPEjKb0f/dDCy9sPytvqBK3IdQ=; b=d68JsK4VqLKl6gCWLjJY7AkgNYF1wOkBg+9IiQxCT8ZJqgw3NlekRbqTeq72VULDJz iNqBNexI6aqKQRNcWOWFUYvAtcIn/idGfdYZ2yO7ZkQfJ2aoKcTHGTNXhuDY/Ka5gpd1 CXYliNXwEk7mjjxlU/tC9RcFfobJUEMQWA0yFzzQSU3E8rJesj39sKpiuSt2mlWxoYvt xUvmwS1K9alXPj1u3ljsod6ygE9Zh2u8rWhRdOcf0D2agt0PtCweLzRPSxFjUkmvdLwO dmXmqWdQ0z4CmEnOacdaJhVBXnledCpPo8Mm9MaZJsuZOzzRoifVBhQoMFNV7IPfLQRX S+jQ== X-Gm-Message-State: AOUpUlGYUdBbLHY97ZGOf0wXctmJVVDAnsShKEeDTa8RyZYSnch7pN8n vgkFnv+uK7U2JKhMptv/r2p0Np8S7ri0fOsuAgk= X-Received: by 2002:ac8:30e3:: with SMTP id w32-v6mr15831082qta.280.1532423302211; Tue, 24 Jul 2018 02:08:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:967d:0:0:0:0:0 with HTTP; Tue, 24 Jul 2018 02:08:21 -0700 (PDT) In-Reply-To: References: <20180716122125.175792-1-maco@android.com> From: Arnd Bergmann Date: Tue, 24 Jul 2018 11:08:21 +0200 X-Google-Sender-Auth: YpEoGbrW_lwetEiYAIylc-nthTU Message-ID: Subject: Re: [PATCH 0/6] Symbol namespaces To: Martijn Coenen Cc: Linux Kernel Mailing List , Masahiro Yamada , Michal Marek , Geert Uytterhoeven , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , Alan Stern , Greg Kroah-Hartman , Oliver Neukum , Jessica Yu , Stephen Boyd , Philippe Ombredanne , Kate Stewart , Sam Ravnborg , Linux Kbuild mailing list , linux-m68k , USB list , USB Storage list , linux-scsi , linux-arch , Martijn Coenen , Sandeep Patil , Iliyan Malchev , Joel Fernandes 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, Jul 24, 2018 at 10:09 AM, Martijn Coenen wrote: > Hi Arnd, > > On Mon, Jul 23, 2018 at 4:28 PM, Arnd Bergmann wrote: >> This looks nice. I don't want to overload you with additional >> requests, but it might be good to think about how this can >> be taken further, if we want to actually convert large >> parts of the kernel to it. > > No worries about overloading, I'm happy with all feedback to make this better. > >> I have two ideas: >> >> - It would be nice to have a simple mechanism in Kconfig >> to put all symbols in a module into a namespace that is >> derived from KBUILD_MODNAME, to avoid having to >> annotate every symbol separately. This could be similar >> to how we ended up dealing with EXPORT_NO_SYMBOLS >> in the linux-2.4 days, with the goal of eventually having >> a namespace for each symbol. Similarly, we could pass >> a number of default namespaces through the Makefile, >> e.g. if we have a directory that has lots of drivers that all >> import the symbols from a common subsystem module. > > I'm hinging on two thoughts here; I really like it because it > obviously reduces work and makes this easier to use. On the other > hand, you now have to look in multiple places to see if a symbol is > exported to a namespace/imported from a module. Perhaps it depends on > how coarse-grained the namespaces end up being. Either way, I think it > would be pretty easy to cook up patches for this. Ok, maybe try it and see where we get with it? >> - If this is possible to implement, it would be great to have >> a way to limit the globally visible symbols in a module >> to the ones that are explicitly exported even when a that >> module is built-in rather than loadable. Not sure how this >> is best done though. A couple of things can be done with >> objcopy, or possibly by reintroducing partial linking (which >> was removed not too long ago). > > If I understand you correctly, this is orthogonal to symbol > namespaces, right? Right, the only connection here is that both try to limit the scope of which symbols are available where. This can definitely be done without symbol namespaces. The implementation I had in mind with objcopy might end up using the same KBUILD_MODNAME as a prefix for internal symbols (which are not exported to modules), but that is a different problem. Another related area is the question what happens to symbols that we want to share between two built-in parts of the kernel without exporting them to modules. E.g. if we might want to put all of vfs into one built-in module and make its symbols private to that module, while all of the mm subsystem is in a separate built-in module. The symbols that are needed for communicating between the two could simply be exported with EXPORT_SYMBOL_GPL(), but we that would open the surface to loadable modules that can't access them today. Using namespaces could solve that problem by limiting the scope in another way, or we could come up with a different method to annotate them, such as using the gcc visibility attributes. > Do you think these things should be a part of these series, or can it > be a follow-up? If you think you can do the first thing easily, I'd say we should try to come up with an idea of where we want to take this in the long run. For limiting the scope of global symbols, that may well be a much bigger task to do upfront, so unless you have an idea for how to do that, maybe keep it in mind but let's not make it a dependency. Arnd