All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og)
@ 2018-05-06  0:20 changbin.du
  2018-05-06  0:20 ` [PATCH v3 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif changbin.du
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: changbin.du @ 2018-05-06  0:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, tglx, mingo, akpm
  Cc: rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

From: Changbin Du <changbin.du@intel.com>

Hi all,
I know some kernel developers was searching for a method to dissable GCC
optimizations, probably they want to apply GCC '-O0' option. But since Linux
kernel replys on GCC optimization to remove some dead code, so '-O0' just
breaks the build. They do need this because they want to debug kernel with
qemu, simics, kgtp or kgdb.

Thanks for the GCC '-Og' optimization level introduced in GCC 4.8, which
offers a reasonable level of optimization while maintaining fast compilation
and a good debugging experience. It is similar to '-O1' while perferring to
keep debug ability over runtime speed. With '-Og', we can build a kernel with
better debug ability and little performance drop after some simple change.

In this series, firstly introduce a new config CONFIG_NO_AUTO_INLINE after two
fixes for this new option. With this option, only functions explicitly marked
with "inline" will  be inlined. This will allow the function tracer to trace
more functions because it only traces functions that the compiler has not
inlined.

Then introduce new config CC_OPTIMIZE_FOR_DEBUGGING which apply '-Og'
optimization level for whole kernel, with a simple fix in fix_to_virt().
Currently I have only tested this option on x86 and ARM platform. Other
platforms should also work but probably need some compiling fixes as what
having done in this series. I leave that to who want to try this debug
option.

Comparison of vmlinux size: a bit smaller.

    w/o CONFIG_DEBUG_EXPERIENCE
    $ size vmlinux
       text    data     bss     dec     hex filename
    22665554   9709674  2920908 35296136        21a9388 vmlinux

    w/ CONFIG_DEBUG_EXPERIENCE
    $ size vmlinux
       text    data     bss     dec     hex filename
    21499032   10102758 2920908 34522698        20ec64a vmlinux


Comparison of system performance: a bit drop (~6%).
    This benchmark of kernel compilation is suggested by Ingo Molnar.
    https://lkml.org/lkml/2018/5/2/74

    Preparation: Set cpufreq to 'performance'.
    for ((cpu=0; cpu<120; cpu++)); do
      G=/sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_governor
      [ -f $G ] && echo performance > $G
    done

    w/o CONFIG_DEBUG_EXPERIENCE
    $ perf stat --repeat 5 --null --pre                 '\
        cp -a kernel ../kernel.copy.$(date +%s);         \
        rm -rf *;                                        \
        git checkout .;                                  \
        echo 1 > /proc/sys/vm/drop_caches;               \
        find ../kernel* -type f | xargs cat >/dev/null;  \
        make -j kernel >/dev/null;                       \
        make clean >/dev/null 2>&1;                      \
        sync                                            '\
                                                         \
        make -j8 >/dev/null

     Performance counter stats for 'make -j8' (5 runs):

        219.764246652 seconds time elapsed                   ( +-  0.78% )

    w/ CONFIG_DEBUG_EXPERIENCE
    $ perf stat --repeat 5 --null --pre                 '\
        cp -a kernel ../kernel.copy.$(date +%s);         \
        rm -rf *;                                        \
        git checkout .;                                  \
        echo 1 > /proc/sys/vm/drop_caches;               \
        find ../kernel* -type f | xargs cat >/dev/null;  \
        make -j kernel >/dev/null;                       \
        make clean >/dev/null 2>&1;                      \
        sync                                            '\
                                                         \
        make -j8 >/dev/null

    Performance counter stats for 'make -j8' (5 runs):

         233.574187771 seconds time elapsed                  ( +-  0.19% )

Changbin Du (5):
  x86/mm: surround level4_kernel_pgt with #ifdef
    CONFIG_X86_5LEVEL...#endif
  regulator: add dummy function of_find_regulator_by_node
  kernel hacking: new config NO_AUTO_INLINE to disable compiler
    auto-inline optimizations
  kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og
    optimization
  asm-generic: fix build error in fix_to_virt with
    CONFIG_CC_OPTIMIZE_FOR_DEBUGGING

 Makefile                          | 10 ++++++++++
 arch/arm/mm/mmu.c                 |  2 +-
 arch/x86/include/asm/pgtable_64.h |  2 ++
 arch/x86/kernel/head64.c          | 13 ++++++-------
 drivers/regulator/internal.h      |  9 +++++++--
 include/linux/compiler-gcc.h      |  2 +-
 include/linux/compiler.h          |  2 +-
 init/Kconfig                      | 19 +++++++++++++++++++
 lib/Kconfig.debug                 | 17 +++++++++++++++++
 9 files changed, 64 insertions(+), 12 deletions(-)

-- 
2.7.4

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

* [PATCH v3 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif
  2018-05-06  0:20 [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og) changbin.du
@ 2018-05-06  0:20 ` changbin.du
  2018-05-06  0:20 ` [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node changbin.du
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: changbin.du @ 2018-05-06  0:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, tglx, mingo, akpm
  Cc: rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

From: Changbin Du <changbin.du@intel.com>

The level4_kernel_pgt is only defined when X86_5LEVEL is enabled. So
surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif to
make code correct.

Signed-off-by: Changbin Du <changbin.du@intel.com>
---
 arch/x86/include/asm/pgtable_64.h |  2 ++
 arch/x86/kernel/head64.c          | 13 ++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 877bc27..9e7f667 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -15,7 +15,9 @@
 #include <linux/bitops.h>
 #include <linux/threads.h>
 
+#ifdef CONFIG_X86_5LEVEL
 extern p4d_t level4_kernel_pgt[512];
+#endif
 extern p4d_t level4_ident_pgt[512];
 extern pud_t level3_kernel_pgt[512];
 extern pud_t level3_ident_pgt[512];
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 0c408f8..775d7a6 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -143,16 +143,15 @@ unsigned long __head __startup_64(unsigned long physaddr,
 
 	pgd = fixup_pointer(&early_top_pgt, physaddr);
 	p = pgd + pgd_index(__START_KERNEL_map);
-	if (la57)
-		*p = (unsigned long)level4_kernel_pgt;
-	else
-		*p = (unsigned long)level3_kernel_pgt;
-	*p += _PAGE_TABLE_NOENC - __START_KERNEL_map + load_delta;
-
+#ifdef CONFIG_X86_5LEVEL
 	if (la57) {
+		*p = (unsigned long)level4_kernel_pgt;
 		p4d = fixup_pointer(&level4_kernel_pgt, physaddr);
 		p4d[511] += load_delta;
-	}
+	} else
+#endif
+		*p = (unsigned long)level3_kernel_pgt;
+	*p += _PAGE_TABLE_NOENC - __START_KERNEL_map + load_delta;
 
 	pud = fixup_pointer(&level3_kernel_pgt, physaddr);
 	pud[510] += load_delta;
-- 
2.7.4

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

* [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node
  2018-05-06  0:20 [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og) changbin.du
  2018-05-06  0:20 ` [PATCH v3 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif changbin.du
@ 2018-05-06  0:20 ` changbin.du
  2018-05-09  8:21   ` Mark Brown
  2018-05-06  0:20 ` [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations changbin.du
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: changbin.du @ 2018-05-06  0:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, tglx, mingo, akpm
  Cc: rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

From: Changbin Du <changbin.du@intel.com>

If device tree is not enabled, of_find_regulator_by_node() should have
a dummy function since the function call is still there.

This is to fix build error after CONFIG_NO_AUTO_INLINE is introduced.
If this option is enabled, GCC will not auto-inline functions that are
not explicitly marked as inline.

In this case (no CONFIG_OF), the copmiler will report error in function
regulator_dev_lookup().

W/O NO_AUTO_INLINE, function of_get_regulator() is auto-inlined and then
the call to of_find_regulator_by_node() is optimized out since
of_get_regulator() always return NULL.

W/ NO_AUTO_INLINE, the return value of of_get_regulator() is a variable
so the call to of_find_regulator_by_node() cannot be optimized out. So
we need a stub of_find_regulator_by_node().

static struct regulator_dev *regulator_dev_lookup(struct device *dev,
						  const char *supply)
{
	struct regulator_dev *r = NULL;
	struct device_node *node;
	struct regulator_map *map;
	const char *devname = NULL;

	regulator_supply_alias(&dev, &supply);

	/* first do a dt based lookup */
	if (dev && dev->of_node) {
		node = of_get_regulator(dev, supply);
		if (node) {
			r = of_find_regulator_by_node(node);
			if (r)
				return r;
	...

Signed-off-by: Changbin Du <changbin.du@intel.com>
---
 drivers/regulator/internal.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h
index abfd56e..24fde1e 100644
--- a/drivers/regulator/internal.h
+++ b/drivers/regulator/internal.h
@@ -56,14 +56,19 @@ static inline struct regulator_dev *dev_to_rdev(struct device *dev)
 	return container_of(dev, struct regulator_dev, dev);
 }
 
-struct regulator_dev *of_find_regulator_by_node(struct device_node *np);
-
 #ifdef CONFIG_OF
+struct regulator_dev *of_find_regulator_by_node(struct device_node *np);
 struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
 			         const struct regulator_desc *desc,
 				 struct regulator_config *config,
 				 struct device_node **node);
 #else
+static inline struct regulator_dev *
+of_find_regulator_by_node(struct device_node *np)
+{
+	return NULL;
+}
+
 static inline struct regulator_init_data *
 regulator_of_get_init_data(struct device *dev,
 			   const struct regulator_desc *desc,
-- 
2.7.4

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

* [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
  2018-05-06  0:20 [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og) changbin.du
  2018-05-06  0:20 ` [PATCH v3 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif changbin.du
  2018-05-06  0:20 ` [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node changbin.du
@ 2018-05-06  0:20 ` changbin.du
  2018-05-06  5:50     ` kbuild test robot
  2018-05-06  6:15     ` kbuild test robot
  2018-05-06  0:20 ` [PATCH v3 4/5] kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og optimization changbin.du
  2018-05-06  0:20 ` [PATCH v3 5/5] asm-generic: fix build error in fix_to_virt with CONFIG_CC_OPTIMIZE_FOR_DEBUGGING changbin.du
  4 siblings, 2 replies; 14+ messages in thread
From: changbin.du @ 2018-05-06  0:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, tglx, mingo, akpm
  Cc: rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

From: Changbin Du <changbin.du@intel.com>

This patch add a new kernel hacking option NO_AUTO_INLINE. Selecting
this option will prevent the compiler from optimizing the kernel by
auto-inlining functions not marked with the inline keyword.

With this option, only functions explicitly marked with "inline" will
be inlined. This will allow the function tracer to trace more functions
because it only traces functions that the compiler has not inlined.

Signed-off-by: Changbin Du <changbin.du@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>

---
v2: Some grammar updates from Steven.
---
 Makefile          |  6 ++++++
 lib/Kconfig.debug | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/Makefile b/Makefile
index 619a85a..eb694f6 100644
--- a/Makefile
+++ b/Makefile
@@ -775,6 +775,12 @@ KBUILD_CFLAGS 	+= $(call cc-option, -femit-struct-debug-baseonly) \
 		   $(call cc-option,-fno-var-tracking)
 endif
 
+ifdef CONFIG_NO_AUTO_INLINE
+KBUILD_CFLAGS   += $(call cc-option, -fno-inline-functions) \
+		   $(call cc-option, -fno-inline-small-functions) \
+		   $(call cc-option, -fno-inline-functions-called-once)
+endif
+
 ifdef CONFIG_FUNCTION_TRACER
 ifndef CC_FLAGS_FTRACE
 CC_FLAGS_FTRACE := -pg
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c40c7b7..da52243 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -198,6 +198,23 @@ config GDB_SCRIPTS
 	  instance. See Documentation/dev-tools/gdb-kernel-debugging.rst
 	  for further details.
 
+config NO_AUTO_INLINE
+	bool "Disable compiler auto-inline optimizations"
+	help
+	  This will prevent the compiler from optimizing the kernel by
+	  auto-inlining functions not marked with the inline keyword.
+	  With this option, only functions explicitly marked with
+	  "inline" will be inlined. This will allow the function tracer
+	  to trace more functions because it only traces functions that
+	  the compiler has not inlined.
+
+	  Enabling this function can help debugging a kernel if using
+	  the function tracer. But it can also change how the kernel
+	  works, because inlining functions may change the timing,
+	  which could make it difficult while debugging race conditions.
+
+	  If unsure, select N.
+
 config ENABLE_WARN_DEPRECATED
 	bool "Enable __deprecated logic"
 	default y
-- 
2.7.4

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

* [PATCH v3 4/5] kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og optimization
  2018-05-06  0:20 [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og) changbin.du
                   ` (2 preceding siblings ...)
  2018-05-06  0:20 ` [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations changbin.du
@ 2018-05-06  0:20 ` changbin.du
  2018-05-06  0:20 ` [PATCH v3 5/5] asm-generic: fix build error in fix_to_virt with CONFIG_CC_OPTIMIZE_FOR_DEBUGGING changbin.du
  4 siblings, 0 replies; 14+ messages in thread
From: changbin.du @ 2018-05-06  0:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, tglx, mingo, akpm
  Cc: rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

From: Changbin Du <changbin.du@intel.com>

This will apply GCC '-Og' optimization level which is supported
since GCC 4.8. This optimization level offers a reasonable level
of optimization while maintaining fast compilation and a good
debugging experience. It is similar to '-O1' while perferring
to keep debug ability over runtime speed.

If enabling this option breaks your kernel, you should either
disable this or find a fix (mostly in the arch code). Currently
this option has only been tested on x86_64 and arm platform.

This option can satisfy people who was searching for a method
to disable compiler optimizations so to achieve better kernel
debugging experience with kgdb or qemu.

The main problem of '-Og' is we must not use __attribute__((error(msg))).
The compiler will report error though the call to error function
still can be optimize out. So we must fallback to array tricky.

Comparison of vmlinux size: a bit smaller.

    w/o CONFIG_CC_OPTIMIZE_FOR_DEBUGGING
    $ size vmlinux
       text    data     bss     dec     hex filename
    22665554   9709674  2920908 35296136        21a9388 vmlinux

    w/ CONFIG_CC_OPTIMIZE_FOR_DEBUGGING
    $ size vmlinux
       text    data     bss     dec     hex filename
    21499032   10102758 2920908 34522698        20ec64a vmlinux

Comparison of system performance: a bit drop (~6%).
    This benchmark of kernel compilation is suggested by Ingo Molnar.
    https://lkml.org/lkml/2018/5/2/74

    Preparation: Set cpufreq to 'performance'.
    for ((cpu=0; cpu<120; cpu++)); do
      G=/sys/devices/system/cpu/cpu$cpu/cpufreq/scaling_governor
      [ -f $G ] && echo performance > $G
    done

    w/o CONFIG_CC_OPTIMIZE_FOR_DEBUGGING
    $ perf stat --repeat 5 --null --pre                 '\
        cp -a kernel ../kernel.copy.$(date +%s);         \
        rm -rf *;                                        \
        git checkout .;                                  \
        echo 1 > /proc/sys/vm/drop_caches;               \
        find ../kernel* -type f | xargs cat >/dev/null;  \
        make -j kernel >/dev/null;                       \
        make clean >/dev/null 2>&1;                      \
        sync                                            '\
                                                         \
        make -j8 >/dev/null

    Performance counter stats for 'make -j8' (5 runs):

        219.764246652 seconds time elapsed                   ( +-  0.78% )

    w/ CONFIG_CC_OPTIMIZE_FOR_DEBUGGING
    $ perf stat --repeat 5 --null --pre                 '\
        cp -a kernel ../kernel.copy.$(date +%s);         \
        rm -rf *;                                        \
        git checkout .;                                  \
        echo 1 > /proc/sys/vm/drop_caches;               \
        find ../kernel* -type f | xargs cat >/dev/null;  \
        make -j kernel >/dev/null;                       \
        make clean >/dev/null 2>&1;                      \
        sync                                            '\
                                                         \
        make -j8 >/dev/null

    Performance counter stats for 'make -j8' (5 runs):

         233.574187771 seconds time elapsed                  ( +-  0.19% )

Signed-off-by: Changbin Du <changbin.du@intel.com>

---
v3:
  o Rename DEBUG_EXPERIENCE to CC_OPTIMIZE_FOR_DEBUGGING
  o Move new configuration item to "General setup->Compiler optimization level"
v2:
  o Improve performance benchmark as suggested by Ingo.
  o Grammar updates in description. (Randy Dunlap)
---
 Makefile                     |  4 ++++
 include/linux/compiler-gcc.h |  2 +-
 include/linux/compiler.h     |  2 +-
 init/Kconfig                 | 19 +++++++++++++++++++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index eb694f6..ae1dea7 100644
--- a/Makefile
+++ b/Makefile
@@ -639,6 +639,9 @@ KBUILD_CFLAGS	+= $(call cc-disable-warning, format-truncation)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)
 
+ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUGGING
+KBUILD_CFLAGS	+= $(call cc-option, -Og)
+else
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= $(call cc-option,-Oz,-Os)
 KBUILD_CFLAGS	+= $(call cc-disable-warning,maybe-uninitialized,)
@@ -649,6 +652,7 @@ else
 KBUILD_CFLAGS   += -O2
 endif
 endif
+endif
 
 KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
 			$(call cc-disable-warning,maybe-uninitialized,))
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index b4bf73f..586ed11 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -192,7 +192,7 @@
 
 #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
 
-#ifndef __CHECKER__
+#if !defined(__CHECKER__) && !defined(CONFIG_CC_OPTIMIZE_FOR_DEBUGGING)
 # define __compiletime_warning(message) __attribute__((warning(message)))
 # define __compiletime_error(message) __attribute__((error(message)))
 #endif /* __CHECKER__ */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index ab4711c..e97caf4 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -301,7 +301,7 @@ unsigned long read_word_at_a_time(const void *addr)
  * sparse see a constant array size without breaking compiletime_assert on old
  * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether.
  */
-# ifndef __CHECKER__
+# if !defined(__CHECKER__) && !defined(CONFIG_CC_OPTIMIZE_FOR_DEBUGGING)
 #  define __compiletime_error_fallback(condition) \
 	do { ((void)sizeof(char[1 - 2 * condition])); } while (0)
 # endif
diff --git a/init/Kconfig b/init/Kconfig
index f013afc..aa52535 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1036,6 +1036,25 @@ config CC_OPTIMIZE_FOR_SIZE
 
 	  If unsure, say N.
 
+config CC_OPTIMIZE_FOR_DEBUGGING
+	bool "Optimize for better debugging experience (-Og)"
+	select NO_AUTO_INLINE
+	help
+	  This will apply GCC '-Og' optimization level which is supported
+	  since GCC 4.8. This optimization level offers a reasonable level
+	  of optimization while maintaining fast compilation and a good
+	  debugging experience. It is similar to '-O1' while preferring to
+	  keep debug ability over runtime speed. The overall performance
+	  will drop a bit (~6%).
+
+	  Use only if you want to debug the kernel, especially if you want
+	  to have better kernel debugging experience with gdb facilities
+	  like kgdb or qemu. If enabling this option breaks your kernel,
+	  you should either disable this or find a fix (mostly in the arch
+	  code).
+
+	  If unsure, select N.
+
 endchoice
 
 config SYSCTL
-- 
2.7.4

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

* [PATCH v3 5/5] asm-generic: fix build error in fix_to_virt with CONFIG_CC_OPTIMIZE_FOR_DEBUGGING
  2018-05-06  0:20 [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og) changbin.du
                   ` (3 preceding siblings ...)
  2018-05-06  0:20 ` [PATCH v3 4/5] kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og optimization changbin.du
@ 2018-05-06  0:20 ` changbin.du
  4 siblings, 0 replies; 14+ messages in thread
From: changbin.du @ 2018-05-06  0:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, tglx, mingo, akpm
  Cc: rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

From: Changbin Du <changbin.du@intel.com>

With '-Og' optimization level, GCC would not optimize a count for a loop
as a constant value. But BUILD_BUG_ON() only accept compile-time constant
values. Let's use __fix_to_virt() to avoid the error.

arch/arm/mm/mmu.o: In function `fix_to_virt':
/home/changbin/work/linux/./include/asm-generic/fixmap.h:31: undefined reference to `__compiletime_assert_31'
Makefile:1051: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Signed-off-by: Changbin Du <changbin.du@intel.com>

---
v2: use __fix_to_virt() to fix the issue.
---
 arch/arm/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e46a6a4..c08d74e 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1599,7 +1599,7 @@ static void __init early_fixmap_shutdown(void)
 		pte_t *pte;
 		struct map_desc map;
 
-		map.virtual = fix_to_virt(i);
+		map.virtual = __fix_to_virt(i);
 		pte = pte_offset_early_fixmap(pmd_off_k(map.virtual), map.virtual);
 
 		/* Only i/o device mappings are supported ATM */
-- 
2.7.4

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

* Re: [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
  2018-05-06  0:20 ` [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations changbin.du
  2018-05-06  5:50     ` kbuild test robot
@ 2018-05-06  5:50     ` kbuild test robot
  1 sibling, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2018-05-06  5:50 UTC (permalink / raw)
  To: changbin.du
  Cc: kbuild-all, yamada.masahiro, michal.lkml, tglx, mingo, akpm,
	rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

[-- Attachment #1: Type: text/plain, Size: 5626 bytes --]

Hi Changbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180506-110946
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/pci/host/pci-xgene.c: In function 'xgene_pcie_setup_ib_reg':
>> drivers/pci/host/pci-xgene.c:532:2: warning: 'pim_reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/scsi/ufs/ufs-qcom.c: In function 'ufs_qcom_testbus_config':
>> drivers/scsi/ufs/ufs-qcom.c:1527:6: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int offset;
         ^~~~~~
>> drivers/scsi/ufs/ufs-qcom.c:1526:6: warning: 'reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int reg;
         ^~~

vim +/pim_reg +532 drivers/pci/host/pci-xgene.c

5f6b6ccd Tanmay Inamdar 2014-10-01  484  
5f6b6ccd Tanmay Inamdar 2014-10-01  485  static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port,
5f6b6ccd Tanmay Inamdar 2014-10-01  486  				    struct of_pci_range *range, u8 *ib_reg_mask)
5f6b6ccd Tanmay Inamdar 2014-10-01  487  {
5f6b6ccd Tanmay Inamdar 2014-10-01  488  	void __iomem *cfg_base = port->cfg_base;
d963ab22 Bjorn Helgaas  2016-10-06  489  	struct device *dev = port->dev;
5f6b6ccd Tanmay Inamdar 2014-10-01  490  	void *bar_addr;
4ecf6b0f Bjorn Helgaas  2016-10-06  491  	u32 pim_reg;
5f6b6ccd Tanmay Inamdar 2014-10-01  492  	u64 cpu_addr = range->cpu_addr;
5f6b6ccd Tanmay Inamdar 2014-10-01  493  	u64 pci_addr = range->pci_addr;
5f6b6ccd Tanmay Inamdar 2014-10-01  494  	u64 size = range->size;
5f6b6ccd Tanmay Inamdar 2014-10-01  495  	u64 mask = ~(size - 1) | EN_REG;
5f6b6ccd Tanmay Inamdar 2014-10-01  496  	u32 flags = PCI_BASE_ADDRESS_MEM_TYPE_64;
5f6b6ccd Tanmay Inamdar 2014-10-01  497  	u32 bar_low;
5f6b6ccd Tanmay Inamdar 2014-10-01  498  	int region;
5f6b6ccd Tanmay Inamdar 2014-10-01  499  
5f6b6ccd Tanmay Inamdar 2014-10-01  500  	region = xgene_pcie_select_ib_reg(ib_reg_mask, range->size);
5f6b6ccd Tanmay Inamdar 2014-10-01  501  	if (region < 0) {
d963ab22 Bjorn Helgaas  2016-10-06  502  		dev_warn(dev, "invalid pcie dma-range config\n");
5f6b6ccd Tanmay Inamdar 2014-10-01  503  		return;
5f6b6ccd Tanmay Inamdar 2014-10-01  504  	}
5f6b6ccd Tanmay Inamdar 2014-10-01  505  
5f6b6ccd Tanmay Inamdar 2014-10-01  506  	if (range->flags & IORESOURCE_PREFETCH)
5f6b6ccd Tanmay Inamdar 2014-10-01  507  		flags |= PCI_BASE_ADDRESS_MEM_PREFETCH;
5f6b6ccd Tanmay Inamdar 2014-10-01  508  
5f6b6ccd Tanmay Inamdar 2014-10-01  509  	bar_low = pcie_bar_low_val((u32)cpu_addr, flags);
5f6b6ccd Tanmay Inamdar 2014-10-01  510  	switch (region) {
5f6b6ccd Tanmay Inamdar 2014-10-01  511  	case 0:
4ecf6b0f Bjorn Helgaas  2016-10-06  512  		xgene_pcie_set_ib_mask(port, BRIDGE_CFG_4, flags, size);
5f6b6ccd Tanmay Inamdar 2014-10-01  513  		bar_addr = cfg_base + PCI_BASE_ADDRESS_0;
5f6b6ccd Tanmay Inamdar 2014-10-01  514  		writel(bar_low, bar_addr);
5f6b6ccd Tanmay Inamdar 2014-10-01  515  		writel(upper_32_bits(cpu_addr), bar_addr + 0x4);
4ecf6b0f Bjorn Helgaas  2016-10-06  516  		pim_reg = PIM1_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  517  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  518  	case 1:
8e93c513 Bjorn Helgaas  2016-10-06  519  		xgene_pcie_writel(port, IBAR2, bar_low);
8e93c513 Bjorn Helgaas  2016-10-06  520  		xgene_pcie_writel(port, IR2MSK, lower_32_bits(mask));
4ecf6b0f Bjorn Helgaas  2016-10-06  521  		pim_reg = PIM2_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  522  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  523  	case 2:
8e93c513 Bjorn Helgaas  2016-10-06  524  		xgene_pcie_writel(port, IBAR3L, bar_low);
8e93c513 Bjorn Helgaas  2016-10-06  525  		xgene_pcie_writel(port, IBAR3L + 0x4, upper_32_bits(cpu_addr));
8e93c513 Bjorn Helgaas  2016-10-06  526  		xgene_pcie_writel(port, IR3MSKL, lower_32_bits(mask));
8e93c513 Bjorn Helgaas  2016-10-06  527  		xgene_pcie_writel(port, IR3MSKL + 0x4, upper_32_bits(mask));
4ecf6b0f Bjorn Helgaas  2016-10-06  528  		pim_reg = PIM3_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  529  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  530  	}
5f6b6ccd Tanmay Inamdar 2014-10-01  531  
4ecf6b0f Bjorn Helgaas  2016-10-06 @532  	xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
5f6b6ccd Tanmay Inamdar 2014-10-01  533  }
5f6b6ccd Tanmay Inamdar 2014-10-01  534  

:::::: The code at line 532 was first introduced by commit
:::::: 4ecf6b0f83523fb186dd1de9e2f1d324a2a413d9 PCI: xgene: Pass struct xgene_pcie_port to setup functions

:::::: TO: Bjorn Helgaas <bhelgaas@google.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59041 bytes --]

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

* Re: [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
@ 2018-05-06  5:50     ` kbuild test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2018-05-06  5:50 UTC (permalink / raw)
  To: changbin.du
  Cc: kbuild-all, yamada.masahiro, michal.lkml, tglx, mingo, akpm,
	rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 5626 bytes --]

Hi Changbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180506-110946
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/pci/host/pci-xgene.c: In function 'xgene_pcie_setup_ib_reg':
>> drivers/pci/host/pci-xgene.c:532:2: warning: 'pim_reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/scsi/ufs/ufs-qcom.c: In function 'ufs_qcom_testbus_config':
>> drivers/scsi/ufs/ufs-qcom.c:1527:6: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int offset;
         ^~~~~~
>> drivers/scsi/ufs/ufs-qcom.c:1526:6: warning: 'reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int reg;
         ^~~

vim +/pim_reg +532 drivers/pci/host/pci-xgene.c

5f6b6ccd Tanmay Inamdar 2014-10-01  484  
5f6b6ccd Tanmay Inamdar 2014-10-01  485  static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port,
5f6b6ccd Tanmay Inamdar 2014-10-01  486  				    struct of_pci_range *range, u8 *ib_reg_mask)
5f6b6ccd Tanmay Inamdar 2014-10-01  487  {
5f6b6ccd Tanmay Inamdar 2014-10-01  488  	void __iomem *cfg_base = port->cfg_base;
d963ab22 Bjorn Helgaas  2016-10-06  489  	struct device *dev = port->dev;
5f6b6ccd Tanmay Inamdar 2014-10-01  490  	void *bar_addr;
4ecf6b0f Bjorn Helgaas  2016-10-06  491  	u32 pim_reg;
5f6b6ccd Tanmay Inamdar 2014-10-01  492  	u64 cpu_addr = range->cpu_addr;
5f6b6ccd Tanmay Inamdar 2014-10-01  493  	u64 pci_addr = range->pci_addr;
5f6b6ccd Tanmay Inamdar 2014-10-01  494  	u64 size = range->size;
5f6b6ccd Tanmay Inamdar 2014-10-01  495  	u64 mask = ~(size - 1) | EN_REG;
5f6b6ccd Tanmay Inamdar 2014-10-01  496  	u32 flags = PCI_BASE_ADDRESS_MEM_TYPE_64;
5f6b6ccd Tanmay Inamdar 2014-10-01  497  	u32 bar_low;
5f6b6ccd Tanmay Inamdar 2014-10-01  498  	int region;
5f6b6ccd Tanmay Inamdar 2014-10-01  499  
5f6b6ccd Tanmay Inamdar 2014-10-01  500  	region = xgene_pcie_select_ib_reg(ib_reg_mask, range->size);
5f6b6ccd Tanmay Inamdar 2014-10-01  501  	if (region < 0) {
d963ab22 Bjorn Helgaas  2016-10-06  502  		dev_warn(dev, "invalid pcie dma-range config\n");
5f6b6ccd Tanmay Inamdar 2014-10-01  503  		return;
5f6b6ccd Tanmay Inamdar 2014-10-01  504  	}
5f6b6ccd Tanmay Inamdar 2014-10-01  505  
5f6b6ccd Tanmay Inamdar 2014-10-01  506  	if (range->flags & IORESOURCE_PREFETCH)
5f6b6ccd Tanmay Inamdar 2014-10-01  507  		flags |= PCI_BASE_ADDRESS_MEM_PREFETCH;
5f6b6ccd Tanmay Inamdar 2014-10-01  508  
5f6b6ccd Tanmay Inamdar 2014-10-01  509  	bar_low = pcie_bar_low_val((u32)cpu_addr, flags);
5f6b6ccd Tanmay Inamdar 2014-10-01  510  	switch (region) {
5f6b6ccd Tanmay Inamdar 2014-10-01  511  	case 0:
4ecf6b0f Bjorn Helgaas  2016-10-06  512  		xgene_pcie_set_ib_mask(port, BRIDGE_CFG_4, flags, size);
5f6b6ccd Tanmay Inamdar 2014-10-01  513  		bar_addr = cfg_base + PCI_BASE_ADDRESS_0;
5f6b6ccd Tanmay Inamdar 2014-10-01  514  		writel(bar_low, bar_addr);
5f6b6ccd Tanmay Inamdar 2014-10-01  515  		writel(upper_32_bits(cpu_addr), bar_addr + 0x4);
4ecf6b0f Bjorn Helgaas  2016-10-06  516  		pim_reg = PIM1_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  517  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  518  	case 1:
8e93c513 Bjorn Helgaas  2016-10-06  519  		xgene_pcie_writel(port, IBAR2, bar_low);
8e93c513 Bjorn Helgaas  2016-10-06  520  		xgene_pcie_writel(port, IR2MSK, lower_32_bits(mask));
4ecf6b0f Bjorn Helgaas  2016-10-06  521  		pim_reg = PIM2_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  522  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  523  	case 2:
8e93c513 Bjorn Helgaas  2016-10-06  524  		xgene_pcie_writel(port, IBAR3L, bar_low);
8e93c513 Bjorn Helgaas  2016-10-06  525  		xgene_pcie_writel(port, IBAR3L + 0x4, upper_32_bits(cpu_addr));
8e93c513 Bjorn Helgaas  2016-10-06  526  		xgene_pcie_writel(port, IR3MSKL, lower_32_bits(mask));
8e93c513 Bjorn Helgaas  2016-10-06  527  		xgene_pcie_writel(port, IR3MSKL + 0x4, upper_32_bits(mask));
4ecf6b0f Bjorn Helgaas  2016-10-06  528  		pim_reg = PIM3_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  529  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  530  	}
5f6b6ccd Tanmay Inamdar 2014-10-01  531  
4ecf6b0f Bjorn Helgaas  2016-10-06 @532  	xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
5f6b6ccd Tanmay Inamdar 2014-10-01  533  }
5f6b6ccd Tanmay Inamdar 2014-10-01  534  

:::::: The code at line 532 was first introduced by commit
:::::: 4ecf6b0f83523fb186dd1de9e2f1d324a2a413d9 PCI: xgene: Pass struct xgene_pcie_port to setup functions

:::::: TO: Bjorn Helgaas <bhelgaas@google.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59041 bytes --]

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

* Re: [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
@ 2018-05-06  5:50     ` kbuild test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2018-05-06  5:50 UTC (permalink / raw)
  Cc: kbuild-all, yamada.masahiro, michal.lkml, tglx, mingo, akpm,
	rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

[-- Attachment #1: Type: text/plain, Size: 5626 bytes --]

Hi Changbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180506-110946
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/pci/host/pci-xgene.c: In function 'xgene_pcie_setup_ib_reg':
>> drivers/pci/host/pci-xgene.c:532:2: warning: 'pim_reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/scsi/ufs/ufs-qcom.c: In function 'ufs_qcom_testbus_config':
>> drivers/scsi/ufs/ufs-qcom.c:1527:6: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int offset;
         ^~~~~~
>> drivers/scsi/ufs/ufs-qcom.c:1526:6: warning: 'reg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int reg;
         ^~~

vim +/pim_reg +532 drivers/pci/host/pci-xgene.c

5f6b6ccd Tanmay Inamdar 2014-10-01  484  
5f6b6ccd Tanmay Inamdar 2014-10-01  485  static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port,
5f6b6ccd Tanmay Inamdar 2014-10-01  486  				    struct of_pci_range *range, u8 *ib_reg_mask)
5f6b6ccd Tanmay Inamdar 2014-10-01  487  {
5f6b6ccd Tanmay Inamdar 2014-10-01  488  	void __iomem *cfg_base = port->cfg_base;
d963ab22 Bjorn Helgaas  2016-10-06  489  	struct device *dev = port->dev;
5f6b6ccd Tanmay Inamdar 2014-10-01  490  	void *bar_addr;
4ecf6b0f Bjorn Helgaas  2016-10-06  491  	u32 pim_reg;
5f6b6ccd Tanmay Inamdar 2014-10-01  492  	u64 cpu_addr = range->cpu_addr;
5f6b6ccd Tanmay Inamdar 2014-10-01  493  	u64 pci_addr = range->pci_addr;
5f6b6ccd Tanmay Inamdar 2014-10-01  494  	u64 size = range->size;
5f6b6ccd Tanmay Inamdar 2014-10-01  495  	u64 mask = ~(size - 1) | EN_REG;
5f6b6ccd Tanmay Inamdar 2014-10-01  496  	u32 flags = PCI_BASE_ADDRESS_MEM_TYPE_64;
5f6b6ccd Tanmay Inamdar 2014-10-01  497  	u32 bar_low;
5f6b6ccd Tanmay Inamdar 2014-10-01  498  	int region;
5f6b6ccd Tanmay Inamdar 2014-10-01  499  
5f6b6ccd Tanmay Inamdar 2014-10-01  500  	region = xgene_pcie_select_ib_reg(ib_reg_mask, range->size);
5f6b6ccd Tanmay Inamdar 2014-10-01  501  	if (region < 0) {
d963ab22 Bjorn Helgaas  2016-10-06  502  		dev_warn(dev, "invalid pcie dma-range config\n");
5f6b6ccd Tanmay Inamdar 2014-10-01  503  		return;
5f6b6ccd Tanmay Inamdar 2014-10-01  504  	}
5f6b6ccd Tanmay Inamdar 2014-10-01  505  
5f6b6ccd Tanmay Inamdar 2014-10-01  506  	if (range->flags & IORESOURCE_PREFETCH)
5f6b6ccd Tanmay Inamdar 2014-10-01  507  		flags |= PCI_BASE_ADDRESS_MEM_PREFETCH;
5f6b6ccd Tanmay Inamdar 2014-10-01  508  
5f6b6ccd Tanmay Inamdar 2014-10-01  509  	bar_low = pcie_bar_low_val((u32)cpu_addr, flags);
5f6b6ccd Tanmay Inamdar 2014-10-01  510  	switch (region) {
5f6b6ccd Tanmay Inamdar 2014-10-01  511  	case 0:
4ecf6b0f Bjorn Helgaas  2016-10-06  512  		xgene_pcie_set_ib_mask(port, BRIDGE_CFG_4, flags, size);
5f6b6ccd Tanmay Inamdar 2014-10-01  513  		bar_addr = cfg_base + PCI_BASE_ADDRESS_0;
5f6b6ccd Tanmay Inamdar 2014-10-01  514  		writel(bar_low, bar_addr);
5f6b6ccd Tanmay Inamdar 2014-10-01  515  		writel(upper_32_bits(cpu_addr), bar_addr + 0x4);
4ecf6b0f Bjorn Helgaas  2016-10-06  516  		pim_reg = PIM1_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  517  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  518  	case 1:
8e93c513 Bjorn Helgaas  2016-10-06  519  		xgene_pcie_writel(port, IBAR2, bar_low);
8e93c513 Bjorn Helgaas  2016-10-06  520  		xgene_pcie_writel(port, IR2MSK, lower_32_bits(mask));
4ecf6b0f Bjorn Helgaas  2016-10-06  521  		pim_reg = PIM2_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  522  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  523  	case 2:
8e93c513 Bjorn Helgaas  2016-10-06  524  		xgene_pcie_writel(port, IBAR3L, bar_low);
8e93c513 Bjorn Helgaas  2016-10-06  525  		xgene_pcie_writel(port, IBAR3L + 0x4, upper_32_bits(cpu_addr));
8e93c513 Bjorn Helgaas  2016-10-06  526  		xgene_pcie_writel(port, IR3MSKL, lower_32_bits(mask));
8e93c513 Bjorn Helgaas  2016-10-06  527  		xgene_pcie_writel(port, IR3MSKL + 0x4, upper_32_bits(mask));
4ecf6b0f Bjorn Helgaas  2016-10-06  528  		pim_reg = PIM3_1L;
5f6b6ccd Tanmay Inamdar 2014-10-01  529  		break;
5f6b6ccd Tanmay Inamdar 2014-10-01  530  	}
5f6b6ccd Tanmay Inamdar 2014-10-01  531  
4ecf6b0f Bjorn Helgaas  2016-10-06 @532  	xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1));
5f6b6ccd Tanmay Inamdar 2014-10-01  533  }
5f6b6ccd Tanmay Inamdar 2014-10-01  534  

