Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3952328rwb; Mon, 21 Nov 2022 01:39:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4xKtyq565hK5Qk5fA/CSKcTZ1nHzDC4wHsUV4OmJTtISL4MDVzjxhC0V0z6a4ZcdOg1UXw X-Received: by 2002:a17:902:b414:b0:186:7fda:4d4a with SMTP id x20-20020a170902b41400b001867fda4d4amr3612281plr.66.1669023542218; Mon, 21 Nov 2022 01:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669023542; cv=none; d=google.com; s=arc-20160816; b=EmGqz2UxNjHhSqI2Vjilhfz7rW02oA/Hygjjbxdg8gN0H4i7KhbdPltL2Qw/vKqL6d zW0qsHXkuiMuxo4/23WIZMedr7mH/cYtGHOpwcIw4P+lFkuEkexV0IKB2oX4rYsXyVa/ 6THoHnSJFSfGuP0tWPgBBYTqTW1w2fmAYvBIQKwJQDobRn14Lv+0IFNjvKtnerjXDVQK Q/KjoZKUv6iCJ/1GfvCQt23nQ2Vb4wswLnuYDaYus2l9JkSek7FMzhxslQrH29QMF4EP BJWptcoQoB9+MTC8CIrI3ZtRdvP37YIU2uN0x0UhKuIxme3x76lvCfpCbVioKFFVlwKY 3wIQ== 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=7X6L8AAqOEY0/aQSZIAWdIdlY5cPDBedn82Z4qDbDj8=; b=d03Cq5RMbfnp/+M6+2kOPkx9Z0sqMWkgfECfWqzxUZc9Yy1YlgFm+Pta8gA42AW8K4 3PXb2XJ2zORzpFXqhP08kBgdqXFyBz09YY6tvIiQUeu1yzy+ho6rSWlvbia/7cGsPqLF hOisulJ7LDnZHo7JmVRZtO6xIHaXbsReZs/XfDGEbGrCopt9uUP5Q8aMZBRQ8rV+mwk1 RdUVHgWCCaumAijaGIbrgRSlUKL0s6AqQroOREkO/CeoqGCqh0AJeyBlBJOzb2WNGea3 voqmq2Kd/S9vASS0TsyOELnfBB0oGL7AbBDuoxITsXv/jAWDDu9wyo34ZlRAaPFwungt Fttw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=bnQuxmb5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a656c0f000000b0046f7d43c578si11296452pgu.133.2022.11.21.01.38.47; Mon, 21 Nov 2022 01:39:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=bnQuxmb5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229908AbiKUJH0 (ORCPT + 91 others); Mon, 21 Nov 2022 04:07:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbiKUJHW (ORCPT ); Mon, 21 Nov 2022 04:07:22 -0500 X-Greylist: delayed 33674 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 21 Nov 2022 01:07:21 PST Received: from conssluserg-04.nifty.com (conssluserg-04.nifty.com [210.131.2.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D8E26DCF7; Mon, 21 Nov 2022 01:07:20 -0800 (PST) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 2AL96qJA015443; Mon, 21 Nov 2022 18:06:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 2AL96qJA015443 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1669021613; bh=7X6L8AAqOEY0/aQSZIAWdIdlY5cPDBedn82Z4qDbDj8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bnQuxmb5RXwPbs0ZUhMNOeDUNzwY/Zhp3ZOHah5mrJYICSCcNUgGwoPPHUg+BegtS J5pOR0SpnPPe0CMz2/5zaUv0EMjloyHCipCzvBpgWgP5oZYfVjposgLigRwcWb8oGH xeOb1/sGcD/hs/x7q+hmiHfCDuj6GRApfYKFGMmLqqY9DyJ5GZx0cs3+8G+kxyV1yR 9mHIoaQAXnbD7ta3fVmQMGlWgic0DZ0vihX9O5QatbZekvvHcuOddmheF5BFtJR77J RwVI/6juTSl6HHmeT2AMWdHS0zmsqqca7hX2ruiTisv54Z2WAkOry2L6gcFQEBPaOT Fbfvz7BhBRCmQ== X-Nifty-SrcIP: [209.85.167.171] Received: by mail-oi1-f171.google.com with SMTP id v81so11911434oie.5; Mon, 21 Nov 2022 01:06:53 -0800 (PST) X-Gm-Message-State: ANoB5pnsxr4EPOygI75y6gbxGkHkInPVXXh5B+WiciRX9Nqx8H3/d9UL Z7NVhLEHi+1MyNx1FRY1mE5e3TfqYcLe+Fw6mvc= X-Received: by 2002:a05:6808:3009:b0:354:94a6:a721 with SMTP id ay9-20020a056808300900b0035494a6a721mr11148779oib.194.1669021611960; Mon, 21 Nov 2022 01:06:51 -0800 (PST) MIME-Version: 1.0 References: <20221119225650.1044591-1-alobakin@pm.me> <20221119225650.1044591-12-alobakin@pm.me> <961a7d7e-c917-86a8-097b-5961428e9ddc@redhat.com> <87852fc9-0757-7e58-35a2-90cccf970f5c@redhat.com> In-Reply-To: <87852fc9-0757-7e58-35a2-90cccf970f5c@redhat.com> From: Masahiro Yamada Date: Mon, 21 Nov 2022 18:06:15 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 11/18] platform/x86: int3472: fix object shared between several modules To: Hans de Goede Cc: Andy Shevchenko , Alexander Lobakin , linux-kbuild@vger.kernel.org, Nicolas Schier , Jens Axboe , Boris Brezillon , Borislav Petkov , Tony Luck , Miquel Raynal , Vladimir Oltean , Alexandre Belloni , Derek Chickles , Ioana Ciornei , Salil Mehta , Sunil Goutham , Grygorii Strashko , Daniel Scally , Mark Brown , NXP Linux Team , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 21, 2022 at 5:12 PM Hans de Goede wrote: > > Hi, > > On 11/21/22 00:45, Masahiro Yamada wrote: > > On Mon, Nov 21, 2022 at 5:55 AM Hans de Goede wrote: > >> > >> Hi, > >> > >> On 11/20/22 14:55, Andy Shevchenko wrote: > >>> On Sat, Nov 19, 2022 at 11:08:17PM +0000, Alexander Lobakin wrote: > >>>> common.o is linked to both intel_skl_int3472_{discrete,tps68470}: > >>>> > >>>>> scripts/Makefile.build:252: ./drivers/platform/x86/intel/int3472/Makefile: > >>>>> common.o is added to multiple modules: intel_skl_int3472_discrete > >>>>> intel_skl_int3472_tps68470 > >>>> > >>>> Although both drivers share one Kconfig option > >>>> (CONFIG_INTEL_SKL_INT3472), it's better to not link one object file > >>>> into several modules (and/or vmlinux). > >>>> Under certain circumstances, such can lead to the situation fixed by > >>>> commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects"). > >>>> > >>>> Introduce the new module, intel_skl_int3472_common, to provide the > >>>> functions from common.o to both discrete and tps68470 drivers. This > >>>> adds only 3 exports and doesn't provide any changes to the actual > >>>> code. > >> > >> Replying to Andy's reply here since I never saw the original submission > >> which was not Cc-ed to platform-driver-x86@vger.kernel.org . > >> > >> As you mention already in the commit msg, the issue from: > >> > >> commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects") > >> > >> is not an issue here since both modules sharing the .o file are > >> behind the same Kconfig option. > >> > >> So there is not really an issue here and common.o is tiny, so > >> small chances are it does not ever increase the .ko size > >> when looking a the .ko size rounded up to a multiple of > >> the filesystem size. > >> > >> At the same time adding an extra module does come with significant > >> costs, it will eat up at least 1 possibly more then 1 fs blocks > >> (I don't know what the module header size overhead is). > >> > >> And it needs to be loaded separately and module loading is slow; > >> and it will grow the /lib/modules//modules.* sizes. > >> > >> So nack from me for this patch, since I really don't see > >> it adding any value. > > > > > > > > > > This does have a value. > > > > This clarifies the ownership of the common.o, > > in other words, makes KBUILD_MODNAME deterministic. > > > > > > If an object belongs to a module, > > KBUILD_MODNAME is defined as the module name. > > > > If an object is always built-in, > > KBUILD_MODNAME is defined as the basename of the object. > > > > > > > > Here is a question: > > if common.o is shared by two modules intel_skl_int3472_discrete > > and intel_skl_int3472_tps68470, what should KBUILD_MODNAME be? > > > > > > I see some patch submissions relying on the assumption that > > KBUILD_MODNAME is unique. > > We cannot determine KBUILD_MODNAME correctly if an object is shared > > by multiple modules. > > > > > > > > > > > > > > BTW, this patch is not the way I suggested. > > The Suggested-by should not have been there > > (or at least Reported-by) > > > > > > You argued "common.o is tiny", so I would vote for > > making them inline functions, like > > > > > > https://lore.kernel.org/linux-kbuild/20221119225650.1044591-2-alobakin@pm.me/T/#u > > Yes just moving the contents of common.c to static inline helpers in common.h > would be much better. > > If someone creates such a patch, please do not forget to Cc > platform-driver-x86@vger.kernel.org I think this patch series should be split and sent to each sub-system instead of kbuild. > Regards, > > Hans > > > > > > > > > > > > > > > > > > > > >> Regards, > >> > >> Hans > >> > >> > >> > >> > >> > >>> > >>> ... > >>> > >>>> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); > >>>> + > >>> > >>> Redundant blank line. You may put it to be last MODULE_*() in the file, if you > >>> think it would be more visible. > >>> > >>>> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI Discrete Device Driver"); > >>>> MODULE_AUTHOR("Daniel Scally "); > >>>> MODULE_LICENSE("GPL v2"); > >>> > >>> ... > >>> > >>>> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); > >>>> + > >>>> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); > >>>> MODULE_AUTHOR("Daniel Scally "); > >>>> MODULE_LICENSE("GPL v2"); > >>> > >>> Ditto. And the same to all your patches. > >>> > >> > > > > > -- Best Regards Masahiro Yamada