2008-07-01 15:25:35

by Alexander Beregalov

[permalink] [raw]
Subject: next-0630: sparc64: build failed

Hi David, Abhishek

$ make CROSS_COMPILE=sparc64-unknown-linux-gnu- image modules && sudo
make modules_install
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
dnsdomainname: Unknown host
CC arch/sparc64/kernel/sparc64_ksyms.o
arch/sparc64/kernel/sparc64_ksyms.c:116: error: '_mcount' undeclared
here (not in a function)
cc1: warnings being treated as errors
arch/sparc64/kernel/sparc64_ksyms.c:116: error: type defaults to 'int'
in declaration of '_mcount'

This commit is cause.

commit 395a59d0f8e86bb39cd700c3d185d30c670bb958
Author: Abhishek Sagar <[email protected]>
Date: Sat Jun 21 23:47:27 2008 +0530

ftrace: store mcount address in rec->ip

Record the address of the mcount call-site. Currently all archs
except sparc64
record the address of the instruction following the mcount call-site. Some
general cleanups are entailed. Storing mcount addresses in rec->ip enables
looking them up in the kprobe hash table later on to check if
they're kprobe'd.

Signed-off-by: Abhishek Sagar <[email protected]>
Cc: [email protected]
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>

diff --git a/arch/sparc64/kernel/sparc64_ksyms.c
b/arch/sparc64/kernel/sparc64_ksyms.c
index 8ac0b99..b80d982 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -53,6 +53,7 @@
#include <asm/ns87303.h>
#include <asm/timer.h>
#include <asm/cpudata.h>
+#include <asm/ftrace.h>

