Skip to contentSkip to conversation

About ARCH=sparc and what to pass to recordmcount.pl

DISCUSSION Uwe Kleine-König 4 participants 9 messages Aug 15, 2011 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Uwe Kleine-König

#0 lore raw

Hello,

when I enable CONFIG_FUNCTION_TRACER and CONFIG_DYNAMIC_FTRACE for the Debian kernel the build fails with:

CC init/do_mounts_initrd.o
Arch sparc is not supported with CONFIG_FTRACE_MCOUNT_RECORD at .../scripts/recordmcount.pl line 368.

This happens because the kernel package build scripts call

make ARCH=sparc

$(ARCH) is passed to scripts/recordmcount.pl and the latter only knows about "sparc64".

There are several options to fix that:

a) let the package pass ARCH=sparc64 instead of ARCH=sparc Then sparc would be the only architecture that doesn't pass the (Debian) arch here. I'm not sure there are other reasons to stick to ARCH=sparc. Bastian?
It seems only recordmcount.pl chokes on that because Debian uses ARCH=sparc since at least 2.6.32, probably much longer.

b) pass SRCARCH instead of ARCH to recordmcount.pl and do s/sparc64/sparc/ in recordmcount.pl.

c) do the following in recordmcount.pl:

	if ($arch =~ /sparc(32|64)?/) {
	    if ($bits = 64) {
	        $arch = "sparc64";
	    } else {
	        $arch = "sparc"; # or "sparc32"?
	    }
	}

    Something like that is already done for x86.

Personally I prefer b), but I'm not sure I see all the consequences.

What do you think?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#1 lore raw
Quoted 24 lines · Uwe Kleine-König

Hello,

when I enable CONFIG_FUNCTION_TRACER and CONFIG_DYNAMIC_FTRACE for the Debian kernel the build fails with:

CC init/do_mounts_initrd.o
Arch sparc is not supported with CONFIG_FTRACE_MCOUNT_RECORD at .../scripts/recordmcount.pl line 368.

This happens because the kernel package build scripts call

make ARCH=sparc

$(ARCH) is passed to scripts/recordmcount.pl and the latter only knows about "sparc64".

There are several options to fix that:

a) let the package pass ARCH=sparc64 instead of ARCH=sparc Then sparc would be the only architecture that doesn't pass the (Debian) arch here. I'm not sure there are other reasons to stick to ARCH=sparc. Bastian?
It seems only recordmcount.pl chokes on that because Debian uses ARCH=sparc since at least 2.6.32, probably much longer.

Quoted 2 lines

b) pass SRCARCH instead of ARCH to recordmcount.pl and do s/sparc64/sparc/ in recordmcount.pl.

b may break other archs.

Quoted 9 lines

c) do the following in recordmcount.pl:

	if ($arch =~ /sparc(32|64)?/) {
	    if ($bits = 64) {
	        $arch = "sparc64";
	    } else {
	        $arch = "sparc"; # or "sparc32"?
	    }
	}

c is fine with me.

Quoted 4 lines

Something like that is already done for x86.

Personally I prefer b), but I'm not sure I see all the consequences.

It may break other archs. I rather not do a change that affects all archs. This is a sparc specific problem. The solution should only affect sparc. Which to me is option c.

-- Steve

Quoted 6 lines

What do you think?

Best regards
Uwe

#2 lore raw
In reply to Uwe Kleine-König
Quoted 43 lines · Steven Rostedt
Quoted 24 lines · Uwe Kleine-König

Hello,

when I enable CONFIG_FUNCTION_TRACER and CONFIG_DYNAMIC_FTRACE for the Debian kernel the build fails with:

CC init/do_mounts_initrd.o
Arch sparc is not supported with CONFIG_FTRACE_MCOUNT_RECORD at .../scripts/recordmcount.pl line 368.

This happens because the kernel package build scripts call

make ARCH=sparc

$(ARCH) is passed to scripts/recordmcount.pl and the latter only knows about "sparc64".

There are several options to fix that:

a) let the package pass ARCH=sparc64 instead of ARCH=sparc Then sparc would be the only architecture that doesn't pass the (Debian) arch here. I'm not sure there are other reasons to stick to ARCH=sparc. Bastian?
It seems only recordmcount.pl chokes on that because Debian uses ARCH=sparc since at least 2.6.32, probably much longer.

