Message ID | 20221119225650.1044591-12-alobakin@pm.me |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp898762wrr; Sat, 19 Nov 2022 15:11:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CPyb9wdewm5yOwJ2ackeO8xcCQCtOie4aM+vi5vOpQrkAqZoq457q7JC+4I6rXAYe3aUq X-Received: by 2002:a63:595d:0:b0:476:f2b0:b318 with SMTP id j29-20020a63595d000000b00476f2b0b318mr12318774pgm.598.1668899462333; Sat, 19 Nov 2022 15:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668899462; cv=none; d=google.com; s=arc-20160816; b=Qv2sRBIbMPbOXiV6JZGcTmIF/0QvhaGMEPalVpOKnQHXMh6PeVsvQlNSRnaGBSegzI s5fWZGF4ioNXkUJyYjRbRk336I5s9+HU4yMu8dIlXZAL52eTEUI7RSdJOykoCgii7E1A 2TQW0FtrdgqrEDI/swLKHdGbxZyyN+y/etSlDXjaU/LgHkk/kOeb5DkzPziDlt+RmPRY hgMRhq8Mey/E6x4uEK1JWkJE2SoR+WiRODz5WxSyEHFCXLiYDCQJpYnfC4WsU/wIyzwe G74q4qT4c3Q3ya8Typodxd7CoF6J6jDsIpk/YmNCygcjmu3yT0s2L03nw4J7i+mkP1gn iFAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=zn0V2DT6W2z01KImfq/5Gwy2BxeJtWHzr6gc3StE15M=; b=E5b/TJfbMryV4IVN0euGhfvB90CtipwJTBueUbBUSQEV/YUSUCTQMpMKXgwdmVGqKF 7AzTpr4lsy4PUSYLlQAgbYjkIfeh+f+cic5dNiq/ZO0a+TrTsAl6pHoE3lEJ2XFhFbpf m5ss99+40zvJVXu4XJsRxwCYmnP12SOWZE5i4d1Gya5/iK2Ro+jt2ASECBV92B3LvqMI E2pjBzvvZBsM5XAfeYSrlnYkdhBbtBy7u0V9rIOHcCT3SvMLpZviGF4VvvM51bySDtVe 5+glFWHLfixtzoecEcQnQPRyZxtPVNz3T4oDXxDlJ6NW2rLNYvbz7IBTuXLkjt1n2agh IVVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=jYf7O9jF; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ju17-20020a170903429100b001890f5957c4si2283746plb.353.2022.11.19.15.10.49; Sat, 19 Nov 2022 15:11: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=@pm.me header.s=protonmail3 header.b=jYf7O9jF; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234334AbiKSXIj (ORCPT <rfc822;zhanghuayu.dev@gmail.com> + 99 others); Sat, 19 Nov 2022 18:08:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234794AbiKSXId (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 19 Nov 2022 18:08:33 -0500 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BE982ADB for <linux-kernel@vger.kernel.org>; Sat, 19 Nov 2022 15:08:31 -0800 (PST) Date: Sat, 19 Nov 2022 23:08:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1668899309; x=1669158509; bh=zn0V2DT6W2z01KImfq/5Gwy2BxeJtWHzr6gc3StE15M=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=jYf7O9jFrMZeXW86EsQISked7sIdxcuiotjHFn14vuvXN15oH9ckmhTKoHHHrGKQS WvAioU9V+6jK57z4Mq64rCtQ+K9Wdh825pM/BqnKeUL0ICnc/hkml1iTi4Ux8d3Odr zNmoiTTy8aQX2/6G6LXG71gUrts2nho+vGldh9kYWzDltOUnPeM4FR4YCjT0VqzdK6 0C68EUsI+/R45aOf+9HngV+zK7iGVzA+0C2Ya/ybkXF0neyLY1Ma+2lTbEPUJXEYBM efAguDDev0xXZs+X+cuV2DBj1TjV7AWM805c3JOyqvWvA9U7zH9rupP/pjtFj5XhKL lWeStGsiIStAw== To: linux-kbuild@vger.kernel.org From: Alexander Lobakin <alobakin@pm.me> Cc: Alexander Lobakin <alobakin@pm.me>, Masahiro Yamada <masahiroy@kernel.org>, Nicolas Schier <nicolas@fjasle.eu>, Jens Axboe <axboe@kernel.dk>, Boris Brezillon <bbrezillon@kernel.org>, Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>, Miquel Raynal <miquel.raynal@bootlin.com>, Vladimir Oltean <vladimir.oltean@nxp.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Derek Chickles <dchickles@marvell.com>, Ioana Ciornei <ioana.ciornei@nxp.com>, Salil Mehta <salil.mehta@huawei.com>, Sunil Goutham <sgoutham@marvell.com>, Grygorii Strashko <grygorii.strashko@ti.com>, Daniel Scally <djrscally@gmail.com>, Hans de Goede <hdegoede@redhat.com>, Mark Brown <broonie@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, NXP Linux Team <linux-imx@nxp.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/18] platform/x86: int3472: fix object shared between several modules Message-ID: <20221119225650.1044591-12-alobakin@pm.me> In-Reply-To: <20221119225650.1044591-1-alobakin@pm.me> References: <20221119225650.1044591-1-alobakin@pm.me> Feedback-ID: 22809121:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749967922528962265?= X-GMAIL-MSGID: =?utf-8?q?1749967922528962265?= |
Series |
treewide: fix object files shared between several modules
|
|
Commit Message
Alexander Lobakin
Nov. 19, 2022, 11:08 p.m. UTC
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. Fixes: a2f9fbc247ee ("platform/x86: int3472: Split into 2 drivers") Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Alexander Lobakin <alobakin@pm.me> --- drivers/platform/x86/intel/int3472/Makefile | 8 +++++--- drivers/platform/x86/intel/int3472/common.c | 8 ++++++++ drivers/platform/x86/intel/int3472/discrete.c | 2 ++ drivers/platform/x86/intel/int3472/tps68470.c | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) -- 2.38.1
Comments
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. ... > +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 <djrscally@gmail.com>"); > MODULE_LICENSE("GPL v2"); ... > +MODULE_IMPORT_NS(INTEL_SKL_INT3472); > + > MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); > MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); > MODULE_LICENSE("GPL v2"); Ditto. And the same to all your patches.
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/<kver>/modules.* sizes. So nack from me for this patch, since I really don't see it adding any value. 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 <djrscally@gmail.com>"); >> MODULE_LICENSE("GPL v2"); > > ... > >> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); >> + >> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); >> MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); >> MODULE_LICENSE("GPL v2"); > > Ditto. And the same to all your patches. >
On Mon, Nov 21, 2022 at 5:55 AM Hans de Goede <hdegoede@redhat.com> 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/<kver>/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 > 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 <djrscally@gmail.com>"); > >> MODULE_LICENSE("GPL v2"); > > > > ... > > > >> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); > >> + > >> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); > >> MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); > >> MODULE_LICENSE("GPL v2"); > > > > Ditto. And the same to all your patches. > > >
Hi, On 11/21/22 00:45, Masahiro Yamada wrote: > On Mon, Nov 21, 2022 at 5:55 AM Hans de Goede <hdegoede@redhat.com> 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/<kver>/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 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 <djrscally@gmail.com>"); >>>> MODULE_LICENSE("GPL v2"); >>> >>> ... >>> >>>> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); >>>> + >>>> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); >>>> MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); >>>> MODULE_LICENSE("GPL v2"); >>> >>> Ditto. And the same to all your patches. >>> >> > >
On Mon, Nov 21, 2022 at 5:12 PM Hans de Goede <hdegoede@redhat.com> wrote: > > Hi, > > On 11/21/22 00:45, Masahiro Yamada wrote: > > On Mon, Nov 21, 2022 at 5:55 AM Hans de Goede <hdegoede@redhat.com> 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/<kver>/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 <djrscally@gmail.com>"); > >>>> MODULE_LICENSE("GPL v2"); > >>> > >>> ... > >>> > >>>> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); > >>>> + > >>>> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); > >>>> MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); > >>>> MODULE_LICENSE("GPL v2"); > >>> > >>> Ditto. And the same to all your patches. > >>> > >> > > > > >
Hi, On 11/21/22 10:06, Masahiro Yamada wrote: > On Mon, Nov 21, 2022 at 5:12 PM Hans de Goede <hdegoede@redhat.com> wrote: >> >> Hi, >> >> On 11/21/22 00:45, Masahiro Yamada wrote: >>> On Mon, Nov 21, 2022 at 5:55 AM Hans de Goede <hdegoede@redhat.com> 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/<kver>/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. Yes definitely, the changes are big enough that not merging this through the subsystem trees is going to cause conflicts. 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 <djrscally@gmail.com>"); >>>>>> MODULE_LICENSE("GPL v2"); >>>>> >>>>> ... >>>>> >>>>>> +MODULE_IMPORT_NS(INTEL_SKL_INT3472); >>>>>> + >>>>>> MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); >>>>>> MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); >>>>>> MODULE_LICENSE("GPL v2"); >>>>> >>>>> Ditto. And the same to all your patches. >>>>> >>>> >>> >>> >> > >
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Date: Sun, 20 Nov 2022 15:55:21 +0200 > 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. > > ... > > > +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. My intention was that it's not "standard" module info like license or description, rather something like exports or initcalls, that's why I did separate them. But I haven't been using module namespaces a lot previously, so if it should be in one block with the rest MODULE_*(), sure, I'll fix. > > > MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI Discrete Device Driver"); > > MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); > > MODULE_LICENSE("GPL v2"); > > ... > > > +MODULE_IMPORT_NS(INTEL_SKL_INT3472); > > + > > MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); > > MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); > > MODULE_LICENSE("GPL v2"); > > Ditto. And the same to all your patches. > > -- > With Best Regards, > Andy Shevchenko Thanks, Olek
From: Hans de Goede <hdegoede@redhat.com> Date: Mon, 21 Nov 2022 09:12:41 +0100 > Hi, > > On 11/21/22 00:45, Masahiro Yamada wrote: > > On Mon, Nov 21, 2022 at 5:55 AM Hans de Goede <hdegoede@redhat.com> wrote: [...] > >> 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. +1 > > > > > > > > > > > > > > BTW, this patch is not the way I suggested. > > The Suggested-by should not have been there > > (or at least Reported-by) (to Masahiro) Ah, you're right, sorry. Will replace all the tags to Reported-by, that would look more correct. > > > > > > 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. Sure, why not. There probably are more of shared object files which would feel better being static inlines in the series, will see. > > If someone creates such a patch, please do not forget to Cc > platform-driver-x86@vger.kernel.org Got it, sure. get_maintainer.pl dropped a wall on me, so I was picking stuff manually from it and missed that one. > > Regards, > > Hans [...] > >>> Ditto. And the same to all your patches. Thanks, Olek
From: Hans de Goede <hdegoede@redhat.com> Date: Mon, 21 Nov 2022 10:34:11 +0100 > Hi, > > On 11/21/22 10:06, Masahiro Yamada wrote: > > On Mon, Nov 21, 2022 at 5:12 PM Hans de Goede <hdegoede@redhat.com> wrote: [...] > > I think this patch series should be split > > and sent to each sub-system instead of kbuild. > > Yes definitely, the changes are big enough that not merging > this through the subsystem trees is going to cause conflicts. Makes sense! I'll collect the feedback here and then will be sending stuff to the corresponding MLs with the reference to the original commits which introduce Kbuild warnings. > > Regards, > > Hans [...] Thanks! Olek
diff --git a/drivers/platform/x86/intel/int3472/Makefile b/drivers/platform/x86/intel/int3472/Makefile index cfec7784c5c9..53cc0e7db749 100644 --- a/drivers/platform/x86/intel/int3472/Makefile +++ b/drivers/platform/x86/intel/int3472/Makefile @@ -1,4 +1,6 @@ -obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \ +obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_common.o \ + intel_skl_int3472_discrete.o \ intel_skl_int3472_tps68470.o -intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o common.o -intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o common.o +intel_skl_int3472_common-y := common.o +intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o +intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o diff --git a/drivers/platform/x86/intel/int3472/common.c b/drivers/platform/x86/intel/int3472/common.c index 9db2bb0bbba4..bd573ff46610 100644 --- a/drivers/platform/x86/intel/int3472/common.c +++ b/drivers/platform/x86/intel/int3472/common.c @@ -2,6 +2,7 @@ /* Author: Dan Scally <djrscally@gmail.com> */ #include <linux/acpi.h> +#include <linux/module.h> #include <linux/slab.h> #include "common.h" @@ -29,6 +30,7 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev, char *i return obj; } +EXPORT_SYMBOL_NS_GPL(skl_int3472_get_acpi_buffer, INTEL_SKL_INT3472); int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb) { @@ -52,6 +54,7 @@ int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb) kfree(obj); return ret; } +EXPORT_SYMBOL_NS_GPL(skl_int3472_fill_cldb, INTEL_SKL_INT3472); /* sensor_adev_ret may be NULL, name_ret must not be NULL */ int skl_int3472_get_sensor_adev_and_name(struct device *dev, @@ -80,3 +83,8 @@ int skl_int3472_get_sensor_adev_and_name(struct device *dev, return ret; } +EXPORT_SYMBOL_NS_GPL(skl_int3472_get_sensor_adev_and_name, INTEL_SKL_INT3472); + +MODULE_DESCRIPTION("Intel SkyLake INT3472 Common Module"); +MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); +MODULE_LICENSE("GPL"); diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index 974a132db651..a1f3b593cea6 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -414,6 +414,8 @@ static struct platform_driver int3472_discrete = { }; module_platform_driver(int3472_discrete); +MODULE_IMPORT_NS(INTEL_SKL_INT3472); + MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI Discrete Device Driver"); MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 5b8d1a9620a5..3c983aa7731f 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -255,6 +255,8 @@ static struct i2c_driver int3472_tps68470 = { }; module_i2c_driver(int3472_tps68470); +MODULE_IMPORT_NS(INTEL_SKL_INT3472); + MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); MODULE_LICENSE("GPL v2");