struct poll {
int fd;
@@ -112,7 +113,6 @@ EXPORT_SYMBOL(smp_call_function);
#endif /* CONFIG_SMP */

#if defined(CONFIG_MCOUNT)
-extern void _mcount(void);
EXPORT_SYMBOL(_mcount);
#endif


gcc version 4.3.1 (Gentoo 4.3.1 p1.0)


2008-07-01 15:47:19

by Ingo Molnar

[permalink] [raw]
Subject: Re: next-0630: sparc64: build failed


* Alexander Beregalov <[email protected]> wrote:

> Hi David, Abhishek
>
> $ make CROSS_COMPILE=sparc64-unknown-linux-gnu- image modules && sudo
> make modules_install
> CHK include/linux/version.h
> CHK include/linux/utsrelease.h
> CALL scripts/checksyscalls.sh
> CHK include/linux/compile.h
> dnsdomainname: Unknown host
> CC arch/sparc64/kernel/sparc64_ksyms.o
> arch/sparc64/kernel/sparc64_ksyms.c:116: error: '_mcount' undeclared
> here (not in a function)
> cc1: warnings being treated as errors
> arch/sparc64/kernel/sparc64_ksyms.c:116: error: type defaults to 'int'
> in declaration of '_mcount'
>
> This commit is cause.
>
> commit 395a59d0f8e86bb39cd700c3d185d30c670bb958
> Author: Abhishek Sagar <[email protected]>
> Date: Sat Jun 21 23:47:27 2008 +0530
>
> ftrace: store mcount address in rec->ip

thanks Alexander - does the patch below fix it for you?

Ingo

---------------->
commit 760378e1497841246ea7e42abad617d8a8ac0bcc
Author: Ingo Molnar <[email protected]>
Date: Tue Jul 1 17:35:06 2008 +0200

fix "ftrace: store mcount address in rec->ip"

Alexander Beregalov reported this build failure:

$ make CROSS_COMPILE=sparc64-unknown-linux-gnu- image modules && sudo
make modules_install
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
dnsdomainname: Unknown host
CC arch/sparc64/kernel/sparc64_ksyms.o
arch/sparc64/kernel/sparc64_ksyms.c:116: error: '_mcount' undeclared
here (not in a function)
cc1: warnings being treated as errors
arch/sparc64/kernel/sparc64_ksyms.c:116: error: type defaults to 'int'
in declaration of '_mcount'

And bisected it back to:

| commit 395a59d0f8e86bb39cd700c3d185d30c670bb958
| Author: Abhishek Sagar <[email protected]>
| Date: Sat Jun 21 23:47:27 2008 +0530
|
| ftrace: store mcount address in rec->ip

the mcount prototype is only available under CONFIG_FTRACE,
extend it to CONFIG_MCOUNT as well.

Reported-and-bisected-by: Alexander Beregalov <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>

diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index b80d982..49d3ea5 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -112,7 +112,7 @@ EXPORT_SYMBOL(__write_trylock);
EXPORT_SYMBOL(smp_call_function);
#endif /* CONFIG_SMP */

-#if defined(CONFIG_MCOUNT)
+#ifdef CONFIG_MCOUNT
EXPORT_SYMBOL(_mcount);
#endif

diff --git a/include/asm-sparc64/ftrace.h b/include/asm-sparc64/ftrace.h
index f76a40a..d27716c 100644
--- a/include/asm-sparc64/ftrace.h
+++ b/include/asm-sparc64/ftrace.h
@@ -1,7 +1,7 @@
#ifndef _ASM_SPARC64_FTRACE
#define _ASM_SPARC64_FTRACE

-#ifdef CONFIG_FTRACE
+#ifdef CONFIG_MCOUNT
#define MCOUNT_ADDR ((long)(_mcount))
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */

2008-07-01 18:50:19

by Abhishek Sagar

[permalink] [raw]
Subject: Re: next-0630: sparc64: build failed

Ingo Molnar wrote:
> Alexander Beregalov reported this build failure:
>
> $ make CROSS_COMPILE=sparc64-unknown-linux-gnu- image modules && sudo
> make modules_install
> CHK include/linux/version.h
> CHK include/linux/utsrelease.h
> CALL scripts/checksyscalls.sh
> CHK include/linux/compile.h
> dnsdomainname: Unknown host
> CC arch/sparc64/kernel/sparc64_ksyms.o
> arch/sparc64/kernel/sparc64_ksyms.c:116: error: '_mcount' undeclared
> here (not in a function)
> cc1: warnings being treated as errors
> arch/sparc64/kernel/sparc64_ksyms.c:116: error: type defaults to 'int'
> in declaration of '_mcount'
>
> And bisected it back to:
>
> | commit 395a59d0f8e86bb39cd700c3d185d30c670bb958
> | Author: Abhishek Sagar <[email protected]>
> | Date: Sat Jun 21 23:47:27 2008 +0530
> |
> | ftrace: store mcount address in rec->ip
>
> the mcount prototype is only available under CONFIG_FTRACE,
> extend it to CONFIG_MCOUNT as well.
>
> Reported-and-bisected-by: Alexander Beregalov <[email protected]>
> Signed-off-by: Ingo Molnar <[email protected]>

Hi Ingo/David,

CONFIG_MCOUNT currently controls the compilation with -pg flag and the export
of _mcount. But with ftrace, the former is redundant and the latter should be
made unconditional since _mcount is always defined. In which case, does the
inlined patch (untested) make sense? It should solve the build failure as well.

[for tip/master]

Signed-off-by: Abhishek Sagar <[email protected]>
---
sparc64: get rid of CONFIG_MCOUNT

There are two possible (not necessarily exclusive) uses of the _mcount call:
1. To do stack usage debugging.
2. Function tracing.

Both have separate CONFIG_* options and don't require an alias such as
CONFIG_MCOUNT.

diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index d6d32d1..6065be7 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -31,11 +31,6 @@ config DEBUG_PAGEALLOC
This results in a large slowdown, but helps to find certain types
of memory corruptions.

-config MCOUNT
- bool
- depends on STACK_DEBUG || FTRACE
- default y
-
config FRAME_POINTER
bool
depends on MCOUNT
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index 4b8f2b0..c182e5c 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -19,8 +19,10 @@ KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs

-ifeq ($(CONFIG_MCOUNT),y)
- KBUILD_CFLAGS += -pg
+ifneq ($(CONFIG_FTRACE),y)
+ifeq ($(CONFIG_STACK_DEBUG),y)
+KBUILD_CFLAGS += -pg
+endif
endif

head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index b80d982..13c243c 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -112,10 +112,7 @@ EXPORT_SYMBOL(__write_trylock);
EXPORT_SYMBOL(smp_call_function);
#endif /* CONFIG_SMP */

-#if defined(CONFIG_MCOUNT)
EXPORT_SYMBOL(_mcount);
-#endif
-
EXPORT_SYMBOL(sparc64_get_clock_tick);

/* RW semaphores */
diff --git a/include/asm-sparc64/ftrace.h b/include/asm-sparc64/ftrace.h
index f76a40a..51036c3 100644
--- a/include/asm-sparc64/ftrace.h
+++ b/include/asm-sparc64/ftrace.h
@@ -4,11 +4,10 @@
#ifdef CONFIG_FTRACE
#define MCOUNT_ADDR ((long)(_mcount))
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
+#endif

#ifndef __ASSEMBLY__
extern void _mcount(void);
#endif

-#endif
-
#endif /* _ASM_SPARC64_FTRACE */

2008-07-01 20:04:19

by Ingo Molnar

[permalink] [raw]
Subject: Re: next-0630: sparc64: build failed


* Abhishek Sagar <[email protected]> wrote:

> Hi Ingo/David,
>
> CONFIG_MCOUNT currently controls the compilation with -pg flag and the
> export of _mcount. But with ftrace, the former is redundant and the
> latter should be made unconditional since _mcount is always defined.
> In which case, does the inlined patch (untested) make sense? It should
> solve the build failure as well.

hm, mcount is the facility - so it makes sense to have that defined.
Here you basically hide CONFIG_MCOUNT:

> -ifeq ($(CONFIG_MCOUNT),y)
> - KBUILD_CFLAGS += -pg
> +ifneq ($(CONFIG_FTRACE),y)
> +ifeq ($(CONFIG_STACK_DEBUG),y)
> +KBUILD_CFLAGS += -pg
> +endif
> endif

via two conditions. I'm not sure that's a win and i found CONFIG_MCOUNT
a logical switch - but it's David's call.

Ingo

2008-07-02 04:23:57

by Abhishek Sagar

[permalink] [raw]
Subject: Re: next-0630: sparc64: build failed

On Wed, Jul 2, 2008 at 1:33 AM, Ingo Molnar <[email protected]> wrote:
> hm, mcount is the facility - so it makes sense to have that defined.
> Here you basically hide CONFIG_MCOUNT:
>
>> -ifeq ($(CONFIG_MCOUNT),y)
>> - KBUILD_CFLAGS += -pg
>> +ifneq ($(CONFIG_FTRACE),y)
>> +ifeq ($(CONFIG_STACK_DEBUG),y)
>> +KBUILD_CFLAGS += -pg
>> +endif
>> endif

Even with CONFIG_MCOUNT we'd have to do something like this to prevent
duplicate -pg flags (I hope there's a prettier way of writing this):

ifneq ($(CONFIG_FTRACE),y)
ifeq ($(CONFIG_MCOUNT),y)
KBUILD_CFLAGS += -pg
endif
endif

> via two conditions. I'm not sure that's a win and i found CONFIG_MCOUNT
> a logical switch - but it's David's call.

Ok, but it really doesn't allow end user to switch between anything
through any menu. It gets selected via:

config MCOUNT
bool
depends on STACK_DEBUG || FTRACE
default y


I was attempting to decouple MCOUNT and STACK_DEBUG, which
incidentally made MCOUNT useless.

--
Regards,
Abhishek Sagar

2008-07-02 09:10:18

by Alexander Beregalov

[permalink] [raw]
Subject: Re: next-0630: sparc64: build failed

2008/7/1 Ingo Molnar <[email protected]>:
> thanks Alexander - does the patch below fix it for you?
> commit 760378e1497841246ea7e42abad617d8a8ac0bcc
> Author: Ingo Molnar <[email protected]>
> Date: Tue Jul 1 17:35:06 2008 +0200
>
> fix "ftrace: store mcount address in rec->ip"
>

Yes, it fixes the issue. I have tried next-0702 which already includes
your patch.
But it has a name a1d5d08eb4f5c76acd5bb115e13791ce87ec356b.