Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp499723pxb; Thu, 25 Feb 2021 07:52:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+NDP+dpLt1HFrwt0968Mhv4Z/bQzwbgHXSxnACDt6zbLfmby7dOv8aTjIyE9CpRVSuO9e X-Received: by 2002:a17:906:4c99:: with SMTP id q25mr3365636eju.111.1614268332552; Thu, 25 Feb 2021 07:52:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614268332; cv=none; d=google.com; s=arc-20160816; b=lCUz6CwqNVexo75GepElYv499npXc+8HPbkZGmsthmAfFoHcwTvXF0uyWCNLrpZNFY xv1TfDDUa1fLwq8cs3tFkQ6IWjILZoYgz7vYAPtpdG5HbOc1ev7Djx4NwYRUGLjkNi65 qm12z+CjtLBM51AsDnIdYQontnoL+hdmHTXEqmdCstpTCQkbQo9f09ynI8wcPROl8laM dCcJywL8HlcYZwbvEQMJJ9aWZ2BlcF8iQh98Bn6uyIxa4hYLmDGwOy63ZSZORUaFuZKh 8iEhOwtlU51u6MlfngAdnzpnkatOpJlpGbQbMshKq1jFYSmJMc/i2JQA3SXJ4CpL78+H GoOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=EfNUhCf4R+3xK8k7NUCRh0gNVZNKtwuPWzGtwDXWKOo=; b=GpXG9EAVCPL5UCQwmiVIVdeVojhEKH3Qw//u/4gFsJinhHM/qkTWN2X14iiRB+6vNI z5JiLqNOcpgPdTm02dyZ89bB4tGHpww3AefcBG9pj9sSoRrSMiZYLmvYuJpfdUsmJpZu 5QB+nxWHsPZrgxtZeZQaogq874UrGrfU5u3NfijsD6nf+NRf5Ijcon3Vw0Rq7Uwfcivn CC4pBG+vWMhMvQcCazmXaOH6o1+d4uYVD028+kRQKB3CCJstog6D/109sC1Vk/4tveOG RrbHTwJC9HLpA3YOgdQw3DvhJ8dpw8IGFZiOvyOaqP3ZlpDAhWFRM8d4hddvQQoy3xME ZVVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=qa8S3Nzx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ox26si4246401ejb.4.2021.02.25.07.51.49; Thu, 25 Feb 2021 07:52:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=qa8S3Nzx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230459AbhBYPvU (ORCPT + 99 others); Thu, 25 Feb 2021 10:51:20 -0500 Received: from conssluserg-05.nifty.com ([210.131.2.90]:18607 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbhBYPvO (ORCPT ); Thu, 25 Feb 2021 10:51:14 -0500 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 11PFo4KO025029 for ; Fri, 26 Feb 2021 00:50:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 11PFo4KO025029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1614268205; bh=EfNUhCf4R+3xK8k7NUCRh0gNVZNKtwuPWzGtwDXWKOo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qa8S3NzxOHF6hHbUVZau3hu0tvaub7cilKWGFuOyp+RoxWOUlFljZYjhPshry8DmA dCtpTZduPKvb75TiCuBBU6652hQshWEwQqzBcbDb8yxk69R2g2y/iiWXR0tVvqiFg6 V9khO/FPBqxkxXt1AWhRL9qumD6fEGbG+CoVEBbl9Z0kwGyC5EkAosaaDw4szPyA/d ue61gb569PM/wnYoy8IUhz/5S9KyFJylJOTYKFUW/OQCBWCPW91shlH3HCXXOdTqzL Fj7DY/y9p3oHpRGdAG/0omGhC+l+tW7EcWHUbxKy/PY0ZJtaR92xqxYkpTgoE8kRaS Oo19QtDL2X/Xg== X-Nifty-SrcIP: [209.85.214.180] Received: by mail-pl1-f180.google.com with SMTP id u11so3386561plg.13 for ; Thu, 25 Feb 2021 07:50:04 -0800 (PST) X-Gm-Message-State: AOAM531ZRcQYUqf+U7QoHubzZEebwxx3sKl+5wC216MhT/cKS7/QjaJ0 CXjDPJP24rEyT+d3zVFwtG/yqmfULtBVBllrXxg= X-Received: by 2002:a17:90a:dc08:: with SMTP id i8mr3700939pjv.153.1614268204142; Thu, 25 Feb 2021 07:50:04 -0800 (PST) MIME-Version: 1.0 References: <20210223200130.GA8059@lst.de> In-Reply-To: From: Masahiro Yamada Date: Fri, 26 Feb 2021 00:49:27 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] Modules updates for v5.12 To: Rasmus Villemoes Cc: Jessica Yu , Linus Torvalds , Christoph Hellwig , Linux Kernel Mailing List , =?UTF-8?Q?=EF=BF=BCMiroslav_Benes?= , Emil Velikov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 4:36 AM Rasmus Villemoes wrote: > > On 24/02/2021 15.40, Masahiro Yamada wrote: > > On Wed, Feb 24, 2021 at 5:33 PM Jessica Yu wrote: > >> > >> +++ Linus Torvalds [23/02/21 12:03 -0800]: > >>> On Tue, Feb 23, 2021 at 12:01 PM Christoph Hellwig wrote: > >>>> > >>>> Does your build now enable TRIM_UNUSED_KSYMS but previously didn't by > >>>> chance? > >>> > >>> Crossed emails. > >>> > >>> This is plain "make allmodconfig", so yes, now it will enable TRIM_UNUSED_KSYMS. > >>> > >>> This is unacceptably slow. If that symbol trimming takes 30% of the > >>> whole kernel build time, it needs to be fixed or removed. > >> > >> [ Adding Masahiro to CC ] > >> > >> It looks like CONFIG_TRIM_UNUSED_KSYMS had been hiding behind > >> CONFIG_UNUSED_SYMBOLS all this time, and once the EXPORT_UNUSED_SYMBOL > >> stuff was removed, it exposed that option to be selected by > >> allyesconfig. That option had previously caused build issues on > >> powerpc on linux-next, so I had temporarily marked that as BROKEN on > >> powerpc until Masahiro's fix landed in linux-next. I was not aware of > >> the additional build slowdown issue :/ In any case, Christoph's > >> suggestion to invert the option sounds reasonable, since the mips > >> defconfig selects it, it does not seem totally unused. Good insight. Actually, I came up with the same idea last night, and had started the implementation background. I needed sleep before completing the patch set, but now it is working as far as I tested. BTW, KEEP(*(SORT(___ksymtab+foo ___ksymtab+bar ___ksymtab+baz)) is a syntax error. KEEP(*(__ksymtab+foo)) KEEP(*(__ksymtab+bar)) KEEP(*(__ksymtab+baz)) works. > > > > TRIM_UNUSED_KSYMS builds the tree twice by its concept. > > > > [1] 1st build > > At this point of time, we do not know which EXPORT_SYMBOL() > > is needed. So, EXPORT_SYMBOL() is enabled, or noop'ed > > based on the temporal guess. > > (in the fresh build, EXPORT_SYMBOL() are all nooped.) > > > > [2] Get the list of symbols needed to resolve all symbol references. > > (this information is collected in include/generated/autoksyms.h) > > > > [3] 2nd build > > Rebuild the objects whose EXPORT_SYMBOL() > > must be flipped. > > I'm thinking we should be able to generate a linker script snippet from > [2] and use that when linking vmlinux, so there's no recursion and no > rebuild of individual .o files (and all the __cond_export_sym trickery > goes away). > > The ksymtab entry for foo is already emitted in its own ___ksymtab+foo > section (or ___ksymtab_gpl+foo). So if the sorted list of undefined > symbols listed in the .mod files (plus the whitelist) consist of foo, > bar and baz, generate a header to be included by vmlinux.lds.h that says > > #define KSYMTAB_SECTIONS \ > ___ksymtab+foo \ > ___ksymtab+bar \ > ___ksymtab+baz \ > > #define KSYMTAB_GPL_SECTIONS \ > ___ksymtab_gpl+foo \ > ___ksymtab_gpl+bar \ > ___ksymtab_gpl+baz \ > > with a !CONFIG_TRIM_UNUSED_KSYMS definition of these that just says > > #define KSYMTAB_SECTIONS ___ksymtab+* > #define KSYMTAB_GPL_SECTIONS ___ksymtab_gpl+* > > and use that > > __ksymtab AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ > __start___ksymtab = .; \ > KEEP(*(SORT(KSYMTAB_SECTIONS))) \ > __stop___ksymtab = .; \ > > Only one of ___ksymtab+foo and ___ksymtab_gpl+foo will exist, but that > doesn't matter (it's really no different from the fact that many files > (i.e. the * before "(SORT") don't contain any section matching > ___ksymtab_gpl+*). > > We may then have to add another discard section to put the remaining > ___ksymtab_gpl+* sections in, but that's fine as long as that stanza > just appears later in the linker script. > > If LD_DEAD_CODE_DATA_ELIMINATION was more widely supported (and I was > surprised to see that it's not even available on arm or x86) one could > also play another game, dropping the KEEP()s and instead create a linker > script snippet containing EXTERN(__ksymtab_foo __ksymtab_bar ...), > referencing the "struct kernel_symbol" elements themselves rather than > the singleton sections they reside in. Do you mean LD_DEAD_CODE_DATA_ELIMINATION must be enabled by default to do this? > > Rasmus -- Best Regards Masahiro Yamada