linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
@ 2019-04-09 21:25 Rasmus Villemoes
  2019-04-09 21:25 ` [PATCH 07/10] dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Rasmus Villemoes @ 2019-04-09 21:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michael Ellerman, x86, Rasmus Villemoes, linux-kernel,
	Will Deacon, Jason Baron, Ingo Molnar, linuxppc-dev,
	linux-arm-kernel

Similar to CONFIG_GENERIC_BUG_RELATIVE_POINTERS that replaces (8 byte)
const char* members by (4 byte) signed offsets from the bug_entry,
this implements the similar thing for struct _ddebug, the descriptors
underlying pr_debug() and friends in a CONFIG_DYNAMIC_DEBUG kernel.

Since struct _ddebug has four string members, we save 16 byte per
instance. The total savings seem to be comparable to what is saved by
an architecture selecting GENERIC_BUG_RELATIVE_POINTERS (see patch 8
for some numbers for a common distro config).

While refreshing these patches, which were orignally just targeted at
x86-64, it occured to me that despite the implementation relying on
inline asm, there's nothing x86 specific about it, and indeed it seems
to work out-of-the-box for ppc64 and arm64 as well, but those have
only been compile-tested.

The first 6 patches are rather pedestrian preparations. The fun stuff
is in patch 7, and the remaining three patches are just the minimal
boilerplate to hook up the config option and asm-generic header on the
three architectures.

Rasmus Villemoes (10):
  linux/device.h: use unique identifier for each struct _ddebug
  linux/net.h: use unique identifier for each struct _ddebug
  linux/printk.h: use unique identifier for each struct _ddebug
  dynamic_debug: introduce accessors for string members of struct
    _ddebug
  dynamic_debug: drop use of bitfields in struct _ddebug
  dynamic_debug: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS
  dynamic_debug: add asm-generic implementation for
    DYNAMIC_DEBUG_RELATIVE_POINTERS
  x86-64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
  arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
  powerpc: select DYNAMIC_DEBUG_RELATIVE_POINTERS for PPC64

 arch/arm64/Kconfig                          |   1 +
 arch/arm64/include/asm/Kbuild               |   1 +
 arch/powerpc/Kconfig                        |   1 +
 arch/powerpc/include/asm/Kbuild             |   1 +
 arch/x86/Kconfig                            |   1 +
 arch/x86/entry/vdso/vdso32/vclock_gettime.c |   1 +
 arch/x86/include/asm/Kbuild                 |   1 +
 include/asm-generic/dynamic_debug.h         | 116 ++++++++++++++++++++
 include/linux/device.h                      |   4 +-
 include/linux/dynamic_debug.h               |  26 +++--
 include/linux/jump_label.h                  |   2 +
 include/linux/net.h                         |   4 +-
 include/linux/printk.h                      |   4 +-
 lib/Kconfig.debug                           |   3 +
 lib/dynamic_debug.c                         | 111 ++++++++++++++-----
 15 files changed, 237 insertions(+), 40 deletions(-)
 create mode 100644 include/asm-generic/dynamic_debug.h

-- 
2.20.1


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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 07/10] dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-04-09 21:25 [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
@ 2019-04-09 21:25 ` Rasmus Villemoes
  2019-04-09 21:25 ` [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
  2019-05-06  6:48 ` [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
  2 siblings, 0 replies; 18+ messages in thread
From: Rasmus Villemoes @ 2019-04-09 21:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michael Ellerman, x86, Rasmus Villemoes, linux-kernel,
	Will Deacon, Jason Baron, Ingo Molnar, linuxppc-dev,
	linux-arm-kernel

A 64 bit architecture can reduce the size of the kernel image by
selecting CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS, but it must provide
a proper DEFINE_DYNAMIC_DEBUG_METADATA macro for emitting the struct
_ddebug in assembly. However, since that does not involve any
instructions, this generic implementation should be usable by most if
not all.

It relies on

(1) standard assembly directives that should work on
all architectures
(2) the "i" constraint for an constant, and
(3) %cN emitting the constant operand N without punctuation

and of course the layout of _ddebug being what one expects. I've
succesfully built x86-64, arm64 and ppc64 defconfig +
CONFIG_DYNAMIC_DEBUG + patches to hook up this header, and boot-tested
the x86-64 one.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 include/asm-generic/dynamic_debug.h | 116 ++++++++++++++++++++++++++++
 include/linux/jump_label.h          |   2 +
 2 files changed, 118 insertions(+)
 create mode 100644 include/asm-generic/dynamic_debug.h

diff --git a/include/asm-generic/dynamic_debug.h b/include/asm-generic/dynamic_debug.h
new file mode 100644
index 000000000000..f1dd3019cd98
--- /dev/null
+++ b/include/asm-generic/dynamic_debug.h
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_DYNAMIC_DEBUG_H
+#define _ASM_GENERIC_DYNAMIC_DEBUG_H
+
+#ifndef _DYNAMIC_DEBUG_H
+#error "don't include asm/dynamic_debug.h directly"
+#endif
+
+#include <linux/build_bug.h>
+#ifdef CONFIG_JUMP_LABEL
+#include <linux/jump_label.h>
+#endif
+
+/*
+ * We need to know the exact layout of struct _ddebug in order to
+ * initialize it in assembly. Check that all members are at expected
+ * offsets - if any of these fail, the arch cannot use this generic
+ * dynamic_debug.h. DYNAMIC_DEBUG_RELATIVE_POINTERS is pointless for
+ * !64BIT, so we expect the static_key to be at an 8-byte boundary
+ * since it contains stuff which is long-aligned.
+ */
+
+static_assert(BITS_PER_LONG == 64);
+static_assert(offsetof(struct _ddebug, modname_disp)  == 0);
+static_assert(offsetof(struct _ddebug, function_disp) == 4);
+static_assert(offsetof(struct _ddebug, filename_disp) == 8);
+static_assert(offsetof(struct _ddebug, format_disp)   == 12);
+static_assert(offsetof(struct _ddebug, flags_lineno)  == 16);
+
+#ifdef CONFIG_JUMP_LABEL
+static_assert(offsetof(struct _ddebug, key)        == 24);
+static_assert(offsetof(struct static_key, enabled) == 0);
+static_assert(offsetof(struct static_key, type)    == 8);
+
+/* <4 bytes padding>, .enabled, <4 bytes padding>, .type */
+# ifdef DEBUG
+# define _DPRINTK_ASM_KEY_INIT \
+	"\t.int 0\n" "\t.int 1\n" "\t.int 0\n" "\t.quad "__stringify(__JUMP_TYPE_TRUE)"\n"
+# else
+# define _DPRINTK_ASM_KEY_INIT \
+	"\t.int 0\n" "\t.int 0\n" "\t.int 0\n" "\t.quad "__stringify(__JUMP_TYPE_FALSE)"\n"
+# endif
+#else /* !CONFIG_JUMP_LABEL */
+#define _DPRINTK_ASM_KEY_INIT ""
+#endif
+
+/*
+ * There's a bit of magic involved here.
+ *
+ * First, unlike the bug table entries, we need to define an object in
+ * assembly which we can reference from C code (for use by the
+ * DYNAMIC_DEBUG_BRANCH macro), but we don't want 'name' to have
+ * external linkage (that would require use of globally unique
+ * identifiers, which we can't guarantee). Fortunately, the "extern"
+ * keyword just tells the compiler that _somebody_ provides that
+ * symbol - usually that somebody is the linker, but in this case it's
+ * the assembler, and since we do not do .globl name, the symbol gets
+ * internal linkage.
+ *
+ * So far so good. The next problem is that there's no scope in
+ * assembly, so the identifier 'name' has to be unique within each
+ * translation unit - otherwise all uses of that identifier end up
+ * referring to the same struct _ddebug instance. pr_debug and friends
+ * do this by use of indirection and __UNIQUE_ID(), and new users of
+ * DEFINE_DYNAMIC_DEBUG_METADATA() should do something similar. We
+ * need to catch cases where this is not done at build time.
+ *
+ * With assembly-level .ifndef we can ensure that we only define a
+ * given identifier once, preventing "symbol 'foo' already defined"
+ * errors. But we still need to detect and fail on multiple uses of
+ * the same identifer. The simplest, and wrong, solution to that is to
+ * add an .else .error branch to the .ifndef. The problem is that just
+ * because the DEFINE_DYNAMIC_DEBUG_METADATA() macro is only expanded
+ * once with a given identifier, the compiler may emit the assembly
+ * code multiple times, e.g. if the macro appears in an inline
+ * function. Now, in a normal case like
+ *
+ *   static inline get_next_id(void) { static int v; return ++v; }
+ *
+ * all inlined copies of get_next_id are _supposed_ to refer to the
+ * same object 'v'. So we do need to allow this chunk of assembly to
+ * appear multiple times with the same 'name', as long as they all
+ * came from the same DEFINE_DYNAMIC_DEBUG_METADATA() instance. To do
+ * that, we pass __COUNTER__ to the asm(), and set an assembler symbol
+ * name.ddebug.once to that value when we first define 'name'. When we
+ * meet a second attempt at defining 'name', we compare
+ * name.ddebug.once to %6 and error out if they are different.
+ */
+
+#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt)			\
+	extern struct _ddebug name;					\
+	asm volatile(".ifndef " __stringify(name) "\n"			\
+		     ".pushsection __verbose,\"aw\"\n"			\
+		     ".type "__stringify(name)", STT_OBJECT\n"		\
+		     ".size "__stringify(name)", %c5\n"			\
+		     "1:\n"						\
+		     __stringify(name) ":\n"				\
+		     "\t.int %c0 - 1b /* _ddebug::modname_disp */\n"	\
+		     "\t.int %c1 - 1b /* _ddebug::function_disp */\n"	\
+		     "\t.int %c2 - 1b /* _ddebug::filename_disp */\n"	\
+		     "\t.int %c3 - 1b /* _ddebug::format_disp */\n"	\
+		     "\t.int %c4      /* _ddebug::flags_lineno */\n"	\
+		     _DPRINTK_ASM_KEY_INIT				\
+		     "\t.org 1b+%c5\n"					\
+		     ".popsection\n"					\
+		     ".set "__stringify(name)".ddebug.once, %c6\n"	\
+		     ".elseif "__stringify(name)".ddebug.once - %c6\n"	\
+		     ".line "__stringify(__LINE__) " - 1\n"             \
+		     ".error \"'"__stringify(name)"' used as _ddebug identifier more than once\"\n" \
+		     ".endif\n"						\
+		     : : "i" (KBUILD_MODNAME), "i" (__func__),		\
+		       "i" (__FILE__), "i" (fmt),			\
+		       "i" (_DPRINTK_FLAGS_LINENO_INIT),		\
+		       "i" (sizeof(struct _ddebug)), "i" (__COUNTER__))
+
+#endif /* _ASM_GENERIC_DYNAMIC_DEBUG_H */
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 3e113a1fa0f1..2b027d2ef3d0 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -190,6 +190,8 @@ struct module;
 
 #ifdef CONFIG_JUMP_LABEL
 
+#define __JUMP_TYPE_FALSE	0
+#define __JUMP_TYPE_TRUE	1
 #define JUMP_TYPE_FALSE		0UL
 #define JUMP_TYPE_TRUE		1UL
 #define JUMP_TYPE_LINKED	2UL
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-04-09 21:25 [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
  2019-04-09 21:25 ` [PATCH 07/10] dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
@ 2019-04-09 21:25 ` Rasmus Villemoes
  2019-04-26  9:39   ` Arnd Bergmann
  2019-05-06  6:48 ` [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
  2 siblings, 1 reply; 18+ messages in thread
From: Rasmus Villemoes @ 2019-04-09 21:25 UTC (permalink / raw)
  To: Andrew Morton, linux-arm-kernel
  Cc: Will Deacon, Jason Baron, Rasmus Villemoes, linux-kernel

Similar to GENERIC_BUG_RELATIVE_POINTERS, one can now relativize the
four const char* members of struct _ddebug, thus saving 16 bytes per
instance (one for each pr_debug(), dev_debug() etc. in a
CONFIG_DYNAMIC_DEBUG kernel). The asm-generic implementation seems to
work out-of-the-box, though this is only compile-tested.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 arch/arm64/Kconfig            | 1 +
 arch/arm64/include/asm/Kbuild | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7e34b9eba5de..d0871d523d5d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -83,6 +83,7 @@ config ARM64
 	select CRC32
 	select DCACHE_WORD_ACCESS
 	select DMA_DIRECT_REMAP
+	select DYNAMIC_DEBUG_RELATIVE_POINTERS
 	select EDAC_SUPPORT
 	select FRAME_POINTER
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 1e17ea5c372b..1ead0d645686 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -3,6 +3,7 @@ generic-y += delay.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += dma-contiguous.h
+generic-y += dynamic_debug.h
 generic-y += early_ioremap.h
 generic-y += emergency-restart.h
 generic-y += hw_irq.h
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-04-09 21:25 ` [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
@ 2019-04-26  9:39   ` Arnd Bergmann
  2019-04-26 10:05     ` Rasmus Villemoes
  0 siblings, 1 reply; 18+ messages in thread
From: Arnd Bergmann @ 2019-04-26  9:39 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Will Deacon, Linux Kernel Mailing List, clang-built-linux,
	Jason Baron, Andrew Morton, Linux ARM

On Tue, Apr 9, 2019 at 11:26 PM Rasmus Villemoes
<linux@rasmusvillemoes.dk> wrote:
>
> Similar to GENERIC_BUG_RELATIVE_POINTERS, one can now relativize the
> four const char* members of struct _ddebug, thus saving 16 bytes per
> instance (one for each pr_debug(), dev_debug() etc. in a
> CONFIG_DYNAMIC_DEBUG kernel). The asm-generic implementation seems to
> work out-of-the-box, though this is only compile-tested.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

This causes a build regression when compiling with clang,
see http://staging-storage.kernelci.org/next-clang/master/next-20190424/arm64/allmodconfig/clang-8/build.log

../init/initramfs.c:477:3: error: invalid operand in inline asm:
'.ifndef __UNIQUE_ID_ddebug18.pushsection __verbose,"aw".type
__UNIQUE_ID_ddebug18, STT_OBJECT.size __UNIQUE_ID_ddebug18,
${5:c}1:__UNIQUE_ID_ddebug18: .int ${0:c} - 1b /*
_ddebug::modname_disp */ .int ${1:c} - 1b /* _ddebug::function_disp */
.int ${2:c} - 1b /* _ddebug::filename_disp */ .int ${3:c} - 1b /*
_ddebug::format_disp */ .int ${4:c}      /* _ddebug::flags_lineno */
.org 1b+${5:c}.popsection.set __UNIQUE_ID_ddebug18.ddebug.once,
${6:c}.elseif __UNIQUE_ID_ddebug18.ddebug.once - ${6:c}.line 477 -
1.error "'__UNIQUE_ID_ddebug18' used as _ddebug identifier more than
once".endif'
                pr_debug("Detected %s compressed data\n", compress_name);
                ^
../include/linux/printk.h:336:2: note: expanded from macro 'pr_debug'
        dynamic_pr_debug(fmt, ##__VA_ARGS__)
        ^
../include/linux/dynamic_debug.h:158:2: note: expanded from macro
'dynamic_pr_debug'
        _dynamic_func_call(fmt, __dynamic_pr_debug,             \
        ^
../include/linux/dynamic_debug.h:148:2: note: expanded from macro
'_dynamic_func_call'
        __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
        ^
../include/linux/dynamic_debug.h:128:2: note: expanded from macro
'__dynamic_func_call'
        DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt);         \
        ^
../include/asm-generic/dynamic_debug.h:92:15: note: expanded from
macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
        asm volatile(".ifndef " __stringify(name) "\n"                  \
                     ^

I assume the same thing happens on the other architectures as well.

        Arnd

> ---
>  arch/arm64/Kconfig            | 1 +
>  arch/arm64/include/asm/Kbuild | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 7e34b9eba5de..d0871d523d5d 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -83,6 +83,7 @@ config ARM64
>         select CRC32
>         select DCACHE_WORD_ACCESS
>         select DMA_DIRECT_REMAP
> +       select DYNAMIC_DEBUG_RELATIVE_POINTERS
>         select EDAC_SUPPORT
>         select FRAME_POINTER
>         select GENERIC_ALLOCATOR
> diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
> index 1e17ea5c372b..1ead0d645686 100644
> --- a/arch/arm64/include/asm/Kbuild
> +++ b/arch/arm64/include/asm/Kbuild
> @@ -3,6 +3,7 @@ generic-y += delay.h
>  generic-y += div64.h
>  generic-y += dma.h
>  generic-y += dma-contiguous.h
> +generic-y += dynamic_debug.h
>  generic-y += early_ioremap.h
>  generic-y += emergency-restart.h
>  generic-y += hw_irq.h
> --
> 2.20.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-04-26  9:39   ` Arnd Bergmann
@ 2019-04-26 10:05     ` Rasmus Villemoes
  2019-04-26 13:00       ` Nathan Chancellor
  0 siblings, 1 reply; 18+ messages in thread
From: Rasmus Villemoes @ 2019-04-26 10:05 UTC (permalink / raw)
  To: Arnd Bergmann, Rasmus Villemoes
  Cc: Nick Desaulniers, Will Deacon, Linux Kernel Mailing List,
	clang-built-linux, Jason Baron, Andrew Morton, Nathan Chancellor,
	Linux ARM

On 26/04/2019 11.39, Arnd Bergmann wrote:
> On Tue, Apr 9, 2019 at 11:26 PM Rasmus Villemoes
> <linux@rasmusvillemoes.dk> wrote:
>>
>> Similar to GENERIC_BUG_RELATIVE_POINTERS, one can now relativize the
>> four const char* members of struct _ddebug, thus saving 16 bytes per
>> instance (one for each pr_debug(), dev_debug() etc. in a
>> CONFIG_DYNAMIC_DEBUG kernel). The asm-generic implementation seems to
>> work out-of-the-box, though this is only compile-tested.
>>
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> 
> This causes a build regression when compiling with clang,
> see http://staging-storage.kernelci.org/next-clang/master/next-20190424/arm64/allmodconfig/clang-8/build.log

Yes, see also https://github.com/ClangBuiltLinux/linux/issues/456 .

The quickest short-term fix is to append "if CC_IS_GCC" to the select
statements. Then when a fix lands in clang one can change that to "if
CC_IS_GCC || CLANG_VERSION >= something". It's probably best if we fix
-next builds ASAP instead of waiting for knowing the proper value of
"something". Nathan, Nick, WDYT?

I had 0day verify my patches before sending them out officially, and
thought it also did clang builds. But apparently not, or not with enough
arch/.config combinations?

Rasmus

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-04-26 10:05     ` Rasmus Villemoes
@ 2019-04-26 13:00       ` Nathan Chancellor
  2019-04-26 19:06         ` [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang Rasmus Villemoes
  0 siblings, 1 reply; 18+ messages in thread
From: Nathan Chancellor @ 2019-04-26 13:00 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Arnd Bergmann, Nick Desaulniers, Will Deacon,
	Linux Kernel Mailing List, clang-built-linux, Jason Baron,
	Andrew Morton, Linux ARM

On Fri, Apr 26, 2019 at 12:05:57PM +0200, Rasmus Villemoes wrote:
> On 26/04/2019 11.39, Arnd Bergmann wrote:
> > On Tue, Apr 9, 2019 at 11:26 PM Rasmus Villemoes
> > <linux@rasmusvillemoes.dk> wrote:
> >>
> >> Similar to GENERIC_BUG_RELATIVE_POINTERS, one can now relativize the
> >> four const char* members of struct _ddebug, thus saving 16 bytes per
> >> instance (one for each pr_debug(), dev_debug() etc. in a
> >> CONFIG_DYNAMIC_DEBUG kernel). The asm-generic implementation seems to
> >> work out-of-the-box, though this is only compile-tested.
> >>
> >> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> > 
> > This causes a build regression when compiling with clang,
> > see http://staging-storage.kernelci.org/next-clang/master/next-20190424/arm64/allmodconfig/clang-8/build.log
> 
> Yes, see also https://github.com/ClangBuiltLinux/linux/issues/456 .
> 
> The quickest short-term fix is to append "if CC_IS_GCC" to the select
> statements. Then when a fix lands in clang one can change that to "if
> CC_IS_GCC || CLANG_VERSION >= something". It's probably best if we fix
> -next builds ASAP instead of waiting for knowing the proper value of
> "something". Nathan, Nick, WDYT?

Those select statements have to be added regardless, we might as well do
it now. It should unbreak the auto builders because they use the latest
clang stable version, which is 8.0.0.

For the record, the fix in Clang is https://reviews.llvm.org/D60887 and
should land shortly unless there are any further objections, meaning
this will be fixed in the 9.0.0 release.

'if CC_IS_GCC || CLANG_VERSION >= 90000' should do it on the arm64 and
powerpc select statements (x86 works fine because %c support has always
been present).

> 
> I had 0day verify my patches before sending them out officially, and
> thought it also did clang builds. But apparently not, or not with enough
> arch/.config combinations?

They do not do clang builds unfortunately. Nick was in contact with them
before forced asm-goto on x86 happened and derailed that.

We try to do our own tests and let people know when stuff breaks but
that is usually after it hits -next, rather than the mailing list.

> 
> Rasmus

Cheers,
Nathan

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-26 13:00       ` Nathan Chancellor
@ 2019-04-26 19:06         ` Rasmus Villemoes
  2019-04-26 19:27           ` Rasmus Villemoes
  2019-04-29 17:32           ` Nick Desaulniers
  0 siblings, 2 replies; 18+ messages in thread
From: Rasmus Villemoes @ 2019-04-26 19:06 UTC (permalink / raw)
  To: linux-arm-kernel, Andrew Morton
  Cc: Arnd Bergmann, Rasmus Villemoes, Nick Desaulniers, Will Deacon,
	linux-kernel, Jason Baron, Nathan Chancellor

Current versions of clang does not like the %c modifier in inline
assembly for targets other than x86, so any DYNAMIC_DEBUG=y build
fails on arm64. A fix is likely to land in 9.0 (see
https://github.com/ClangBuiltLinux/linux/issues/456), but unbreak the
build for older versions.

Fixes: arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
Andrew, please apply and/or fold into 9/10.

 arch/arm64/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d0871d523d5d..315992e33b17 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -83,7 +83,7 @@ config ARM64
 	select CRC32
 	select DCACHE_WORD_ACCESS
 	select DMA_DIRECT_REMAP
-	select DYNAMIC_DEBUG_RELATIVE_POINTERS
+	select DYNAMIC_DEBUG_RELATIVE_POINTERS if CC_IS_GCC || CLANG_VERSION >= 90000
 	select EDAC_SUPPORT
 	select FRAME_POINTER
 	select GENERIC_ALLOCATOR
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-26 19:06         ` [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang Rasmus Villemoes
@ 2019-04-26 19:27           ` Rasmus Villemoes
  2019-04-26 21:58             ` Konstantin Ryabitsev
  2019-04-26 22:07             ` Konstantin Ryabitsev
  2019-04-29 17:32           ` Nick Desaulniers
  1 sibling, 2 replies; 18+ messages in thread
From: Rasmus Villemoes @ 2019-04-26 19:27 UTC (permalink / raw)
  To: linux-arm-kernel, Andrew Morton
  Cc: Arnd Bergmann, Will Deacon, Nick Desaulniers, linux-kernel,
	Jason Baron, Nathan Chancellor

On 26/04/2019 21.06, Rasmus Villemoes wrote:

> Andrew, please apply and/or fold into 9/10.

Hm, I'm getting bounces for Andrew's email address:

                   The mail system

<akpm@mail.linuxfoundation.org>: host 172.17.192.39[172.17.192.39] said: 550
    5.1.1 <akpm@mail.linuxfoundation.org>: Recipient address rejected: User
    unknown in local recipient table (in reply to RCPT TO command)

I think these fixups need to go through his tree as well. Any ideas
what's going on?

Rasmus

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-26 19:27           ` Rasmus Villemoes
@ 2019-04-26 21:58             ` Konstantin Ryabitsev
  2019-04-26 22:07             ` Konstantin Ryabitsev
  1 sibling, 0 replies; 18+ messages in thread
From: Konstantin Ryabitsev @ 2019-04-26 21:58 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Arnd Bergmann, Will Deacon, Nick Desaulniers, linux-kernel,
	Jason Baron, Nathan Chancellor, Andrew Morton, linux-arm-kernel

On Fri, Apr 26, 2019 at 09:27:46PM +0200, Rasmus Villemoes wrote:
>On 26/04/2019 21.06, Rasmus Villemoes wrote:
>
>> Andrew, please apply and/or fold into 9/10.
>
>Hm, I'm getting bounces for Andrew's email address:
>
>                   The mail system
>
><akpm@mail.linuxfoundation.org>: host 172.17.192.39[172.17.192.39] said: 550
>    5.1.1 <akpm@mail.linuxfoundation.org>: Recipient address rejected: User
>    unknown in local recipient table (in reply to RCPT TO command)
>
>I think these fixups need to go through his tree as well. Any ideas
>what's going on?

When did you get this bounce? Can you give me more headers, especially 
with timestamps? Andrew's mailbox was recently switched to a different 
platform, so it's possible you're getting some unintended backscatter 
from when we briefly delivered mail to both.

-K

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-26 19:27           ` Rasmus Villemoes
  2019-04-26 21:58             ` Konstantin Ryabitsev
@ 2019-04-26 22:07             ` Konstantin Ryabitsev
  1 sibling, 0 replies; 18+ messages in thread
From: Konstantin Ryabitsev @ 2019-04-26 22:07 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Arnd Bergmann, Will Deacon, Nick Desaulniers, linux-kernel,
	Jason Baron, Nathan Chancellor, Andrew Morton, linux-arm-kernel

On Fri, Apr 26, 2019 at 09:27:46PM +0200, Rasmus Villemoes wrote:
>On 26/04/2019 21.06, Rasmus Villemoes wrote:
>
>> Andrew, please apply and/or fold into 9/10.
>
>Hm, I'm getting bounces for Andrew's email address:
>
>                   The mail system
>
><akpm@mail.linuxfoundation.org>: host 172.17.192.39[172.17.192.39] said: 550
>    5.1.1 <akpm@mail.linuxfoundation.org>: Recipient address rejected: User
>    unknown in local recipient table (in reply to RCPT TO command)
>
>I think these fixups need to go through his tree as well. Any ideas
>what's going on?

OK, I see these, too. We'll fix it up, but the important bit here is 
that Andrew *is* getting all mail you send to his address. The bounces 
are from a secondary system that's supposed to have been removed from 
the forwarding destinations, but somehow is still getting copies of his 
mail.

-K

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-26 19:06         ` [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang Rasmus Villemoes
  2019-04-26 19:27           ` Rasmus Villemoes
@ 2019-04-29 17:32           ` Nick Desaulniers
  2019-04-30 18:22             ` Nick Desaulniers
  1 sibling, 1 reply; 18+ messages in thread
From: Nick Desaulniers @ 2019-04-29 17:32 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Arnd Bergmann, Will Deacon, LKML, Jason Baron, Nathan Chancellor,
	Andrew Morton, Linux ARM

On Fri, Apr 26, 2019 at 12:06 PM Rasmus Villemoes
<linux@rasmusvillemoes.dk> wrote:
>
> Current versions of clang does not like the %c modifier in inline
> assembly for targets other than x86, so any DYNAMIC_DEBUG=y build
> fails on arm64. A fix is likely to land in 9.0 (see
> https://github.com/ClangBuiltLinux/linux/issues/456), but unbreak the
> build for older versions.
>
> Fixes: arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
> Andrew, please apply and/or fold into 9/10.
>
>  arch/arm64/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d0871d523d5d..315992e33b17 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -83,7 +83,7 @@ config ARM64
>         select CRC32
>         select DCACHE_WORD_ACCESS
>         select DMA_DIRECT_REMAP
> -       select DYNAMIC_DEBUG_RELATIVE_POINTERS
> +       select DYNAMIC_DEBUG_RELATIVE_POINTERS if CC_IS_GCC || CLANG_VERSION >= 90000

I just landed the fix for this in Clang, I think around the time you
sent the patch.  Should ship in Clang 9.  Thanks for unbreaking our
build.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>         select EDAC_SUPPORT
>         select FRAME_POINTER
>         select GENERIC_ALLOCATOR
> --
> 2.20.1
>


-- 
Thanks,
~Nick Desaulniers

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-29 17:32           ` Nick Desaulniers
@ 2019-04-30 18:22             ` Nick Desaulniers
  2019-05-02  8:57               ` Rasmus Villemoes
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Desaulniers @ 2019-04-30 18:22 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Dan Rue, Arnd Bergmann, Will Deacon, LKML, Jason Baron,
	Nathan Chancellor, Andrew Morton, Linux ARM

On Mon, Apr 29, 2019 at 10:32 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Apr 26, 2019 at 12:06 PM Rasmus Villemoes
> <linux@rasmusvillemoes.dk> wrote:
> >
> > Current versions of clang does not like the %c modifier in inline
> > assembly for targets other than x86, so any DYNAMIC_DEBUG=y build
> > fails on arm64. A fix is likely to land in 9.0 (see
> > https://github.com/ClangBuiltLinux/linux/issues/456), but unbreak the
> > build for older versions.
> >
> > Fixes: arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
> > Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> > ---
> > Andrew, please apply and/or fold into 9/10.
> >
> >  arch/arm64/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index d0871d523d5d..315992e33b17 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -83,7 +83,7 @@ config ARM64
> >         select CRC32
> >         select DCACHE_WORD_ACCESS
> >         select DMA_DIRECT_REMAP
> > -       select DYNAMIC_DEBUG_RELATIVE_POINTERS
> > +       select DYNAMIC_DEBUG_RELATIVE_POINTERS if CC_IS_GCC || CLANG_VERSION >= 90000
>
> I just landed the fix for this in Clang, I think around the time you
> sent the patch.  Should ship in Clang 9.  Thanks for unbreaking our
> build.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

+ Dan
who's looking for this to get picked up to unbreak KernelCI arm64+clang builds
https://staging.kernelci.org/build/id/5cc6e080cf3a0f9d66257f6d/
-- 
Thanks,
~Nick Desaulniers

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang
  2019-04-30 18:22             ` Nick Desaulniers
@ 2019-05-02  8:57               ` Rasmus Villemoes
  0 siblings, 0 replies; 18+ messages in thread
From: Rasmus Villemoes @ 2019-05-02  8:57 UTC (permalink / raw)
  To: Nick Desaulniers, Rasmus Villemoes, Andrew Morton
  Cc: Dan Rue, Arnd Bergmann, Will Deacon, LKML, Jason Baron,
	Nathan Chancellor, Linux ARM

On 30/04/2019 20.22, Nick Desaulniers wrote:
> On Mon, Apr 29, 2019 at 10:32 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
>>
>> On Fri, Apr 26, 2019 at 12:06 PM Rasmus Villemoes
>> <linux@rasmusvillemoes.dk> wrote:
>>>
>>> Current versions of clang does not like the %c modifier in inline
>>> assembly for targets other than x86, so any DYNAMIC_DEBUG=y build
>>> fails on arm64. A fix is likely to land in 9.0 (see
>>> https://github.com/ClangBuiltLinux/linux/issues/456), but unbreak the
>>> build for older versions.
>>>
>>> Fixes: arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS
>>> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
>>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>>> ---
>>> Andrew, please apply and/or fold into 9/10.

Andrew, friendly ping.

>>>  arch/arm64/Kconfig | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>> index d0871d523d5d..315992e33b17 100644
>>> --- a/arch/arm64/Kconfig
>>> +++ b/arch/arm64/Kconfig
>>> @@ -83,7 +83,7 @@ config ARM64
>>>         select CRC32
>>>         select DCACHE_WORD_ACCESS
>>>         select DMA_DIRECT_REMAP
>>> -       select DYNAMIC_DEBUG_RELATIVE_POINTERS
>>> +       select DYNAMIC_DEBUG_RELATIVE_POINTERS if CC_IS_GCC || CLANG_VERSION >= 90000
>>
>> I just landed the fix for this in Clang, I think around the time you
>> sent the patch.  Should ship in Clang 9.  Thanks for unbreaking our
>> build.

Sorry for breaking it in the first place :-/

Rasmus

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-04-09 21:25 [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
  2019-04-09 21:25 ` [PATCH 07/10] dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
  2019-04-09 21:25 ` [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
@ 2019-05-06  6:48 ` Rasmus Villemoes
  2019-05-06  7:05   ` Ingo Molnar
  2 siblings, 1 reply; 18+ messages in thread
From: Rasmus Villemoes @ 2019-05-06  6:48 UTC (permalink / raw)
  To: Rasmus Villemoes, Andrew Morton
  Cc: Nick Desaulniers, Arnd Bergmann, Michael Ellerman, x86,
	Will Deacon, linux-kernel, Jason Baron, Ingo Molnar,
	Nathan Chancellor, linuxppc-dev, linux-arm-kernel

On 09/04/2019 23.25, Rasmus Villemoes wrote:

> While refreshing these patches, which were orignally just targeted at
> x86-64, it occured to me that despite the implementation relying on
> inline asm, there's nothing x86 specific about it, and indeed it seems
> to work out-of-the-box for ppc64 and arm64 as well, but those have
> only been compile-tested.

So, apart from the Clang build failures for non-x86, I now also got a
report that gcc 4.8 miscompiles this stuff in some cases [1], even for
x86 - gcc 4.9 does not seem to have the problem. So, given that the 5.2
merge window just opened, I suppose this is the point where I should
pull the plug on this experiment :(

Rasmus

[1] Specifically, the problem manifested in net/ipv4/tcp_input.c: Both
uses of the static inline inet_csk_clear_xmit_timer() pass a
compile-time constant 'what', so the ifs get folded away and both uses
are completely inlined. Yet, gcc still decides to emit a copy of the
final 'else' branch of inet_csk_clear_xmit_timer() as its own
inet_csk_reset_xmit_timer.part.55 function, which is of course unused.
And despite the asm() that defines the ddebug descriptor being an "asm
volatile", gcc thinks it's fine to elide that (the code path is
unreachable, after all....), so the entire asm for that function is

        .section        .text.unlikely
        .type   inet_csk_reset_xmit_timer.part.55, @function
inet_csk_reset_xmit_timer.part.55:
        movq    $.LC1, %rsi     #,
        movq    $__UNIQUE_ID_ddebug160, %rdi    #,
        xorl    %eax, %eax      #
        jmp     __dynamic_pr_debug      #
        .size   inet_csk_reset_xmit_timer.part.55,
.-inet_csk_reset_xmit_timer.part.55

which of course fails to link since the symbol __UNIQUE_ID_ddebug160 is
nowhere defined.

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-05-06  6:48 ` [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
@ 2019-05-06  7:05   ` Ingo Molnar
  2019-05-06  7:34     ` Rasmus Villemoes
  0 siblings, 1 reply; 18+ messages in thread
From: Ingo Molnar @ 2019-05-06  7:05 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Nick Desaulniers, Arnd Bergmann, Michael Ellerman, x86,
	Will Deacon, linux-kernel, Linus Torvalds, Jason Baron,
	Ingo Molnar, Andy Lutomirski, Andrew Morton, linuxppc-dev,
	Nathan Chancellor, linux-arm-kernel


* Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> On 09/04/2019 23.25, Rasmus Villemoes wrote:
> 
> > While refreshing these patches, which were orignally just targeted at
> > x86-64, it occured to me that despite the implementation relying on
> > inline asm, there's nothing x86 specific about it, and indeed it seems
> > to work out-of-the-box for ppc64 and arm64 as well, but those have
> > only been compile-tested.
> 
> So, apart from the Clang build failures for non-x86, I now also got a
> report that gcc 4.8 miscompiles this stuff in some cases [1], even for
> x86 - gcc 4.9 does not seem to have the problem. So, given that the 5.2
> merge window just opened, I suppose this is the point where I should
> pull the plug on this experiment :(
> 
> Rasmus
> 
> [1] Specifically, the problem manifested in net/ipv4/tcp_input.c: Both
> uses of the static inline inet_csk_clear_xmit_timer() pass a
> compile-time constant 'what', so the ifs get folded away and both uses
> are completely inlined. Yet, gcc still decides to emit a copy of the
> final 'else' branch of inet_csk_clear_xmit_timer() as its own
> inet_csk_reset_xmit_timer.part.55 function, which is of course unused.
> And despite the asm() that defines the ddebug descriptor being an "asm
> volatile", gcc thinks it's fine to elide that (the code path is
> unreachable, after all....), so the entire asm for that function is
> 
>         .section        .text.unlikely
>         .type   inet_csk_reset_xmit_timer.part.55, @function
> inet_csk_reset_xmit_timer.part.55:
>         movq    $.LC1, %rsi     #,
>         movq    $__UNIQUE_ID_ddebug160, %rdi    #,
>         xorl    %eax, %eax      #
>         jmp     __dynamic_pr_debug      #
>         .size   inet_csk_reset_xmit_timer.part.55,
> .-inet_csk_reset_xmit_timer.part.55
> 
> which of course fails to link since the symbol __UNIQUE_ID_ddebug160 is
> nowhere defined.

It's sad to see such nice data footprint savings go the way of the dodo 
just because GCC 4.8 is buggy.

The current compatibility cut-off is GCC 4.6:

  GNU C                  4.6              gcc --version

Do we know where the GCC bug was fixed, was it in GCC 4.9?

According to the GCC release dates:

  https://www.gnu.org/software/gcc/releases.html

4.8.0 was released in early-2013, while 4.9.0 was released in early-2014. 
So the tooling compatibility window for latest upstream would narrow from 
~6 years to ~5 years.

Thanks,

	Ingo

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-05-06  7:05   ` Ingo Molnar
@ 2019-05-06  7:34     ` Rasmus Villemoes
  2019-05-06  7:48       ` Ingo Molnar
  2019-05-06 14:48       ` Segher Boessenkool
  0 siblings, 2 replies; 18+ messages in thread
From: Rasmus Villemoes @ 2019-05-06  7:34 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Nick Desaulniers, Arnd Bergmann, Michael Ellerman, x86,
	Will Deacon, linux-kernel, Linus Torvalds, Jason Baron,
	Ingo Molnar, Andy Lutomirski, Andrew Morton, linuxppc-dev,
	Nathan Chancellor, linux-arm-kernel

On 06/05/2019 09.05, Ingo Molnar wrote:
> 
> 
> It's sad to see such nice data footprint savings go the way of the dodo 
> just because GCC 4.8 is buggy.
> 
> The current compatibility cut-off is GCC 4.6:
> 
>   GNU C                  4.6              gcc --version
> 
> Do we know where the GCC bug was fixed, was it in GCC 4.9?

Not sure. The report was from a build on CentOS with gcc 4.8.5, so I
tried installing the gcc-4.8 package on my Ubuntu machine and could
reproduce. Then I tried installed gcc-4.9, and after disabling
CONFIG_RETPOLINE (both CentOS and Ubuntu carry backported retpoline
support in their 4.8, but apparently not 4.9), I could see that the
problem was gone. But whether it's gone because it no longer elides an
asm volatile() on a code path it otherwise emits code for, or because it
simply doesn't emit the unused static inline() at all I don't know.

I thought 0day also tested a range of supported compiler versions, so I
was rather surprised at getting this report at all. But I suppose the
arch/config matrix is already pretty huge. Anyway, the bug certainly
doesn't exist in any of the gcc versions 0day does test.

I _am_ bending the C rules a bit with the "extern some_var; asm
volatile(".section some_section\nsome_var: blabla");". I should probably
ask on the gcc list whether this way of defining a local symbol in
inline assembly and referring to it from C is supposed to work, or it
just happens to work by chance.

Rasmus

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-05-06  7:34     ` Rasmus Villemoes
@ 2019-05-06  7:48       ` Ingo Molnar
  2019-05-06 14:48       ` Segher Boessenkool
  1 sibling, 0 replies; 18+ messages in thread
From: Ingo Molnar @ 2019-05-06  7:48 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Nick Desaulniers, Arnd Bergmann, Michael Ellerman, x86,
	Will Deacon, linux-kernel, Linus Torvalds, Jason Baron,
	Ingo Molnar, Andy Lutomirski, Andrew Morton, linuxppc-dev,
	Nathan Chancellor, linux-arm-kernel


* Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> I _am_ bending the C rules a bit with the "extern some_var; asm 
> volatile(".section some_section\nsome_var: blabla");". I should 
> probably ask on the gcc list whether this way of defining a local 
> symbol in inline assembly and referring to it from C is supposed to 
> work, or it just happens to work by chance.

Doing that would be rather useful I think.

Thanks,

	Ingo

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS
  2019-05-06  7:34     ` Rasmus Villemoes
  2019-05-06  7:48       ` Ingo Molnar
@ 2019-05-06 14:48       ` Segher Boessenkool
  1 sibling, 0 replies; 18+ messages in thread
From: Segher Boessenkool @ 2019-05-06 14:48 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: linuxppc-dev, Arnd Bergmann, Nick Desaulniers, x86, Will Deacon,
	linux-kernel, Nathan Chancellor, Jason Baron, Ingo Molnar,
	Andy Lutomirski, Andrew Morton, Linus Torvalds, Ingo Molnar,
	linux-arm-kernel

On Mon, May 06, 2019 at 09:34:55AM +0200, Rasmus Villemoes wrote:
> I _am_ bending the C rules a bit with the "extern some_var; asm
> volatile(".section some_section\nsome_var: blabla");". I should probably
> ask on the gcc list whether this way of defining a local symbol in
> inline assembly and referring to it from C is supposed to work, or it
> just happens to work by chance.

It only works by chance.  There is no way GCC can know the asm needs
that variable.  If you make it (or its address) an input of the asm it
should work as far as I can see?  (Need exact code to analyse it exactly).


Segher

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-05-06 14:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-09 21:25 [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
2019-04-09 21:25 ` [PATCH 07/10] dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
2019-04-09 21:25 ` [PATCH 09/10] arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
2019-04-26  9:39   ` Arnd Bergmann
2019-04-26 10:05     ` Rasmus Villemoes
2019-04-26 13:00       ` Nathan Chancellor
2019-04-26 19:06         ` [PATCH 11/10] arm64: unbreak DYNAMIC_DEBUG=y build with clang Rasmus Villemoes
2019-04-26 19:27           ` Rasmus Villemoes
2019-04-26 21:58             ` Konstantin Ryabitsev
2019-04-26 22:07             ` Konstantin Ryabitsev
2019-04-29 17:32           ` Nick Desaulniers
2019-04-30 18:22             ` Nick Desaulniers
2019-05-02  8:57               ` Rasmus Villemoes
2019-05-06  6:48 ` [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Rasmus Villemoes
2019-05-06  7:05   ` Ingo Molnar
2019-05-06  7:34     ` Rasmus Villemoes
2019-05-06  7:48       ` Ingo Molnar
2019-05-06 14:48       ` Segher Boessenkool

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).