Revert "dynamic_debug: Remove unnecessary __used"
PATCH 1/1 Revert "dynamic_debug: Remove unnecessary __used"
This reverts commit c0d2af637863940b1a4fb208224ca7acb905c39f.
Some compilers[1] may break dynamic_hex_dump by optimizing the DYNAMIC_DEBUG_BRANCH check inside __dynamic_func_call_no_desc and completely removing the dynamic debug metadata. Thus, there is no dynamic_debug control site to enable or disable. The if condition is optimized away based on the initial value of flags (i.e. if DEBUG macro is present).
[1]: This behavior is present on [aarch64-gnu-linux-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609] and [Android Common Kernel
toolchain: "Android (6051079 based on r370808) clang version 10.0.1"] using arm64 default defconfig + DYNAMIC_DEBUG enabled.
--- include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dynamic_debug.h +1 -1
@@ -79,7 +79,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, const char *fmt, ...);#define DEFINE_DYNAMIC_DEBUG_METADATA (name, fmt) \ - static struct _ddebug __aligned(8) \ + static struct _ddebug __used __aligned(8) \ __attribute__((section("__verbose"))) name = { \ .modname = KBUILD_MODNAME, \ .function = __func__, \
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 8 lines · Elliot Berman
This reverts commit
c0d2af637863940b1a4fb208224ca7acb905c39f.Some compilers[1] may break
dynamic_hex_dumpby optimizing theDYNAMIC_DEBUG_BRANCHcheck inside__dynamic_func_call_no_descand completely removing the dynamic debug metadata. Thus, there is nodynamic_debugcontrol site to enable or disable. The if condition is optimized away based on the initial value of flags (i.e. if DEBUG macro is present).
Quoted 8 lines
[1]: This behavior is present on [aarch64-gnu-linux-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609] and [Android Common Kernel
toolchain: "Android (6051079 based on r370808) clang version 10.0.1"] using arm64 default defconfig +DYNAMIC_DEBUGenabled.Change-Id I28e9b86088eee5d5ed2384fbcea2ac2e7337a559Signed-off-by Elliot Berman <[email protected]>---
Change-Id: probably isn't necessary.
Is there a separate mechanism possible to avoid bloating the otherwise unused content?
Quoted 16 lines
include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/dynamic_debug.h +1
-1@@ -79,7 +79,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, const char *fmt, ...);#define DEFINE_DYNAMIC_DEBUG_METADATA (name, fmt) \ - static struct _ddebug __aligned(8) \ + static struct _ddebug __used __aligned(8) \ __attribute__((section("__verbose"))) name = { \ .modname = KBUILD_MODNAME, \ .function = __func__, \
On 5/11/2020 11:54 AM, Joe Perches wrote> Change-Id: probably isn't necessary.
Thanks for the catch
Quoted 3 lines
Is there a separate mechanism possible to avoid bloating the otherwise unused content?
This struct is being used in lib/dynamic_debug.c but compiler doesn't know about this usage when optimizing the struct/branch away.
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 9 lines · Elliot Berman
On 5/11/2020 11:54 AM, Joe Perches wrote> Change-Id: probably isn't necessary.
Thanks for the catch
Quoted 2 lines
Is there a separate mechanism possible to avoid bloating the otherwise unused content?
This struct is being used in
lib/dynamic_debug.cbut compiler doesn't know about this usage when optimizing the struct/branch away.
I only remember that I removed __used awhile ago
because it _wasn't_ used in some paths.
Maybe that's changed, but I don't know.