:::::: The code at line 532 was first introduced by commit
:::::: 4ecf6b0f83523fb186dd1de9e2f1d324a2a413d9 PCI: xgene: Pass struct xgene_pcie_port to setup functions

:::::: TO: Bjorn Helgaas <bhelgaas@google.com>
:::::: CC: Bjorn Helgaas <bhelgaas@google.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59041 bytes --]

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

* Re: [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
  2018-05-06  0:20 ` [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations changbin.du
@ 2018-05-06  6:15     ` kbuild test robot
  2018-05-06  6:15     ` kbuild test robot
  1 sibling, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2018-05-06  6:15 UTC (permalink / raw)
  To: changbin.du
  Cc: kbuild-all, yamada.masahiro, michal.lkml, tglx, mingo, akpm,
	rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

[-- Attachment #1: Type: text/plain, Size: 18596 bytes --]

Hi Changbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180506-110946
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   arch/x86/entry/vsyscall/vsyscall_64.c: In function 'emulate_vsyscall':
>> arch/x86/entry/vsyscall/vsyscall_64.c:127:19: warning: 'syscall_nr' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int vsyscall_nr, syscall_nr, tmp;
                      ^~~~~~~~~~

vim +/syscall_nr +127 arch/x86/entry/vsyscall/vsyscall_64.c

4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  122  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  123  bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  124  {
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  125  	struct task_struct *tsk;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  126  	unsigned long caller;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01 @127  	int vsyscall_nr, syscall_nr, tmp;
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  128  	int prev_sig_on_uaccess_err;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  129  	long ret;
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  130  	unsigned long orig_dx;
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  131  
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  132  	/*
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  133  	 * No point in checking CS -- the only way to get here is a user mode
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  134  	 * trap to a high address, which means that we're in 64-bit user code.
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  135  	 */
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  136  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  137  	WARN_ON_ONCE(address != regs->ip);
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  138  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  139  	if (vsyscall_mode == NONE) {
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  140  		warn_bad_vsyscall(KERN_INFO, regs,
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  141  				  "vsyscall attempted with vsyscall=none");
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  142  		return false;
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  143  	}
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  144  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  145  	vsyscall_nr = addr_to_vsyscall_nr(address);
c149a665 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-03  146  
c149a665 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-03  147  	trace_emulate_vsyscall(vsyscall_nr);
c149a665 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-03  148  
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  149  	if (vsyscall_nr < 0) {
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  150  		warn_bad_vsyscall(KERN_WARNING, regs,
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  151  				  "misaligned vsyscall (exploit attempt or buggy program) -- look up the vsyscall kernel parameter if you need a workaround");
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  152  		goto sigsegv;
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  153  	}
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  154  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  155  	if (get_user(caller, (unsigned long __user *)regs->sp) != 0) {
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  156  		warn_bad_vsyscall(KERN_WARNING, regs,
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  157  				  "vsyscall with bad stack (exploit attempt?)");
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  158  		goto sigsegv;
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  159  	}
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  160  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  161  	tsk = current;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  162  
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  163  	/*
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  164  	 * Check for access_ok violations and find the syscall nr.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  165  	 *
46ed99d1 arch/x86/kernel/vsyscall_64.c         Emil Goode        2012-04-01  166  	 * NULL is a valid user pointer (in the access_ok sense) on 32-bit and
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  167  	 * 64-bit, so we don't need to special-case it here.  For all the
46ed99d1 arch/x86/kernel/vsyscall_64.c         Emil Goode        2012-04-01  168  	 * vsyscalls, NULL means "don't write anything" not "write it at
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  169  	 * address 0".
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  170  	 */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  171  	switch (vsyscall_nr) {
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  172  	case 0:
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  173  		if (!write_ok_or_segv(regs->di, sizeof(struct timeval)) ||
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  174  		    !write_ok_or_segv(regs->si, sizeof(struct timezone))) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  175  			ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  176  			goto check_fault;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  177  		}
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  178  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  179  		syscall_nr = __NR_gettimeofday;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  180  		break;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  181  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  182  	case 1:
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  183  		if (!write_ok_or_segv(regs->di, sizeof(time_t))) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  184  			ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  185  			goto check_fault;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  186  		}
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  187  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  188  		syscall_nr = __NR_time;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  189  		break;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  190  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  191  	case 2:
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  192  		if (!write_ok_or_segv(regs->di, sizeof(unsigned)) ||
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  193  		    !write_ok_or_segv(regs->si, sizeof(unsigned))) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  194  			ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  195  			goto check_fault;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  196  		}
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  197  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  198  		syscall_nr = __NR_getcpu;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  199  		break;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  200  	}
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  201  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  202  	/*
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  203  	 * Handle seccomp.  regs->ip must be the original value.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  204  	 * See seccomp_send_sigsys and Documentation/prctl/seccomp_filter.txt.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  205  	 *
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  206  	 * We could optimize the seccomp disabled case, but performance
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  207  	 * here doesn't matter.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  208  	 */
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  209  	regs->orig_ax = syscall_nr;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  210  	regs->ax = -ENOSYS;
2f275de5 arch/x86/entry/vsyscall/vsyscall_64.c Andy Lutomirski   2016-05-27  211  	tmp = secure_computing(NULL);
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  212  	if ((!tmp && regs->orig_ax != syscall_nr) || regs->ip != address) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  213  		warn_bad_vsyscall(KERN_DEBUG, regs,
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  214  				  "seccomp tried to change syscall nr or ip");
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  215  		do_exit(SIGSYS);
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  216  	}
26893107 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2014-11-04  217  	regs->orig_ax = -1;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  218  	if (tmp)
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  219  		goto do_ret;  /* skip requested */
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  220  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  221  	/*
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  222  	 * With a real vsyscall, page faults cause SIGSEGV.  We want to
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  223  	 * preserve that behavior to make writing exploits harder.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  224  	 */
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  225  	prev_sig_on_uaccess_err = current->thread.sig_on_uaccess_err;
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  226  	current->thread.sig_on_uaccess_err = 1;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  227  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  228  	ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  229  	switch (vsyscall_nr) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  230  	case 0:
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  231  		/* this decodes regs->di and regs->si on its own */
d5a00528 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-09  232  		ret = __x64_sys_gettimeofday(regs);
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  233  		break;
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  234  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  235  	case 1:
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  236  		/* this decodes regs->di on its own */
d5a00528 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-09  237  		ret = __x64_sys_time(regs);
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  238  		break;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  239  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  240  	case 2:
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  241  		/* while we could clobber regs->dx, we didn't in the past... */
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  242  		orig_dx = regs->dx;
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  243  		regs->dx = 0;
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  244  		/* this decodes regs->di, regs->si and regs->dx on its own */
d5a00528 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-09  245  		ret = __x64_sys_getcpu(regs);
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  246  		regs->dx = orig_dx;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  247  		break;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  248  	}
8c73626a arch/x86/kernel/vsyscall_64.c         John Stultz       2010-07-13  249  
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  250  	current->thread.sig_on_uaccess_err = prev_sig_on_uaccess_err;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  251  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  252  check_fault:
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  253  	if (ret == -EFAULT) {
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  254  		/* Bad news -- userspace fed a bad pointer to a vsyscall. */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  255  		warn_bad_vsyscall(KERN_INFO, regs,
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  256  				  "vsyscall fault (exploit attempt?)");
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  257  
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  258  		/*
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  259  		 * If we failed to generate a signal for any reason,
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  260  		 * generate one here.  (This should be impossible.)
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  261  		 */
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  262  		if (WARN_ON_ONCE(!sigismember(&tsk->pending.signal, SIGBUS) &&
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  263  				 !sigismember(&tsk->pending.signal, SIGSEGV)))
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  264  			goto sigsegv;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  265  
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  266  		return true;  /* Don't emulate the ret. */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  267  	}
8c73626a arch/x86/kernel/vsyscall_64.c         John Stultz       2010-07-13  268  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  269  	regs->ax = ret;
8c73626a arch/x86/kernel/vsyscall_64.c         John Stultz       2010-07-13  270  
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  271  do_ret:
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  272  	/* Emulate a ret instruction. */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  273  	regs->ip = caller;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  274  	regs->sp += 8;
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  275  	return true;
c08c8205 arch/x86_64/kernel/vsyscall.c         Vojtech Pavlik    2006-09-26  276  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  277  sigsegv:
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  278  	force_sig(SIGSEGV, current);
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  279  	return true;
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  280  }
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  281  

:::::: The code at line 127 was first introduced by commit
:::::: 87b526d349b04c31d7b3a40b434eb3f825d22305 seccomp: Make syscall skipping and nr changes more consistent

:::::: TO: Andy Lutomirski <luto@amacapital.net>
:::::: CC: James Morris <james.l.morris@oracle.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63105 bytes --]

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

* Re: [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations
@ 2018-05-06  6:15     ` kbuild test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2018-05-06  6:15 UTC (permalink / raw)
  Cc: kbuild-all, yamada.masahiro, michal.lkml, tglx, mingo, akpm,
	rostedt, rdunlap, x86, lgirdwood, broonie, arnd, linux-kbuild,
	linux-kernel, linux-arch, Changbin Du

[-- Attachment #1: Type: text/plain, Size: 18596 bytes --]

Hi Changbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180506-110946
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   arch/x86/entry/vsyscall/vsyscall_64.c: In function 'emulate_vsyscall':
>> arch/x86/entry/vsyscall/vsyscall_64.c:127:19: warning: 'syscall_nr' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int vsyscall_nr, syscall_nr, tmp;
                      ^~~~~~~~~~

vim +/syscall_nr +127 arch/x86/entry/vsyscall/vsyscall_64.c

4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  122  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  123  bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  124  {
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  125  	struct task_struct *tsk;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  126  	unsigned long caller;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01 @127  	int vsyscall_nr, syscall_nr, tmp;
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  128  	int prev_sig_on_uaccess_err;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  129  	long ret;
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  130  	unsigned long orig_dx;
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  131  
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  132  	/*
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  133  	 * No point in checking CS -- the only way to get here is a user mode
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  134  	 * trap to a high address, which means that we're in 64-bit user code.
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  135  	 */
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  136  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  137  	WARN_ON_ONCE(address != regs->ip);
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  138  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  139  	if (vsyscall_mode == NONE) {
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  140  		warn_bad_vsyscall(KERN_INFO, regs,
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  141  				  "vsyscall attempted with vsyscall=none");
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  142  		return false;
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  143  	}
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  144  
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  145  	vsyscall_nr = addr_to_vsyscall_nr(address);
c149a665 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-03  146  
c149a665 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-03  147  	trace_emulate_vsyscall(vsyscall_nr);
c149a665 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-03  148  
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  149  	if (vsyscall_nr < 0) {
c9712944 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-07-13  150  		warn_bad_vsyscall(KERN_WARNING, regs,
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  151  				  "misaligned vsyscall (exploit attempt or buggy program) -- look up the vsyscall kernel parameter if you need a workaround");
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  152  		goto sigsegv;
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  153  	}
7460ed28 arch/x86_64/kernel/vsyscall.c         John Stultz       2007-02-16  154  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  155  	if (get_user(caller, (unsigned long __user *)regs->sp) != 0) {
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  156  		warn_bad_vsyscall(KERN_WARNING, regs,
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  157  				  "vsyscall with bad stack (exploit attempt?)");
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  158  		goto sigsegv;
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  159  	}
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  160  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  161  	tsk = current;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  162  
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  163  	/*
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  164  	 * Check for access_ok violations and find the syscall nr.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  165  	 *
46ed99d1 arch/x86/kernel/vsyscall_64.c         Emil Goode        2012-04-01  166  	 * NULL is a valid user pointer (in the access_ok sense) on 32-bit and
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  167  	 * 64-bit, so we don't need to special-case it here.  For all the
46ed99d1 arch/x86/kernel/vsyscall_64.c         Emil Goode        2012-04-01  168  	 * vsyscalls, NULL means "don't write anything" not "write it at
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  169  	 * address 0".
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  170  	 */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  171  	switch (vsyscall_nr) {
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  172  	case 0:
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  173  		if (!write_ok_or_segv(regs->di, sizeof(struct timeval)) ||
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  174  		    !write_ok_or_segv(regs->si, sizeof(struct timezone))) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  175  			ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  176  			goto check_fault;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  177  		}
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  178  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  179  		syscall_nr = __NR_gettimeofday;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  180  		break;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  181  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  182  	case 1:
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  183  		if (!write_ok_or_segv(regs->di, sizeof(time_t))) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  184  			ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  185  			goto check_fault;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  186  		}
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  187  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  188  		syscall_nr = __NR_time;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  189  		break;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  190  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  191  	case 2:
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  192  		if (!write_ok_or_segv(regs->di, sizeof(unsigned)) ||
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  193  		    !write_ok_or_segv(regs->si, sizeof(unsigned))) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  194  			ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  195  			goto check_fault;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  196  		}
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  197  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  198  		syscall_nr = __NR_getcpu;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  199  		break;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  200  	}
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  201  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  202  	/*
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  203  	 * Handle seccomp.  regs->ip must be the original value.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  204  	 * See seccomp_send_sigsys and Documentation/prctl/seccomp_filter.txt.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  205  	 *
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  206  	 * We could optimize the seccomp disabled case, but performance
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  207  	 * here doesn't matter.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  208  	 */
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  209  	regs->orig_ax = syscall_nr;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  210  	regs->ax = -ENOSYS;
2f275de5 arch/x86/entry/vsyscall/vsyscall_64.c Andy Lutomirski   2016-05-27  211  	tmp = secure_computing(NULL);
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  212  	if ((!tmp && regs->orig_ax != syscall_nr) || regs->ip != address) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  213  		warn_bad_vsyscall(KERN_DEBUG, regs,
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  214  				  "seccomp tried to change syscall nr or ip");
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  215  		do_exit(SIGSYS);
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  216  	}
26893107 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2014-11-04  217  	regs->orig_ax = -1;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  218  	if (tmp)
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  219  		goto do_ret;  /* skip requested */
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  220  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  221  	/*
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  222  	 * With a real vsyscall, page faults cause SIGSEGV.  We want to
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  223  	 * preserve that behavior to make writing exploits harder.
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  224  	 */
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  225  	prev_sig_on_uaccess_err = current->thread.sig_on_uaccess_err;
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  226  	current->thread.sig_on_uaccess_err = 1;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  227  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  228  	ret = -EFAULT;
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  229  	switch (vsyscall_nr) {
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  230  	case 0:
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  231  		/* this decodes regs->di and regs->si on its own */
d5a00528 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-09  232  		ret = __x64_sys_gettimeofday(regs);
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  233  		break;
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  234  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  235  	case 1:
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  236  		/* this decodes regs->di on its own */
d5a00528 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-09  237  		ret = __x64_sys_time(regs);
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  238  		break;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  239  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  240  	case 2:
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  241  		/* while we could clobber regs->dx, we didn't in the past... */
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  242  		orig_dx = regs->dx;
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  243  		regs->dx = 0;
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  244  		/* this decodes regs->di, regs->si and regs->dx on its own */
d5a00528 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-09  245  		ret = __x64_sys_getcpu(regs);
fa697140 arch/x86/entry/vsyscall/vsyscall_64.c Dominik Brodowski 2018-04-05  246  		regs->dx = orig_dx;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  247  		break;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  248  	}
8c73626a arch/x86/kernel/vsyscall_64.c         John Stultz       2010-07-13  249  
2a53ccbc arch/x86/entry/vsyscall/vsyscall_64.c Ingo Molnar       2016-07-15  250  	current->thread.sig_on_uaccess_err = prev_sig_on_uaccess_err;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  251  
87b526d3 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2012-10-01  252  check_fault:
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  253  	if (ret == -EFAULT) {
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  254  		/* Bad news -- userspace fed a bad pointer to a vsyscall. */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  255  		warn_bad_vsyscall(KERN_INFO, regs,
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  256  				  "vsyscall fault (exploit attempt?)");
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  257  
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  258  		/*
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  259  		 * If we failed to generate a signal for any reason,
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  260  		 * generate one here.  (This should be impossible.)
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  261  		 */
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  262  		if (WARN_ON_ONCE(!sigismember(&tsk->pending.signal, SIGBUS) &&
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  263  				 !sigismember(&tsk->pending.signal, SIGSEGV)))
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  264  			goto sigsegv;
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  265  
4fc34901 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-11-07  266  		return true;  /* Don't emulate the ret. */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  267  	}
8c73626a arch/x86/kernel/vsyscall_64.c         John Stultz       2010-07-13  268  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  269  	regs->ax = ret;
8c73626a arch/x86/kernel/vsyscall_64.c         John Stultz       2010-07-13  270  
5651721e arch/x86/kernel/vsyscall_64.c         Will Drewry       2012-07-13  271  do_ret:
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  272  	/* Emulate a ret instruction. */
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  273  	regs->ip = caller;
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  274  	regs->sp += 8;
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  275  	return true;
c08c8205 arch/x86_64/kernel/vsyscall.c         Vojtech Pavlik    2006-09-26  276  
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  277  sigsegv:
5cec93c2 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-06-05  278  	force_sig(SIGSEGV, current);
3ae36655 arch/x86/kernel/vsyscall_64.c         Andy Lutomirski   2011-08-10  279  	return true;
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  280  }
^1da177e arch/x86_64/kernel/vsyscall.c         Linus Torvalds    2005-04-16  281  

