Message ID | 20230126163530.3495413-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp366809wrn; Thu, 26 Jan 2023 08:36:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXtKITVohlhy6jz6W0oqGNPIqeSj1lPcRxYrvDS80wO6kVUV8HnCw7TQWUMw+RPWm8RDjw4h X-Received: by 2002:a17:906:7e0c:b0:877:60b3:3fce with SMTP id e12-20020a1709067e0c00b0087760b33fcemr31647422ejr.45.1674751013130; Thu, 26 Jan 2023 08:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674751013; cv=none; d=google.com; s=arc-20160816; b=QG7VUBCLfY/BHpCPKBapdTJmW4C6vegVdT50BFfROnlt0AFPvLuqNoPWWOROXVHZLe dz2LKs5eMGidsHWBhMT/dkJqGjWYx7tBaFs/rpfwrVjVeeiWSzsdB7KMA/qV1dw2yRU7 jlUEdXecCNSYkYxawijqDYvRHkWNoaMFwnsp67gLBBykW6+d4kaphGyutAhmdhWtY3St 5Fqk+m9fPjoznk83LmDDp7ljButQI0nRJbVhCVhPvbDerFYrldAPSTogS4ohKhj7BrO5 eGgEnHeP3tXKZusoLW0qdc5MgViiJbqwFVk9TI0QCS8SAdY19VmC+oQNJ3w7GZHRdFmr oLLA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=u/1lTjQTxUkn8Xg8nRMJ1b666i8ZsB0Ngpwp/NjSO+U=; b=Y4RvM/zzUCBy2X9ijx3sR1mr/5h7YYSejeQlIS/UcrX3CL8isJ2eEGBFCCQFZPQhiU UgpJQd6PLH3uBBGaAO96rC2y1hu246eTc99BezTKtQteDHgF/ZYnC8LNeXSler1K+761 E79czJI03BgGpIA1s5Qu1z9oTpLHMc+iSsNytwp/3XlCtjhwNGfiAEcI7HaUoL+5Wemx 8VMDRu8GM/3e7BkG6QbDZzu7C0SQI0190X6Jxz8PBSRz6/JWZ+dua2fAu8L1fRbpV2gG n9iB6vXZDFqujgosfDhLKFTVAsqPvNX7OBPJhES64W3F0xcHl58xY6g7f4tX4m2CuIct wNgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D7DN2wVW; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a17090668ce00b007ae127c6c80si1945266ejr.672.2023.01.26.08.36.29; Thu, 26 Jan 2023 08:36:53 -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=@kernel.org header.s=k20201202 header.b=D7DN2wVW; 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 S230377AbjAZQfi (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Thu, 26 Jan 2023 11:35:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjAZQfg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 26 Jan 2023 11:35:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C572016AE3 for <linux-kernel@vger.kernel.org>; Thu, 26 Jan 2023 08:35:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69CD4618DF for <linux-kernel@vger.kernel.org>; Thu, 26 Jan 2023 16:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 646C4C4339B; Thu, 26 Jan 2023 16:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674750934; bh=VEyIuxq4/HnzUlfKxp7Cc3nHkN3P8XRucXSnM9flciE=; h=From:To:Cc:Subject:Date:From; b=D7DN2wVWJXBcp6XKikYWoetVepShwy6VodFAAikSII9PrlOr0IK+KvEjtxf4d8iF8 HSfspmfHaFD/jxPdfTLx7KDDUSnLHFYV1Syp+RsCBJl2D++4OxyNYC4dLpEQYDR56v vOJsj7o703g1wJXlwHYDgXmN58PoC+tQKlTPvay7aTTwmRiDQmSTlNu5aijugNz3Cb 3L4+APgrrqLqlM8ZQmlbirlmNe9bzW3I7i6g1JEbl7BcD44Ej4CX+6ZXJ5+bmlRyq8 hs6xLNGwRUhc4Qe4/5MiQIJoRWCHu6ZgFvZY/t7vF90Z1PfRp4lmAe8IkvWaK7SFWZ AwVYX2Q4g5gZw== From: Arnd Bergmann <arnd@kernel.org> To: Mathieu Poirier <mathieu.poirier@linaro.org>, Suzuki K Poulose <suzuki.poulose@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Tao Zhang <quic_taozha@quicinc.com>, Mao Jinlong <quic_jinlmao@quicinc.com> Cc: Arnd Bergmann <arnd@arndb.de>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] Coresight: tpda/tpdm: remove incorrect __exit annotation Date: Thu, 26 Jan 2023 17:35:14 +0100 Message-Id: <20230126163530.3495413-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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?1756103718410417656?= X-GMAIL-MSGID: =?utf-8?q?1756103718410417656?= |
Series |
Coresight: tpda/tpdm: remove incorrect __exit annotation
|
|
Commit Message
Arnd Bergmann
Jan. 26, 2023, 4:35 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> 'remove' callbacks get called whenever a device is unbound from the driver, which can get triggered from user space. Putting it into the __exit section means that the function gets dropped in for built-in drivers, as pointed out by this build warning: `tpda_remove' referenced in section `.data' of drivers/hwtracing/coresight/coresight-tpda.o: defined in discarded section `.exit.text' of drivers/hwtracing/coresight/coresight-tpda.o `tpdm_remove' referenced in section `.data' of drivers/hwtracing/coresight/coresight-tpdm.o: defined in discarded section `.exit.text' of drivers/hwtracing/coresight/coresight-tpdm.o Fixes: 5b7916625c01 ("Coresight: Add TPDA link driver") Fixes: b3c71626a933 ("Coresight: Add coresight TPDM source driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/hwtracing/coresight/coresight-tpda.c | 2 +- drivers/hwtracing/coresight/coresight-tpdm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Comments
Hi Arnd, On 26/01/2023 16:35, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > 'remove' callbacks get called whenever a device is unbound from > the driver, which can get triggered from user space. > > Putting it into the __exit section means that the function gets > dropped in for built-in drivers, as pointed out by this build > warning: > > `tpda_remove' referenced in section `.data' of drivers/hwtracing/coresight/coresight-tpda.o: defined in discarded section `.exit.text' of drivers/hwtracing/coresight/coresight-tpda.o > `tpdm_remove' referenced in section `.data' of drivers/hwtracing/coresight/coresight-tpdm.o: defined in discarded section `.exit.text' of drivers/hwtracing/coresight/coresight-tpdm.o > Thanks for the fix, I will queue this. Btw, I did try to reproduce it locally, but couldn't trigger the warnings, even with CONFIG_WERROR=y and all CORESIGHT configs builtin. I see other drivers doing the same outside coresight too. Just curious to know why is this any different. Is it specific to "bus" driver (e.g. AMBA) ? Suzuki > Fixes: 5b7916625c01 ("Coresight: Add TPDA link driver") > Fixes: b3c71626a933 ("Coresight: Add coresight TPDM source driver") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/hwtracing/coresight/coresight-tpda.c | 2 +- > drivers/hwtracing/coresight/coresight-tpdm.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c > index 19c25c9f6157..382d648529e7 100644 > --- a/drivers/hwtracing/coresight/coresight-tpda.c > +++ b/drivers/hwtracing/coresight/coresight-tpda.c > @@ -174,7 +174,7 @@ static int tpda_probe(struct amba_device *adev, const struct amba_id *id) > return 0; > } > > -static void __exit tpda_remove(struct amba_device *adev) > +static void tpda_remove(struct amba_device *adev) > { > struct tpda_drvdata *drvdata = dev_get_drvdata(&adev->dev); > > diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c > index 349a82bb3270..9479a5e8c672 100644 > --- a/drivers/hwtracing/coresight/coresight-tpdm.c > +++ b/drivers/hwtracing/coresight/coresight-tpdm.c > @@ -223,7 +223,7 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id) > return 0; > } > > -static void __exit tpdm_remove(struct amba_device *adev) > +static void tpdm_remove(struct amba_device *adev) > { > struct tpdm_drvdata *drvdata = dev_get_drvdata(&adev->dev); >
On Thu, Jan 26, 2023, at 19:02, Suzuki K Poulose wrote: > On 26/01/2023 16:35, Arnd Bergmann wrote: >> From: Arnd Bergmann <arnd@arndb.de> > Thanks for the fix, I will queue this. Btw, I did try to > reproduce it locally, but couldn't trigger the warnings, > even with > > CONFIG_WERROR=y > > and all CORESIGHT configs builtin. I see other drivers doing the > same outside coresight too. Just curious to know why is this > any different. Is it specific to "bus" driver (e.g. AMBA) ? The warning comes from postprocessing the object file, it's got nothing to do with the bus type, only with a symbol in .data referencing a symbol in .init.text. Maybe there are some config options that keep the section from getting discarded? Or possibly you only built the files in this directory, but did not get to the final link? Arnd
On 26/01/2023 20:37, Arnd Bergmann wrote: > On Thu, Jan 26, 2023, at 19:02, Suzuki K Poulose wrote: >> On 26/01/2023 16:35, Arnd Bergmann wrote: >>> From: Arnd Bergmann <arnd@arndb.de> >> Thanks for the fix, I will queue this. Btw, I did try to >> reproduce it locally, but couldn't trigger the warnings, >> even with >> >> CONFIG_WERROR=y >> >> and all CORESIGHT configs builtin. I see other drivers doing the >> same outside coresight too. Just curious to know why is this >> any different. Is it specific to "bus" driver (e.g. AMBA) ? > > The warning comes from postprocessing the object file, it's got > nothing to do with the bus type, only with a symbol in .data > referencing a symbol in .init.text. Maybe there are some > config options that keep the section from getting discarded? > Or possibly you only built the files in this directory, but did > not get to the final link? I did a full kernel build. Also, I see a similar issue with the coresight-etm4x (by code inspection) driver. Did you not hit that ? May be there is a config option that is masking it on my end. But the case of etm4x driver is puzzling. $ git grep etm4_remove_amba drivers/hwtracing/coresight/coresight-etm4x-core.c drivers/hwtracing/coresight/coresight-etm4x-core.c:static void __exit etm4_remove_amba(struct amba_device *adev) drivers/hwtracing/coresight/coresight-etm4x-core.c: .remove = etm4_remove_amba, Suzuki > > Arnd
On Fri, Jan 27, 2023, at 17:46, Suzuki K Poulose wrote: > On 26/01/2023 20:37, Arnd Bergmann wrote: >> On Thu, Jan 26, 2023, at 19:02, Suzuki K Poulose wrote: >>> On 26/01/2023 16:35, Arnd Bergmann wrote: >>>> From: Arnd Bergmann <arnd@arndb.de> >>> Thanks for the fix, I will queue this. Btw, I did try to >>> reproduce it locally, but couldn't trigger the warnings, >>> even with >>> >>> CONFIG_WERROR=y >>> >>> and all CORESIGHT configs builtin. I see other drivers doing the >>> same outside coresight too. Just curious to know why is this >>> any different. Is it specific to "bus" driver (e.g. AMBA) ? >> >> The warning comes from postprocessing the object file, it's got >> nothing to do with the bus type, only with a symbol in .data >> referencing a symbol in .init.text. Maybe there are some >> config options that keep the section from getting discarded? >> Or possibly you only built the files in this directory, but did >> not get to the final link? > > I did a full kernel build. Also, I see a similar issue with the > coresight-etm4x (by code inspection) driver. Did you not hit that ? > > May be there is a config option that is masking it on my end. But > the case of etm4x driver is puzzling. > > $ git grep etm4_remove_amba > drivers/hwtracing/coresight/coresight-etm4x-core.c > drivers/hwtracing/coresight/coresight-etm4x-core.c:static void __exit > etm4_remove_amba(struct amba_device *adev) > drivers/hwtracing/coresight/coresight-etm4x-core.c: .remove > = etm4_remove_amba, Indeed, that one clearly has the same but, but I have never observed a warning for it. I checked one more thing and found that I only get the warning for 32-bit Arm builds, but not arm64. Since the etm4x driver 'depends on ARM64' for its use of asm/sysreg.h, I never test-built it on 32-bit arm. From the git history of arch/arm64/kernel/vmlinux.lds.S, I can see that arm64 never discards the .exit section, see commit 07c802bd7c39 ("arm64: vmlinux.lds.S: don't discard .exit.* sections at link-time"). Arnd
On 27/01/2023 17:00, Arnd Bergmann wrote: > On Fri, Jan 27, 2023, at 17:46, Suzuki K Poulose wrote: >> On 26/01/2023 20:37, Arnd Bergmann wrote: >>> On Thu, Jan 26, 2023, at 19:02, Suzuki K Poulose wrote: >>>> On 26/01/2023 16:35, Arnd Bergmann wrote: >>>>> From: Arnd Bergmann <arnd@arndb.de> >>>> Thanks for the fix, I will queue this. Btw, I did try to >>>> reproduce it locally, but couldn't trigger the warnings, >>>> even with >>>> >>>> CONFIG_WERROR=y >>>> >>>> and all CORESIGHT configs builtin. I see other drivers doing the >>>> same outside coresight too. Just curious to know why is this >>>> any different. Is it specific to "bus" driver (e.g. AMBA) ? >>> >>> The warning comes from postprocessing the object file, it's got >>> nothing to do with the bus type, only with a symbol in .data >>> referencing a symbol in .init.text. Maybe there are some >>> config options that keep the section from getting discarded? >>> Or possibly you only built the files in this directory, but did >>> not get to the final link? >> >> I did a full kernel build. Also, I see a similar issue with the >> coresight-etm4x (by code inspection) driver. Did you not hit that ? >> >> May be there is a config option that is masking it on my end. But >> the case of etm4x driver is puzzling. >> >> $ git grep etm4_remove_amba >> drivers/hwtracing/coresight/coresight-etm4x-core.c >> drivers/hwtracing/coresight/coresight-etm4x-core.c:static void __exit >> etm4_remove_amba(struct amba_device *adev) >> drivers/hwtracing/coresight/coresight-etm4x-core.c: .remove >> = etm4_remove_amba, > > Indeed, that one clearly has the same but, but I have never > observed a warning for it. > > I checked one more thing and found that I only get the warning > for 32-bit Arm builds, but not arm64. Since the etm4x driver > 'depends on ARM64' for its use of asm/sysreg.h, > I never test-built it on 32-bit arm. > > From the git history of arch/arm64/kernel/vmlinux.lds.S, > I can see that arm64 never discards the .exit section, see > commit 07c802bd7c39 ("arm64: vmlinux.lds.S: don't discard > .exit.* sections at link-time"). That makes sense, thanks for getting to the bottom of this. I have pushed it to coresight next. https://git.kernel.org/coresight/c/0c1ccc158bbc Kind regards Suzuki > > Arnd
diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c index 19c25c9f6157..382d648529e7 100644 --- a/drivers/hwtracing/coresight/coresight-tpda.c +++ b/drivers/hwtracing/coresight/coresight-tpda.c @@ -174,7 +174,7 @@ static int tpda_probe(struct amba_device *adev, const struct amba_id *id) return 0; } -static void __exit tpda_remove(struct amba_device *adev) +static void tpda_remove(struct amba_device *adev) { struct tpda_drvdata *drvdata = dev_get_drvdata(&adev->dev); diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 349a82bb3270..9479a5e8c672 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -223,7 +223,7 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id) return 0; } -static void __exit tpdm_remove(struct amba_device *adev) +static void tpdm_remove(struct amba_device *adev) { struct tpdm_drvdata *drvdata = dev_get_drvdata(&adev->dev);