* [PATCH] Revert "dynamic_debug: Remove unnecessary __used"
@ 2020-05-11 18:26 Elliot Berman
2020-05-11 18:54 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Elliot Berman @ 2020-05-11 18:26 UTC (permalink / raw)
To: Jason Baron, Joe Perches
Cc: Elliot Berman, Trilok Soni, linux-arm-kernel, linux-kernel
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.
Change-Id: I28e9b86088eee5d5ed2384fbcea2ac2e7337a559
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
---
include/linux/dynamic_debug.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index abcd5fd..7518db4f 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -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__, \
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Revert "dynamic_debug: Remove unnecessary __used"
2020-05-11 18:26 [PATCH] Revert "dynamic_debug: Remove unnecessary __used" Elliot Berman
@ 2020-05-11 18:54 ` Joe Perches
2020-05-11 19:31 ` Elliot Berman
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2020-05-11 18:54 UTC (permalink / raw)
To: Elliot Berman, Jason Baron; +Cc: Trilok Soni, linux-arm-kernel, linux-kernel
On Mon, 2020-05-11 at 11:26 -0700, Elliot Berman wrote:
> 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.
>
> Change-Id: I28e9b86088eee5d5ed2384fbcea2ac2e7337a559
> Signed-off-by: Elliot Berman <eberman@codeaurora.org>
> ---
Change-Id: probably isn't necessary.
Is there a separate mechanism possible to avoid bloating the
otherwise unused content?
> include/linux/dynamic_debug.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> index abcd5fd..7518db4f 100644
> --- a/include/linux/dynamic_debug.h
> +++ b/include/linux/dynamic_debug.h
> @@ -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__, \
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Revert "dynamic_debug: Remove unnecessary __used"
2020-05-11 18:54 ` Joe Perches
@ 2020-05-11 19:31 ` Elliot Berman
2020-05-11 19:56 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Elliot Berman @ 2020-05-11 19:31 UTC (permalink / raw)
To: Joe Perches, Jason Baron
Cc: Trilok Soni, linux-arm-kernel, linux-kernel, Murali Nalajala
On 5/11/2020 11:54 AM, Joe Perches wrote> Change-Id: probably isn't necessary.
Thanks for the catch
>
> 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.
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Revert "dynamic_debug: Remove unnecessary __used"
2020-05-11 19:31 ` Elliot Berman
@ 2020-05-11 19:56 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-05-11 19:56 UTC (permalink / raw)
To: Elliot Berman, Jason Baron
Cc: Trilok Soni, linux-arm-kernel, linux-kernel, Murali Nalajala
On Mon, 2020-05-11 at 12:31 -0700, Elliot Berman wrote:
> On 5/11/2020 11:54 AM, Joe Perches wrote> Change-Id: probably isn't necessary.
>
> Thanks for the catch
>
> > 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.
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-11 19:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 18:26 [PATCH] Revert "dynamic_debug: Remove unnecessary __used" Elliot Berman
2020-05-11 18:54 ` Joe Perches
2020-05-11 19:31 ` Elliot Berman
2020-05-11 19:56 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).