Quoted 2 lines

b) pass SRCARCH instead of ARCH to recordmcount.pl and do s/sparc64/sparc/ in recordmcount.pl.

b may break other archs.

Quoted 9 lines

c) do the following in recordmcount.pl:

	if ($arch =~ /sparc(32|64)?/) {
	    if ($bits = 64) {
	        $arch = "sparc64";
	    } else {
	        $arch = "sparc"; # or "sparc32"?
	    }
	}

c is fine with me.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Something like that is already done for x86.

Personally I prefer b), but I'm not sure I see all the consequences.

It may break other archs. I rather not do a change that affects all archs. This is a sparc specific problem. The solution should only affect sparc. Which to me is option c.

Actually, I think option d) is the best.

d) have sparc support recordmcount.c

-- Steve

#3 lore raw
In reply to Uwe Kleine-König
Quoted 26 lines · Steven Rostedt
Quoted 25 lines · Steven Rostedt
Quoted 24 lines · Uwe Kleine-König

Hello,

when I enable CONFIG_FUNCTION_TRACER and CONFIG_DYNAMIC_FTRACE for the Debian kernel the build fails with:

CC init/do_mounts_initrd.o
Arch sparc is not supported with CONFIG_FTRACE_MCOUNT_RECORD at .../scripts/recordmcount.pl line 368.

This happens because the kernel package build scripts call

make ARCH=sparc

$(ARCH) is passed to scripts/recordmcount.pl and the latter only knows about "sparc64".

There are several options to fix that:

a) let the package pass ARCH=sparc64 instead of ARCH=sparc Then sparc would be the only architecture that doesn't pass the (Debian) arch here. I'm not sure there are other reasons to stick to ARCH=sparc. Bastian?
It seems only recordmcount.pl chokes on that because Debian uses ARCH=sparc since at least 2.6.32, probably much longer.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

b) pass SRCARCH instead of ARCH to recordmcount.pl and do s/sparc64/sparc/ in recordmcount.pl.

b may break other archs.

I think it doesn't, but in the presence of d) below I won't argue.

Quoted 16 lines
Quoted 16 lines
Quoted 8 lines

c) do the following in recordmcount.pl:

	if ($arch =~ /sparc(32|64)?/) {
	    if ($bits = 64) {
	        $arch = "sparc64";
	    } else {
	        $arch = "sparc"; # or "sparc32"?
	    }
	}

c is fine with me.

Quoted 4 lines

Something like that is already done for x86.

Personally I prefer b), but I'm not sure I see all the consequences.

Quoted 8 lines
Quoted 4 lines

It may break other archs. I rather not do a change that affects all archs. This is a sparc specific problem. The solution should only affect sparc. Which to me is option c.

Actually, I think option d) is the best.

d) have sparc support recordmcount.c

I only have access to a sparc chroot without the possibility to make a run test, so if you want to test d), it's just adding

select HAVE_C_RECORDMCOUNT

to config SPARC64. Building a kernel with it seems to work (and should be faster).

If you're lazy and a Debian-sparc user I can provide you a kernel package to test that. Just tell me by private mail.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw
In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König

Hello,

when I enable CONFIG_FUNCTION_TRACER and CONFIG_DYNAMIC_FTRACE for the Debian kernel the build fails with:

CC init/do_mounts_initrd.o
Arch sparc is not supported with CONFIG_FTRACE_MCOUNT_RECORD at .../scripts/recordmcount.pl line 368.

Quoted 6 lines

This happens because the kernel package build scripts call

make ARCH=sparc

$(ARCH) is passed to scripts/recordmcount.pl and the latter only knows about "sparc64".

We are currently overriding ARCH and we set it to be the source architecture name, so that $(ARCH) is always the same as $(SRCARCH).

Quoted 5 lines

There are several options to fix that:

a) let the package pass ARCH=sparc64 instead of ARCH=sparc Then sparc would be the only architecture that doesn't pass the (Debian) arch here.

This is not the case. For example. ARCH=arm and ARCH=x86 do not match the Debian architecture names.

[...]

Quoted 2 lines

