All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elliot Berman <eberman@codeaurora.org>
To: Jason Baron <jbaron@akamai.com>, Joe Perches <joe@perches.com>
Cc: Trilok Soni <tsoni@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Revert "dynamic_debug: Remove unnecessary __used"
Date: Mon, 11 May 2020 11:26:58 -0700	[thread overview]
Message-ID: <1589221618-21808-1-git-send-email-eberman@codeaurora.org> (raw)

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Elliot Berman <eberman@codeaurora.org>
To: Jason Baron <jbaron@akamai.com>, Joe Perches <joe@perches.com>
Cc: Elliot Berman <eberman@codeaurora.org>,
	Trilok Soni <tsoni@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Revert "dynamic_debug: Remove unnecessary __used"
Date: Mon, 11 May 2020 11:26:58 -0700	[thread overview]
Message-ID: <1589221618-21808-1-git-send-email-eberman@codeaurora.org> (raw)

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

             reply	other threads:[~2020-05-11 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 18:26 Elliot Berman [this message]
2020-05-11 18:26 ` [PATCH] Revert "dynamic_debug: Remove unnecessary __used" Elliot Berman
2020-05-11 18:54 ` Joe Perches
2020-05-11 18:54   ` Joe Perches
2020-05-11 19:31   ` Elliot Berman
2020-05-11 19:31     ` Elliot Berman
2020-05-11 19:56     ` Joe Perches
2020-05-11 19:56       ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589221618-21808-1-git-send-email-eberman@codeaurora.org \
    --to=eberman@codeaurora.org \
    --cc=jbaron@akamai.com \
    --cc=joe@perches.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tsoni@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.