On Sat, Sep 30, 2023 at 2:41 AM Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> wrote: > > Hello, > > On Fri, Sep 29, 2023 at 10:15:40AM +0200, Uwe Kleine-König wrote: > > by manual inspection I found a section mismatch in > > drivers/hwtracing/coresight/coresight-etm4x-core.c where > > etm4_platform_driver (which lives in ".data") contains a reference to > > etm4_remove_platform_dev() (which lives in ".exit.text"). > > > > However building with CONFIG_DEBUG_SECTION_MISMATCH=y + > > CONFIG_CORESIGHT_SOURCE_ETM4X=y doesn't warn about that one. > > Arnd had the right hint in irc: If I do > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 34a5386d444a..070e53be1ea2 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -1017,7 +1017,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym, > > /* symbols in data sections that may refer to meminit/exit sections */ > if (match(fromsec, PATTERNS(DATA_SECTIONS)) && > - match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) && > + match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) && > match(fromsym, PATTERNS("*driver"))) > return 0; > > I get a mismatch warning: > > WARNING: modpost: vmlinux: section mismatch in reference: etm4x_amba_driver+0x98 (section: .data) -> etm4_remove_amba (section: .exit.text) > WARNING: modpost: vmlinux: section mismatch in reference: etm4_platform_driver+0x8 (section: .data) -> etm4_remove_platform_dev (section: .exit.text) > ERROR: modpost: Section mismatches detected. > > I remember that back in the times of CONFIG_HOTPLUG references to > ".devinit.text" and ".devexit.text" were ok. Is a reference to > .exit.text ever ok? > > I started an allyesconfig build on a few archs with the above patch > applied. This will take some time, when it's done I will report what it > found. allmodconfig on x86 detects several issues. WARNING: modpost: drivers/pci/controller/dwc/pci-exynos: section mismatch in reference: exynos_pcie_driver+0x8 (section: .data) -> exynos_pcie_remove (section: .exit.text) WARNING: modpost: drivers/pci/controller/dwc/pcie-kirin: section mismatch in reference: kirin_pcie_driver+0x8 (section: .data) -> kirin_pcie_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362: section mismatch in reference: opa362_driver+0x8 (section: .data) -> opa362_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410: section mismatch in reference: tfp410_driver+0x8 (section: .data) -> tfp410_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015: section mismatch in reference: tpd_driver+0x8 (section: .data) -> tpd_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/connector-dvi: section mismatch in reference: dvi_connector_driver+0x8 (section: .data) -> dvic_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi: section mismatch in reference: hdmi_connector_driver+0x8 (section: .data) -> hdmic_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv: section mismatch in reference: tvc_connector_driver+0x8 (section: .data) -> tvc_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/omap2/omapfb/displays/panel-dpi: section mismatch in reference: panel_dpi_driver+0x8 (section: .data) -> panel_dpi_remove (section: .exit.text) WARNING: modpost: drivers/video/fbdev/atmel_lcdfb: section mismatch in reference: atmel_lcdfb_driver+0x8 (section: .data) -> atmel_lcdfb_remove (section: .exit.text) WARNING: modpost: drivers/char/hw_random/mxc-rnga: section mismatch in reference: mxc_rnga_driver+0x8 (section: .data) -> mxc_rnga_remove (section: .exit.text) WARNING: modpost: drivers/gpu/drm/bridge/ti-tpd12s015: section mismatch in reference: tpd12s015_driver+0x8 (section: .data) -> tpd12s015_remove (section: .exit.text) WARNING: modpost: drivers/rtc/rtc-at91rm9200: section mismatch in reference: at91_rtc_driver+0x8 (section: .data) -> at91_rtc_remove (section: .exit.text) WARNING: modpost: drivers/rtc/rtc-mv: section mismatch in reference: mv_rtc_driver+0x8 (section: .data) -> mv_rtc_remove (section: .exit.text) WARNING: modpost: drivers/rtc/rtc-pcap: section mismatch in reference: pcap_rtc_driver+0x8 (section: .data) -> pcap_rtc_remove (section: .exit.text) WARNING: modpost: drivers/media/i2c/et8ek8/et8ek8: section mismatch in reference: et8ek8_i2c_driver+0x10 (section: .data) -> et8ek8_remove (section: .exit.text) WARNING: modpost: drivers/watchdog/at91sam9_wdt: section mismatch in reference: at91wdt_driver+0x8 (section: .data) -> at91wdt_remove (section: .exit.text) WARNING: modpost: drivers/mmc/host/davinci_mmc: section mismatch in reference: davinci_mmcsd_driver+0x10 (section: .data) -> davinci_mmcsd_remove (section: .exit.text) WARNING: modpost: drivers/platform/x86/hp/hp-wmi: section mismatch in reference: hp_wmi_driver+0x8 (section: .data) -> hp_wmi_bios_remove (section: .exit.text) WARNING: modpost: drivers/virt/coco/sev-guest/sev-guest: section mismatch in reference: sev_guest_driver+0x8 (section: .data) -> sev_guest_remove (section: .exit.text) WARNING: modpost: drivers/memory/emif: section mismatch in reference: emif_driver+0x8 (section: .data) -> emif_remove (section: .exit.text) WARNING: modpost: drivers/mtd/nand/raw/txx9ndfmc: section mismatch in reference: txx9ndfmc_driver+0x8 (section: .data) -> txx9ndfmc_remove (section: .exit.text) WARNING: modpost: drivers/hwmon/smsc47m1: section mismatch in reference: smsc47m1_driver+0x8 (section: .data) -> smsc47m1_remove (section: .exit.text) WARNING: modpost: sound/soc/codecs/snd-soc-tlv320adc3xxx: section mismatch in reference: adc3xxx_i2c_driver+0x10 (section: .data) -> adc3xxx_i2c_remove (section: .exit.text) Linus requires zero warning, so we cannot enable the modpost warning unless we fix all the sources of the warnings. That will need one or two dev cycles. If you want to turn on the warning now, you can surround the check with 'if (extra_warn) '. Since commit 20ff36856fe00879f82de71fe6f1482ca1b72334 it is possible to enable a modpost warning only under W=1 builds. -- Best Regards Masahiro Yamada