b) pass SRCARCH instead of ARCH to recordmcount.pl and do s/sparc64/sparc/ in recordmcount.pl.

[...]

This is probably the right thing to do. As I understand it, architecture variants (32- vs 64-bit, big-endian vs litle-endian) should be distinguished by CONFIG variables now, not by $(ARCH).

However, the names of those CONFIG variables vary between source architectures, so how do we decide what to pass to recordmcount.pl? $(ARCH) is useful in that it provides all that information in a single word.

Ben.

Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus
maintainer
#5 lore raw
In reply to Uwe Kleine-König

From: Steven Rostedt <[email protected]>
Date: Mon, 15 Aug 2011 11:40:23 -0400

Quoted 3 lines

Actually, I think option d) is the best.

d) have sparc support recordmcount.c

Maybe you misunderstand what these guys are doing.

The recordmcount.pl script wants to look at the output of the architecture of the built kernel. It's intimitately tied to the architecture the kernel was built as, it must therefore be invoked with exactly what the kernel was bult with.

These guys are building a 64-bit sparc kernel then trying to use recordmcount.pl with the 32-bit sparc ARCH set.

That can't work.

Next, recordmcount.pl doesn't have 32-bit sparc support because we don't support building the kernel with profiling options enabled for that architecture.

#6 lore raw
In reply to Uwe Kleine-König
Quoted 14 lines · David Miller

From: Steven Rostedt <[email protected]>
Date: Mon, 15 Aug 2011 11:40:23 -0400

Quoted 3 lines

Actually, I think option d) is the best.

d) have sparc support recordmcount.c

Maybe you misunderstand what these guys are doing.

The recordmcount.pl script wants to look at the output of the architecture of the built kernel. It's intimitately tied to the architecture the kernel was built as, it must therefore be invoked with exactly what the kernel was bult with.

Quoted 8 lines

These guys are building a 64-bit sparc kernel then trying to use recordmcount.pl with the 32-bit sparc ARCH set.

That can't work.

Next, recordmcount.pl doesn't have 32-bit sparc support because we don't support building the kernel with profiling options enabled for that architecture.

But if they use recordmcount.c instead, then nothing needs to be done with recordmcount.pl.

recordmcount.c looks at the elf file itself to determine what arch it is for. If this is supported, then everything should work, and you get a faster build of the kernel as an extra bonus.

But sure, if we test recordmcount.pl on all archs, and using the SRCARCH doesn't break anything, then I'm fine with that change too.

-- Steve

maintainer
#7 lore raw
In reply to Uwe Kleine-König

From: Steven Rostedt <[email protected]>
Date: Mon, 15 Aug 2011 15:55:00 -0400

Quoted 6 lines

But if they use recordmcount.c instead, then nothing needs to be done with recordmcount.pl.

recordmcount.c looks at the elf file itself to determine what arch it is for. If this is supported, then everything should work, and you get a faster build of the kernel as an extra bonus.

Looks like it should work as-is, just need to add HAVE_C_RECORDMCOUNT to arch/sparc/Kconfig under SPARC64.

I'll take a look.

But meanwhile, the debian folks should pass the right ARCH down into to build :-)

maintainer
#8 lore raw
In reply to Uwe Kleine-König

From: Steven Rostedt <[email protected]>
Date: Mon, 15 Aug 2011 15:55:00 -0400

Quoted 2 lines

But if they use recordmcount.c instead, then nothing needs to be done with recordmcount.pl.

Thanks again Steven, I'll push the following via the sparc tree.

--------------------
From 178a29600340bef5b13cd4157053679debe35351 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <[email protected]>
Date: Mon, 15 Aug 2011 14:45:17 -0700
Subject: [PATCH] sparc64: Set HAVE_C_RECORDMCOUNT

---
 arch/sparc/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/sparc/Kconfig +1 -0
index 42c67be..1a6f20d 100644
@@ -55,6 +55,7 @@ config SPARC64
 	select PERF_USE_VMALLOC
 	select IRQ_PREFLOW_FASTEOI
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
+	select HAVE_C_RECORDMCOUNT
 
 config ARCH_DEFCONFIG
 	string
Signature · 1 line
1.7.6.401.g6a319