:::::: The code at line 127 was first introduced by commit
:::::: 87b526d349b04c31d7b3a40b434eb3f825d22305 seccomp: Make syscall skipping and nr changes more consistent

:::::: TO: Andy Lutomirski <luto@amacapital.net>
:::::: CC: James Morris <james.l.morris@oracle.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63105 bytes --]

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

* Re: [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node
  2018-05-09  8:21   ` Mark Brown
@ 2018-05-09  8:13     ` Du, Changbin
  2018-05-09  8:39       ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Du, Changbin @ 2018-05-09  8:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: changbin.du, yamada.masahiro, michal.lkml, tglx, mingo, akpm,
	rostedt, rdunlap, x86, lgirdwood, arnd, linux-kbuild,
	linux-kernel, linux-arch

On Wed, May 09, 2018 at 05:21:14PM +0900, Mark Brown wrote:
> On Sun, May 06, 2018 at 08:20:13AM +0800, changbin.du@intel.com wrote:
> > From: Changbin Du <changbin.du@intel.com>
> > 
> > If device tree is not enabled, of_find_regulator_by_node() should have
> > a dummy function since the function call is still there.
> 
> Please do not submit new versions of already applied patches, please
> submit incremental updates to the existing code.  Modifying existing
> commits creates problems for other users building on top of those
> commits so it's best practice to only change pubished git commits if
> absolutely essential.

Hmm, I saw your merging notification too late. Let me refresh the series. Sorry
for confusing.

-- 
Thanks,
Changbin Du

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

* Re: [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node
  2018-05-06  0:20 ` [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node changbin.du
@ 2018-05-09  8:21   ` Mark Brown
  2018-05-09  8:13     ` Du, Changbin
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2018-05-09  8:21 UTC (permalink / raw)
  To: changbin.du
  Cc: yamada.masahiro, michal.lkml, tglx, mingo, akpm, rostedt,
	rdunlap, x86, lgirdwood, arnd, linux-kbuild, linux-kernel,
	linux-arch

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

On Sun, May 06, 2018 at 08:20:13AM +0800, changbin.du@intel.com wrote:
> From: Changbin Du <changbin.du@intel.com>
> 
> If device tree is not enabled, of_find_regulator_by_node() should have
> a dummy function since the function call is still there.

Please do not submit new versions of already applied patches, please
submit incremental updates to the existing code.  Modifying existing
commits creates problems for other users building on top of those
commits so it's best practice to only change pubished git commits if
absolutely essential.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node
  2018-05-09  8:13     ` Du, Changbin
@ 2018-05-09  8:39       ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2018-05-09  8:39 UTC (permalink / raw)
  To: Du, Changbin
  Cc: yamada.masahiro, michal.lkml, tglx, mingo, akpm, rostedt,
	rdunlap, x86, lgirdwood, arnd, linux-kbuild, linux-kernel,
	linux-arch

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

On Wed, May 09, 2018 at 04:13:42PM +0800, Du, Changbin wrote:
> On Wed, May 09, 2018 at 05:21:14PM +0900, Mark Brown wrote:

> > Please do not submit new versions of already applied patches, please
> > submit incremental updates to the existing code.  Modifying existing
> > commits creates problems for other users building on top of those
> > commits so it's best practice to only change pubished git commits if
> > absolutely essential.

> Hmm, I saw your merging notification too late. Let me refresh the series. Sorry
> for confusing.

No problem, just wanted to make sure I wasn't missing any updates from
this new version.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-05-09  8:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-06  0:20 [PATCH v3 0/5] kernel hacking: GCC optimization for better debug experience (-Og) changbin.du
2018-05-06  0:20 ` [PATCH v3 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif changbin.du
2018-05-06  0:20 ` [PATCH v3 2/5] regulator: add dummy function of_find_regulator_by_node changbin.du
2018-05-09  8:21   ` Mark Brown
2018-05-09  8:13     ` Du, Changbin
2018-05-09  8:39       ` Mark Brown
2018-05-06  0:20 ` [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations changbin.du
2018-05-06  5:50   ` kbuild test robot
2018-05-06  5:50     ` kbuild test robot
2018-05-06  5:50     ` kbuild test robot
2018-05-06  6:15   ` kbuild test robot
2018-05-06  6:15     ` kbuild test robot
2018-05-06  0:20 ` [PATCH v3 4/5] kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og optimization changbin.du
2018-05-06  0:20 ` [PATCH v3 5/5] asm-generic: fix build error in fix_to_virt with CONFIG_CC_OPTIMIZE_FOR_DEBUGGING changbin.du

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.