2007-10-11 21:55:18

by Rob Landley

[permalink] [raw]
Subject: User Mode Linux still doesn't build in 2.6.23-final.

[Second try, without clicking "compress" on the file attachment because then
sourceforge's spam filter bounces it.]

---

The User Mode Linux build still breaks for me:

> In file included from include/asm/arch/tlb.h:18,
> from include/asm/tlb.h:4,
> from arch/um/kernel/smp.c:8:
> include/asm-generic/tlb.h: In function ‘tlb_flush_mmu’:
> include/asm-generic/tlb.h:76: error: implicit declaration of function
> ‘release_pages’ include/asm-generic/tlb.h: In function ‘tlb_remove_page’:
> include/asm-generic/tlb.h:105: error: implicit declaration of function
> ‘page_cache_release’ make[1]: *** [arch/um/kernel/smp.o] Error 1
> make: *** [arch/um/kernel] Error 2

I submitted the following patch to fix it to the UML list after 2.6.23-rc3:
http://sourceforge.net/mailarchive/forum.php?thread_name=200708212148.05392.rob%40landley.net&forum_name=user-mode-linux-devel

On september 4, I confirmed that I still needed it to build -rc5:
http://sourceforge.net/mailarchive/message.php?msg_name=200709040737.54516.rob%40landley.net

Guess what? I still need this patch to build the final 2.6.23, months later.

I know it may not be the right fix, but the build breaks for me without this
patch. The .config that breaks is attached. ARCH=um.

---------- Forwarded Message ----------

Subject: [uml-devel] UML doesn't build in 2.6.23-rc3.
Date: Tuesday 21 August 2007
From: Rob Landley <[email protected]>
To: uml-devel <[email protected]>

I fixed it for me with the following patch, just in case anybody else had this
problem:

--- linux-2.6.23-rc3/arch/um/kernel/smp.c 2007-08-12 23:25:24.000000000 -0500
+++ linux-2.6.23-new/arch/um/kernel/smp.c 2007-08-21 21:39:00.000000000 -0500
@@ -5,6 +5,7 @@

#include "linux/percpu.h"
#include "asm/pgalloc.h"
+#include "linux/pagemap.h"
#include "asm/tlb.h"

/* For some reason, mmu_gathers are referenced when CONFIG_SMP is off. */

--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.


Attachments:
(No filename) (2.00 kB)
.config (6.67 kB)
Download all attachments

2007-10-20 01:19:01

by Paolo Giarrusso

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On venerdì 12 ottobre 2007, Rob Landley wrote:
> [Second try, without clicking "compress" on the file attachment because
> then sourceforge's spam filter bounces it.]
>
> ---
>
> The User Mode Linux build still breaks for me:
> > In file included from include/asm/arch/tlb.h:18,
> > from include/asm/tlb.h:4,
> > from arch/um/kernel/smp.c:8:
> > include/asm-generic/tlb.h: In function ‘tlb_flush_mmu’:
> > include/asm-generic/tlb.h:76: error: implicit declaration of function
> > ‘release_pages’ include/asm-generic/tlb.h: In function ‘tlb_remove_page’:
> > include/asm-generic/tlb.h:105: error: implicit declaration of function
> > ‘page_cache_release’ make[1]: *** [arch/um/kernel/smp.o] Error 1
> > make: *** [arch/um/kernel] Error 2
>
> I submitted the following patch to fix it to the UML list after 2.6.23-rc3:
> http://sourceforge.net/mailarchive/forum.php?thread_name=200708212148.05392
>.rob%40landley.net&forum_name=user-mode-linux-devel
>
> On september 4, I confirmed that I still needed it to build -rc5:
> http://sourceforge.net/mailarchive/message.php?msg_name=200709040737.54516.
>rob%40landley.net
>
> Guess what? I still need this patch to build the final 2.6.23, months
> later.
>
> I know it may not be the right fix, but the build breaks for me without
> this patch. The .config that breaks is attached. ARCH=um.

Guess most people are not using SMP right now, and that the error disappears
without that setting - I'm being away for a long while, has SKAS+SMP support
been merged?

However, a quick look at my sources tells otherwise, and git-describe says
that's a v2.6.23-rc6-239-gc2f8289 tree.

So I've no idea...

> ---------- Forwarded Message ----------
>
> Subject: [uml-devel] UML doesn't build in 2.6.23-rc3.
> Date: Tuesday 21 August 2007
> From: Rob Landley <[email protected]>
> To: uml-devel <[email protected]>
>
> I fixed it for me with the following patch, just in case anybody else had
> this problem:
>
> --- linux-2.6.23-rc3/arch/um/kernel/smp.c 2007-08-12 23:25:24.000000000
> -0500 +++ linux-2.6.23-new/arch/um/kernel/smp.c 2007-08-21
> 21:39:00.000000000 -0500 @@ -5,6 +5,7 @@
>
> #include "linux/percpu.h"
> #include "asm/pgalloc.h"
> +#include "linux/pagemap.h"
> #include "asm/tlb.h"
>
> /* For some reason, mmu_gathers are referenced when CONFIG_SMP is off. */



--
"Doh!" (cit.), I've made another mistake!
Paolo Giarrusso, aka Blaisorblade


Attachments:
(No filename) (2.42 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-10-20 11:42:08

by Nix

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On 20 Oct 2007, Paolo Giarrusso told this:
> Guess most people are not using SMP right now, and that the error disappears
> without that setting

It doesn't. It fails with non-SMP as well.

Rob, your patch works for me. (Not that the reboot into 2.6.23.1 was
problem-free: iproute2-071016 fails to understand the `police' action
and also somehow fails to bring up networking well enough for me to
locally NFS-mount my home directories, where 070710 had no trouble.
More on that soon to the appropriate people as soon as I've diagnosed
it...)

2007-10-21 11:52:51

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Sat, Oct 20, 2007 at 12:41:29PM +0100, Nix wrote:
>On 20 Oct 2007, Paolo Giarrusso told this:
>> Guess most people are not using SMP right now, and that the error disappears
>> without that setting
>
>It doesn't. It fails with non-SMP as well.
>

UML still doesn't build on 2.6.23-git16.

Gcc threw out many errors, I put them in the web:
http://wangcong.org/down/errors.txt

My .config is located at:
http://wangcong.org/down/uml_config.bak

Or I missed something?

Regards.

--
May the Source Be With You.

2007-10-21 13:18:28

by Jeff Dike

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Sun, Oct 21, 2007 at 07:48:54PM +0800, WANG Cong wrote:
> UML still doesn't build on 2.6.23-git16.
>
> Gcc threw out many errors, I put them in the web:
> http://wangcong.org/down/errors.txt

Looks like either you need to run mrproper and try again, or maybe
fallout from the x86 merge, with include/asm-um/arch pointing to
include/asm-i386 instead of include/asm-x86. Although I though Al had
UML building in the presence of the x86 merge.

Jeff

--
Work email - jdike at linux dot intel dot com

2007-10-21 13:24:50

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Sun, Oct 21, 2007 at 09:08:48AM -0400, Jeff Dike wrote:
>On Sun, Oct 21, 2007 at 07:48:54PM +0800, WANG Cong wrote:
>> UML still doesn't build on 2.6.23-git16.
>>
>> Gcc threw out many errors, I put them in the web:
>> http://wangcong.org/down/errors.txt
>
>Looks like either you need to run mrproper and try again, or maybe
>fallout from the x86 merge, with include/asm-um/arch pointing to
>include/asm-i386 instead of include/asm-x86. Although I though Al had
>UML building in the presence of the x86 merge.
>

Hi, Jeff!

I have tried `make mrproper' before `make ARCH=um', but it still
failed. ;(

Regards.

--
May the Source Be With You.

2007-10-21 15:44:05

by Al Viro

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Sun, Oct 21, 2007 at 09:20:32PM +0800, WANG Cong wrote:
> On Sun, Oct 21, 2007 at 09:08:48AM -0400, Jeff Dike wrote:
> >On Sun, Oct 21, 2007 at 07:48:54PM +0800, WANG Cong wrote:
> >> UML still doesn't build on 2.6.23-git16.
> >>
> >> Gcc threw out many errors, I put them in the web:
> >> http://wangcong.org/down/errors.txt
> >
> >Looks like either you need to run mrproper and try again, or maybe
> >fallout from the x86 merge, with include/asm-um/arch pointing to
> >include/asm-i386 instead of include/asm-x86. Although I though Al had
> >UML building in the presence of the x86 merge.
> >
>
> Hi, Jeff!
>
> I have tried `make mrproper' before `make ARCH=um', but it still
> failed. ;(

Fallout continues; I've got a preliminary patch for it. Basically, we
need to stop doing -U__i386__ et.al.

diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 0178df3..08433f8 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -9,6 +9,7 @@ ELF_ARCH := $(SUBARCH)
ELF_FORMAT := elf32-$(SUBARCH)
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
HEADER_ARCH := x86
+CHECKFLAGS += -D__i386__

ifeq ("$(origin SUBARCH)", "command line")
ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
@@ -26,8 +27,6 @@ AFLAGS += -DCONFIG_X86_32
CONFIG_X86_32 := y
export CONFIG_X86_32

-ARCH_KERNEL_DEFINES += -U__$(SUBARCH)__ -U$(SUBARCH)
-
# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
include $(srctree)/arch/i386/Makefile.cpu

diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index fe5316f..8ed362f 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -6,12 +6,9 @@ START := 0x60000000

_extra_flags_ = -fno-builtin -m64

-#We #undef __x86_64__ for kernelspace, not for userspace where
-#it's needed for headers to work!
-ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__
KBUILD_CFLAGS += $(_extra_flags_)

-CHECKFLAGS += -m64
+CHECKFLAGS += -m64 -D__x86_64__
KBUILD_AFLAGS += -m64
LDFLAGS += -m elf_x86_64
KBUILD_CPPFLAGS += -m64
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 9326357..96f67d5 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -8,6 +8,7 @@
#include "linux/module.h"
#include "linux/kallsyms.h"
#include "asm/page.h"
+#include "registers.h"
#include "asm/processor.h"
#include "sysrq.h"

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 0e937f6..20070b7 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -41,7 +41,7 @@
*/
static inline int uncached_access(struct file *file, unsigned long addr)
{
-#if defined(__i386__)
+#if defined(__i386__) && !defined(__arch_um__)
/*
* On the PPro and successors, the MTRRs are used to set
* memory types for physical addresses outside main memory,
@@ -57,7 +57,7 @@ static inline int uncached_access(struct file *file, unsigned long addr)
test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
&& addr >= __pa(high_memory);
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) && !defined(__arch_um__)
/*
* This is broken because it can generate memory type aliases,
* which can cause cache corruptions
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c
index 9265761..77a6e4b 100644
--- a/drivers/md/raid6algos.c
+++ b/drivers/md/raid6algos.c
@@ -52,7 +52,7 @@ const struct raid6_calls * const raid6_algos[] = {
&raid6_intx16,
&raid6_intx32,
#endif
-#if defined(__i386__)
+#if defined(__i386__) && !defined(__arch_um__)
&raid6_mmxx1,
&raid6_mmxx2,
&raid6_sse1x1,
@@ -60,7 +60,7 @@ const struct raid6_calls * const raid6_algos[] = {
&raid6_sse2x1,
&raid6_sse2x2,
#endif
-#if defined(__x86_64__)
+#if defined(__x86_64__) && !defined(__arch_um__)
&raid6_sse2x1,
&raid6_sse2x2,
&raid6_sse2x4,
diff --git a/drivers/md/raid6mmx.c b/drivers/md/raid6mmx.c
index 6181a5a..d4e4a1b 100644
--- a/drivers/md/raid6mmx.c
+++ b/drivers/md/raid6mmx.c
@@ -16,7 +16,7 @@
* MMX implementation of RAID-6 syndrome functions
*/

-#if defined(__i386__)
+#if defined(__i386__) && !defined(__arch_um__)

#include "raid6.h"
#include "raid6x86.h"
diff --git a/drivers/md/raid6sse1.c b/drivers/md/raid6sse1.c
index f0a1ba8..0666237 100644
--- a/drivers/md/raid6sse1.c
+++ b/drivers/md/raid6sse1.c
@@ -21,7 +21,7 @@
* worthwhile as a separate implementation.
*/

-#if defined(__i386__)
+#if defined(__i386__) && !defined(__arch_um__)

#include "raid6.h"
#include "raid6x86.h"
diff --git a/drivers/md/raid6sse2.c b/drivers/md/raid6sse2.c
index 0f01976..b034ad8 100644
--- a/drivers/md/raid6sse2.c
+++ b/drivers/md/raid6sse2.c
@@ -17,7 +17,7 @@
*
*/

-#if defined(__i386__) || defined(__x86_64__)
+#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)

#include "raid6.h"
#include "raid6x86.h"
@@ -161,7 +161,7 @@ const struct raid6_calls raid6_sse2x2 = {

#endif

-#ifdef __x86_64__
+#if defined(__x86_64__) && !defined(__arch_um__)

/*
* Unrolled-by-4 SSE2 implementation
diff --git a/drivers/md/raid6x86.h b/drivers/md/raid6x86.h
index 9111950..99fea7a 100644
--- a/drivers/md/raid6x86.h
+++ b/drivers/md/raid6x86.h
@@ -19,7 +19,7 @@
#ifndef LINUX_RAID_RAID6X86_H
#define LINUX_RAID_RAID6X86_H

-#if defined(__i386__) || defined(__x86_64__)
+#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)

#ifdef __KERNEL__ /* Real code */

diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h
index 732c83f..38bd9d9 100644
--- a/include/asm-um/unistd.h
+++ b/include/asm-um/unistd.h
@@ -14,7 +14,6 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]);

#ifdef __KERNEL__
/* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */
-#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_SYS_ALARM
#define __ARCH_WANT_SYS_GETHOSTNAME
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index d2a96cb..cf79853 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -32,18 +32,13 @@
* On x86-64 make the 64bit structure have the same alignment as the
* 32bit structure. This makes 32bit emulation easier.
*
- * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 +
- * 64_BIT adds up to UML/x86_64.
+ * UML/x86_64 needs the same packing as x86_64
*/
#ifdef __x86_64__
#define EPOLL_PACKED __attribute__((packed))
#else
-#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
-#define EPOLL_PACKED __attribute__((packed))
-#else
#define EPOLL_PACKED
#endif
-#endif

struct epoll_event {
__u32 events;
diff --git a/kernel/signal.c b/kernel/signal.c
index 1200630..4537bdd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -732,7 +732,7 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
printk("%s/%d: potentially unexpected fatal signal %d.\n",
current->comm, task_pid_nr(current), signr);

-#ifdef __i386__
+#if defined(__i386__) && !defined(__arch_um__)
printk("code at %08lx: ", regs->eip);
{
int i;

2007-10-22 04:41:48

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Sun, Oct 21, 2007 at 04:43:46PM +0100, Al Viro wrote:
>On Sun, Oct 21, 2007 at 09:20:32PM +0800, WANG Cong wrote:
>> On Sun, Oct 21, 2007 at 09:08:48AM -0400, Jeff Dike wrote:
>> >On Sun, Oct 21, 2007 at 07:48:54PM +0800, WANG Cong wrote:
>> >> UML still doesn't build on 2.6.23-git16.
>> >>
>> >> Gcc threw out many errors, I put them in the web:
>> >> http://wangcong.org/down/errors.txt
>> >
>> >Looks like either you need to run mrproper and try again, or maybe
>> >fallout from the x86 merge, with include/asm-um/arch pointing to
>> >include/asm-i386 instead of include/asm-x86. Although I though Al had
>> >UML building in the presence of the x86 merge.
>> >
>>
>> Hi, Jeff!
>>
>> I have tried `make mrproper' before `make ARCH=um', but it still
>> failed. ;(
>
>Fallout continues; I've got a preliminary patch for it. Basically, we
>need to stop doing -U__i386__ et.al.
>

Hi, Al.

I applied your patch and recompiled the kernel. But it failed again.
;(

Regards.

WANG Cong

2007-10-22 05:22:28

by Al Viro

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 12:37:46PM +0800, WANG Cong wrote:
> >Fallout continues; I've got a preliminary patch for it. Basically, we
> >need to stop doing -U__i386__ et.al.
> >
>
> Hi, Al.
>
> I applied your patch and recompiled the kernel. But it failed again.
> ;(

Details would be welcome... Notes: SMP on UML is no more; UML_NET_VDE
depends on having some userland library installed. Aside of those two
it ought to build.

Build log on failing build would be nice, along with .config.

2007-10-22 06:17:13

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 06:22:14AM +0100, Al Viro wrote:
>On Mon, Oct 22, 2007 at 12:37:46PM +0800, WANG Cong wrote:
>> >Fallout continues; I've got a preliminary patch for it. Basically, we
>> >need to stop doing -U__i386__ et.al.
>> >
>>
>> Hi, Al.
>>
>> I applied your patch and recompiled the kernel. But it failed again.
>> ;(
>
>Details would be welcome... Notes: SMP on UML is no more; UML_NET_VDE
>depends on having some userland library installed. Aside of those two
>it ought to build.
>
>Build log on failing build would be nice, along with .config.

I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(

Errors threw out by gcc (too many) are put here:
http://wangcong.org/down/errors.txt

And my .config is located here:
http://wangcong.org/down/dot_config

(Errors look like same as without your patch.)

--
May the Source Be With You.

2007-10-22 06:43:19

by Nix

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On 22 Oct 2007, WANG Cong uttered the following:
> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
>
> Errors threw out by gcc (too many) are put here:
> http://wangcong.org/down/errors.txt

It's hard to tell without LOCALE=C, but those are the sorts of results
I'd expect if you had run make {old,menu,x}config without specifying
ARCH=um, so you've configured for one architecture and are now trying
to build another.

Where is the include/asm symlink pointing to in your build tree?

(FWIW I get a coredump if I try to use the skas patch, but with noprocmm
UML in 2.6.23.1 builds and runs perfectly well on x86-32. I haven't
tried 2.6.23, but I see no reason why it should act any differently.)

--
`Some people don't think performance issues are "real bugs", and I think
such people shouldn't be allowed to program.' --- Linus Torvalds

2007-10-22 06:56:18

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 07:42:33AM +0100, Nix wrote:
>On 22 Oct 2007, WANG Cong uttered the following:
>> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
>>
>> Errors threw out by gcc (too many) are put here:
>> http://wangcong.org/down/errors.txt
>
>It's hard to tell without LOCALE=C, but those are the sorts of results
>I'd expect if you had run make {old,menu,x}config without specifying
>ARCH=um, so you've configured for one architecture and are now trying
>to build another.
>
>Where is the include/asm symlink pointing to in your build tree?

$ ls -l include/asm
lrwxrwxrwx 1 wangcong wangcong 6 2007-10-22 12:34 include/asm -> asm-um

OK. Let me do the following:

$ make mrproper
...
$ make defconfig ARCH=um
...
#
# configuration written to .config
#
$ make ARCH=um
(Still tons of errors here...)

Am I wrong or I missed something?

Regards.

--
May the Source Be With You.

2007-10-22 06:58:21

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 02:52:02PM +0800, WANG Cong wrote:
> On Mon, Oct 22, 2007 at 07:42:33AM +0100, Nix wrote:
> >On 22 Oct 2007, WANG Cong uttered the following:
> >> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
> >>
> >> Errors threw out by gcc (too many) are put here:
> >> http://wangcong.org/down/errors.txt
> >
> >It's hard to tell without LOCALE=C, but those are the sorts of results
> >I'd expect if you had run make {old,menu,x}config without specifying
> >ARCH=um, so you've configured for one architecture and are now trying
> >to build another.
> >
> >Where is the include/asm symlink pointing to in your build tree?
>
> $ ls -l include/asm
> lrwxrwxrwx 1 wangcong wangcong 6 2007-10-22 12:34 include/asm -> asm-um
>
> OK. Let me do the following:
>
> $ make mrproper

Please try
make ARCH=um mrproper

this will clean up the additional uml symlinks.

Sam

2007-10-22 07:27:23

by Al Viro

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 02:12:46PM +0800, WANG Cong wrote:
> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
>
> Errors threw out by gcc (too many) are put here:
> http://wangcong.org/down/errors.txt
>
> And my .config is located here:
> http://wangcong.org/down/dot_config
>
> (Errors look like same as without your patch.)

Er... That patch is on top of the current mainline, including
commit 2b8232ce512105e28453f301d1510de8363bccd1. Check if what
you are applying it against the recent tree. By the look of your
build log you are missing
- $(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch
+ $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
else
- $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
+ $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(HEADER_ARCH) arch
in arch/um/Makefile.

That, or you simply need to do make mrproper...

2007-10-22 07:52:31

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 08:59:43AM +0200, Sam Ravnborg wrote:
>On Mon, Oct 22, 2007 at 02:52:02PM +0800, WANG Cong wrote:
>> On Mon, Oct 22, 2007 at 07:42:33AM +0100, Nix wrote:
>> >On 22 Oct 2007, WANG Cong uttered the following:
>> >> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
>> >>
>> >> Errors threw out by gcc (too many) are put here:
>> >> http://wangcong.org/down/errors.txt
>> >
>> >It's hard to tell without LOCALE=C, but those are the sorts of results
>> >I'd expect if you had run make {old,menu,x}config without specifying
>> >ARCH=um, so you've configured for one architecture and are now trying
>> >to build another.
>> >
>> >Where is the include/asm symlink pointing to in your build tree?
>>
>> $ ls -l include/asm
>> lrwxrwxrwx 1 wangcong wangcong 6 2007-10-22 12:34 include/asm -> asm-um
>>
>> OK. Let me do the following:
>>
>> $ make mrproper
>
>Please try
>make ARCH=um mrproper
>
>this will clean up the additional uml symlinks.
>

Hi, Sam, Al and others.

I just followed what Sam told me, errors are much fewer this time,
but still exist. Error messages are:

CC arch/um/kernel/syscall.o
CC arch/um/kernel/sysrq.o
arch/um/kernel/sysrq.c: In function ‘show_stack’:
arch/um/kernel/sysrq.c:63: error: ‘UESP’ undeclared (first use in this function)
arch/um/kernel/sysrq.c:63: error: (Each undeclared identifier is reported only once
arch/um/kernel/sysrq.c:63: error: for each function it appears in.)
make[1]: *** [arch/um/kernel/sysrq.o] Error 1
make: *** [arch/um/kernel] Error 2

Or I missed something again?

And I use `make defconfig ARCH=um' to generate .config, my tree
is 2.6.23-git16 (Al, is this OK?).

Thanks.

--
May the Source Be With You.

2007-10-22 08:00:26

by Robert P. J. Day

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, 22 Oct 2007, WANG Cong wrote:

> On Mon, Oct 22, 2007 at 08:59:43AM +0200, Sam Ravnborg wrote:
> >On Mon, Oct 22, 2007 at 02:52:02PM +0800, WANG Cong wrote:
> >> On Mon, Oct 22, 2007 at 07:42:33AM +0100, Nix wrote:
> >> >On 22 Oct 2007, WANG Cong uttered the following:
> >> >> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
> >> >>
> >> >> Errors threw out by gcc (too many) are put here:
> >> >> http://wangcong.org/down/errors.txt
> >> >
> >> >It's hard to tell without LOCALE=C, but those are the sorts of results
> >> >I'd expect if you had run make {old,menu,x}config without specifying
> >> >ARCH=um, so you've configured for one architecture and are now trying
> >> >to build another.
> >> >
> >> >Where is the include/asm symlink pointing to in your build tree?
> >>
> >> $ ls -l include/asm
> >> lrwxrwxrwx 1 wangcong wangcong 6 2007-10-22 12:34 include/asm -> asm-um
> >>
> >> OK. Let me do the following:
> >>
> >> $ make mrproper
> >
> >Please try
> >make ARCH=um mrproper
> >
> >this will clean up the additional uml symlinks.
> >
>
> Hi, Sam, Al and others.
>
> I just followed what Sam told me, errors are much fewer this time,
> but still exist. Error messages are:
>
> CC arch/um/kernel/syscall.o
> CC arch/um/kernel/sysrq.o
> arch/um/kernel/sysrq.c: In function ??show_stack??:
> arch/um/kernel/sysrq.c:63: error: ??UESP?? undeclared (first use in this function)
> arch/um/kernel/sysrq.c:63: error: (Each undeclared identifier is reported only once
> arch/um/kernel/sysrq.c:63: error: for each function it appears in.)
> make[1]: *** [arch/um/kernel/sysrq.o] Error 1
> make: *** [arch/um/kernel] Error 2
>
> Or I missed something again?
>
> And I use `make defconfig ARCH=um' to generate .config, my tree
> is 2.6.23-git16 (Al, is this OK?).

that looks like a cut-and-paste error since the file
include/asm-um/arch/ptrace-abi.h opens with:

=====
#ifndef _ASM_X86_PTRACE_ABI_H
#define _ASM_X86_PTRACE_ABI_H

#ifdef __i386__

#define EBX 0
#define ECX 1
#define EDX 2
#define ESI 3
#define EDI 4
#define EBP 5
#define EAX 6
#define DS 7
#define ES 8
#define FS 9
#define GS 10
#define ORIG_EAX 11
#define EIP 12
#define CS 13
#define EFL 14
#define UESP 15
.....
=====

somehow, that doesn't look right.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

2007-10-22 08:06:25

by Robert P. J. Day

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, 22 Oct 2007, WANG Cong wrote:

> On Mon, Oct 22, 2007 at 07:42:33AM +0100, Nix wrote:
> >On 22 Oct 2007, WANG Cong uttered the following:
> >> I build UML for non-SMP x86. But I don't know about UML_NET_VDE. ;(
> >>
> >> Errors threw out by gcc (too many) are put here:
> >> http://wangcong.org/down/errors.txt
> >
> >It's hard to tell without LOCALE=C, but those are the sorts of results
> >I'd expect if you had run make {old,menu,x}config without specifying
> >ARCH=um, so you've configured for one architecture and are now trying
> >to build another.
> >
> >Where is the include/asm symlink pointing to in your build tree?
>
> $ ls -l include/asm
> lrwxrwxrwx 1 wangcong wangcong 6 2007-10-22 12:34 include/asm -> asm-um
>
> OK. Let me do the following:
>
> $ make mrproper

...

if you wanted to be *really* anal retentive, you might want to run
"make distclean" instead but, from what i've seen so far, i don't
think that would change what you're seeing.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

2007-10-22 11:36:17

by Al Viro

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 03:48:23PM +0800, WANG Cong wrote:
> I just followed what Sam told me, errors are much fewer this time,
> but still exist. Error messages are:
>
> CC arch/um/kernel/syscall.o
> CC arch/um/kernel/sysrq.o
> arch/um/kernel/sysrq.c: In function ???show_stack???:
> arch/um/kernel/sysrq.c:63: error: ???UESP??? undeclared (first use in this function)
> arch/um/kernel/sysrq.c:63: error: (Each undeclared identifier is reported only once
> arch/um/kernel/sysrq.c:63: error: for each function it appears in.)
> make[1]: *** [arch/um/kernel/sysrq.o] Error 1
> make: *** [arch/um/kernel] Error 2
>
> Or I missed something again?
>
> And I use `make defconfig ARCH=um' to generate .config, my tree
> is 2.6.23-git16 (Al, is this OK?).

Now apply the patch upthread, it should've fixed that one (and yes, you
are down to the stuff this patch is supposed to fix - and does so here).

2007-10-22 12:29:30

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 12:36:00PM +0100, Al Viro wrote:
>On Mon, Oct 22, 2007 at 03:48:23PM +0800, WANG Cong wrote:
>> I just followed what Sam told me, errors are much fewer this time,
>> but still exist. Error messages are:
>>
>> CC arch/um/kernel/syscall.o
>> CC arch/um/kernel/sysrq.o
>> arch/um/kernel/sysrq.c: In function ???show_stack???:
>> arch/um/kernel/sysrq.c:63: error: ???UESP??? undeclared (first use in this function)
>> arch/um/kernel/sysrq.c:63: error: (Each undeclared identifier is reported only once
>> arch/um/kernel/sysrq.c:63: error: for each function it appears in.)
>> make[1]: *** [arch/um/kernel/sysrq.o] Error 1
>> make: *** [arch/um/kernel] Error 2
>>
>> Or I missed something again?
>>
>> And I use `make defconfig ARCH=um' to generate .config, my tree
>> is 2.6.23-git16 (Al, is this OK?).
>
>Now apply the patch upthread, it should've fixed that one (and yes, you
>are down to the stuff this patch is supposed to fix - and does so here).

Yes, this one is fixed. Thanks for your patch.

But another one comes out. ;(

CC kernel/sched.o
kernel/sched.c:3902: error: conflicting types for ‘wait_for_completion_interruptible’
include/linux/completion.h:46: error: previous declaration of ‘wait_for_completion_interruptible’ was here
kernel/sched.c:3908: error: conflicting types for ‘wait_for_completion_interruptible’
include/linux/completion.h:46: error: previous declaration of ‘wait_for_completion_interruptible’ was here
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel] Error 2

CC: Ingo Molar <[email protected]>

--
May the Source Be With You.

2007-10-22 12:31:20

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* WANG Cong <[email protected]> wrote:

> On Mon, Oct 22, 2007 at 12:36:00PM +0100, Al Viro wrote:
> >On Mon, Oct 22, 2007 at 03:48:23PM +0800, WANG Cong wrote:
> >> I just followed what Sam told me, errors are much fewer this time,
> >> but still exist. Error messages are:
> >>
> >> CC arch/um/kernel/syscall.o
> >> CC arch/um/kernel/sysrq.o
> >> arch/um/kernel/sysrq.c: In function ???show_stack???:
> >> arch/um/kernel/sysrq.c:63: error: ???UESP??? undeclared (first use in this function)
> >> arch/um/kernel/sysrq.c:63: error: (Each undeclared identifier is reported only once
> >> arch/um/kernel/sysrq.c:63: error: for each function it appears in.)
> >> make[1]: *** [arch/um/kernel/sysrq.o] Error 1
> >> make: *** [arch/um/kernel] Error 2
> >>
> >> Or I missed something again?
> >>
> >> And I use `make defconfig ARCH=um' to generate .config, my tree
> >> is 2.6.23-git16 (Al, is this OK?).
> >
> >Now apply the patch upthread, it should've fixed that one (and yes, you
> >are down to the stuff this patch is supposed to fix - and does so here).
>
> Yes, this one is fixed. Thanks for your patch.
>
> But another one comes out. ;(
>
> CC kernel/sched.o
> kernel/sched.c:3902: error: conflicting types for ‘wait_for_completion_interruptible’
> include/linux/completion.h:46: error: previous declaration of ‘wait_for_completion_interruptible’ was here
> kernel/sched.c:3908: error: conflicting types for ‘wait_for_completion_interruptible’
> include/linux/completion.h:46: error: previous declaration of ‘wait_for_completion_interruptible’ was here
> make[1]: *** [kernel/sched.o] Error 1
> make: *** [kernel] Error 2

does the patch below ontop of latest -git help?

Ingo

---------------->
Subject: sched: fix fastcall mismatch in completion APIs
From: Ingo Molnar <[email protected]>

Jeff Dike noticed that wait_for_completion_interruptible()'s prototype
had a mismatched fastcall.

Fix this by removing the fastcall attributes from all the completion APIs.

Found-by: Jeff Dike <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
include/linux/completion.h | 16 ++++++++--------
kernel/sched.c | 10 +++++-----
2 files changed, 13 insertions(+), 13 deletions(-)

Index: linux/include/linux/completion.h
===================================================================
--- linux.orig/include/linux/completion.h
+++ linux/include/linux/completion.h
@@ -42,15 +42,15 @@ static inline void init_completion(struc
init_waitqueue_head(&x->wait);
}

-extern void FASTCALL(wait_for_completion(struct completion *));
-extern int FASTCALL(wait_for_completion_interruptible(struct completion *x));
-extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *x,
- unsigned long timeout));
-extern unsigned long FASTCALL(wait_for_completion_interruptible_timeout(
- struct completion *x, unsigned long timeout));
+extern void wait_for_completion(struct completion *);
+extern int wait_for_completion_interruptible(struct completion *x);
+extern unsigned long wait_for_completion_timeout(struct completion *x,
+ unsigned long timeout);
+extern unsigned long wait_for_completion_interruptible_timeout(
+ struct completion *x, unsigned long timeout);

-extern void FASTCALL(complete(struct completion *));
-extern void FASTCALL(complete_all(struct completion *));
+extern void complete(struct completion *);
+extern void complete_all(struct completion *);

#define INIT_COMPLETION(x) ((x).done = 0)

Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -3821,7 +3821,7 @@ __wake_up_sync(wait_queue_head_t *q, uns
}
EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */

-void fastcall complete(struct completion *x)
+void complete(struct completion *x)
{
unsigned long flags;

@@ -3833,7 +3833,7 @@ void fastcall complete(struct completion
}
EXPORT_SYMBOL(complete);

-void fastcall complete_all(struct completion *x)
+void complete_all(struct completion *x)
{
unsigned long flags;

@@ -3885,13 +3885,13 @@ wait_for_common(struct completion *x, lo
return timeout;
}

-void fastcall __sched wait_for_completion(struct completion *x)
+void __sched wait_for_completion(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE);
}
EXPORT_SYMBOL(wait_for_completion);

-unsigned long fastcall __sched
+unsigned long __sched
wait_for_completion_timeout(struct completion *x, unsigned long timeout)
{
return wait_for_common(x, timeout, TASK_UNINTERRUPTIBLE);
@@ -3907,7 +3907,7 @@ int __sched wait_for_completion_interrup
}
EXPORT_SYMBOL(wait_for_completion_interruptible);

-unsigned long fastcall __sched
+unsigned long __sched
wait_for_completion_interruptible_timeout(struct completion *x,
unsigned long timeout)
{

2007-10-22 12:43:27

by Cong Wang

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 02:30:41PM +0200, Ingo Molnar wrote:
>
>* WANG Cong <[email protected]> wrote:
>
>> On Mon, Oct 22, 2007 at 12:36:00PM +0100, Al Viro wrote:
>> >On Mon, Oct 22, 2007 at 03:48:23PM +0800, WANG Cong wrote:
>> >> I just followed what Sam told me, errors are much fewer this time,
>> >> but still exist. Error messages are:
>> >>
>> >> CC arch/um/kernel/syscall.o
>> >> CC arch/um/kernel/sysrq.o
>> >> arch/um/kernel/sysrq.c: In function ???show_stack???:
>> >> arch/um/kernel/sysrq.c:63: error: ???UESP??? undeclared (first use in this function)
>> >> arch/um/kernel/sysrq.c:63: error: (Each undeclared identifier is reported only once
>> >> arch/um/kernel/sysrq.c:63: error: for each function it appears in.)
>> >> make[1]: *** [arch/um/kernel/sysrq.o] Error 1
>> >> make: *** [arch/um/kernel] Error 2
>> >>
>> >> Or I missed something again?
>> >>
>> >> And I use `make defconfig ARCH=um' to generate .config, my tree
>> >> is 2.6.23-git16 (Al, is this OK?).
>> >
>> >Now apply the patch upthread, it should've fixed that one (and yes, you
>> >are down to the stuff this patch is supposed to fix - and does so here).
>>
>> Yes, this one is fixed. Thanks for your patch.
>>
>> But another one comes out. ;(
>>
>> CC kernel/sched.o
>> kernel/sched.c:3902: error: conflicting types for ‘wait_for_completion_interruptible’
>> include/linux/completion.h:46: error: previous declaration of ‘wait_for_completion_interruptible’ was here
>> kernel/sched.c:3908: error: conflicting types for ‘wait_for_completion_interruptible’
>> include/linux/completion.h:46: error: previous declaration of ‘wait_for_completion_interruptible’ was here
>> make[1]: *** [kernel/sched.o] Error 1
>> make: *** [kernel] Error 2
>
>does the patch below ontop of latest -git help?
>

Thanks, Ingo!

I am using 2.6.23-git16 plus Al's previous patch.
After applying your patch, it builds fine.

Regards.


WANG Cong

2007-10-22 12:43:55

by Al Viro

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 08:25:04PM +0800, WANG Cong wrote:
> >Now apply the patch upthread, it should've fixed that one (and yes, you
> >are down to the stuff this patch is supposed to fix - and does so here).
>
> Yes, this one is fixed. Thanks for your patch.
>
> But another one comes out. ;(

Jeff had posted a fix for that one a while ago:

-int __sched wait_for_completion_interruptible(struct completion *x)
+int __sched fastcall wait_for_completion_interruptible(struct completion *x)

in kernel/sched.c

FWIW, I would simply kill the damn fastcall thing - right now the only
user is uml/i386; everything else either has it #defined to nothing or
(as i386 does) passes -mregparm=3 while having fastcall expand to
__attribute__((regparm(3))) - i.e. has all functions fastcall.

Do we really need it on uml/i386 enough to keep bothering with that mess?

2007-10-22 12:46:22

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Al Viro <[email protected]> wrote:

> in kernel/sched.c
>
> FWIW, I would simply kill the damn fastcall thing - right now the only
> user is uml/i386; everything else either has it #defined to nothing or
> (as i386 does) passes -mregparm=3 while having fastcall expand to
> __attribute__((regparm(3))) - i.e. has all functions fastcall.
>
> Do we really need it on uml/i386 enough to keep bothering with that
> mess?

we should kill it there too.

the only place where we should _please_ keep those annotations are for
functions that get called from assembly code. This makes life immensely
easier for -pg (CONFIG_FUNCTION_TRACING) kernels.

Ingo

2007-10-22 15:35:04

by Jeff Dike

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Mon, Oct 22, 2007 at 01:43:22PM +0100, Al Viro wrote:
> FWIW, I would simply kill the damn fastcall thing - right now the only
> user is uml/i386; everything else either has it #defined to nothing or
> (as i386 does) passes -mregparm=3 while having fastcall expand to
> __attribute__((regparm(3))) - i.e. has all functions fastcall.
>
> Do we really need it on uml/i386 enough to keep bothering with that mess?

No, there was only that instance in linkage.h and I just got rid of
it.

Jeff

--
Work email - jdike at linux dot intel dot com

2007-10-22 20:25:13

by Jeff Dike

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Sun, Oct 21, 2007 at 04:43:46PM +0100, Al Viro wrote:
> Fallout continues; I've got a preliminary patch for it. Basically, we
> need to stop doing -U__i386__ et.al.

Thanks, Al. You need the patch below in order to get a working UML -
feel free to fold it into this.

Jeff

--
Work email - jdike at linux dot intel dot com


KERNEL_DEFINES needs whitespace trimmed, otherwise this whitespace
crunching done by make fools the patsubst which is used to remove
KERNEL_DEFINES from USER_CFLAGS.

Signed-off-by: Jeff Dike <[email protected]>
---
arch/um/Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/um/Makefile
===================================================================
--- linux-2.6.orig/arch/um/Makefile 2007-10-22 16:19:38.000000000 -0400
+++ linux-2.6/arch/um/Makefile 2007-10-22 16:19:44.000000000 -0400
@@ -70,9 +70,12 @@ include $(srctree)/$(ARCH_DIR)/Makefile-
# in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different
# errnos.
# These apply to kernelspace only.
+#
+# strip leading and trailing whitespace to make the USER_CFLAGS removal of these
+# defines more robust

-KERNEL_DEFINES = -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
- -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)
+KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
+ -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
KBUILD_CFLAGS += $(KERNEL_DEFINES)
KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)

2007-10-22 23:14:28

by Jeremy Fitzhardinge

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar wrote:
> we should kill it there too.
>
> the only place where we should _please_ keep those annotations are for
> functions that get called from assembly code. This makes life immensely
> easier for -pg (CONFIG_FUNCTION_TRACING) kernels.

Should we re-add them for the function pointers in asm-x86/paravirt.h?
Andi argued we should remove them since x86 is unconditionally regparm
now anyway - and they're pretty ugly syntactically.

J

2007-10-22 23:20:10

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Jeremy Fitzhardinge <[email protected]> wrote:

> Ingo Molnar wrote:
> > we should kill it there too.
> >
> > the only place where we should _please_ keep those annotations are for
> > functions that get called from assembly code. This makes life immensely
> > easier for -pg (CONFIG_FUNCTION_TRACING) kernels.
>
> Should we re-add them for the function pointers in asm-x86/paravirt.h?

yes, yes, yes. :-) It was a nightmare to sort it out in -rt (and still
is). It's also good documentation - it pinpoints functions that are
called from assembly.

> Andi argued we should remove them since x86 is unconditionally regparm
> now anyway - and they're pretty ugly syntactically.

Sure, it doesnt make things prettier, but i didnt see any particular
ugliness.

Ingo

2007-10-22 23:26:51

by Jeremy Fitzhardinge

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar wrote:
> * Jeremy Fitzhardinge <[email protected]> wrote:
>
>
>> Ingo Molnar wrote:
>>
>>> we should kill it there too.
>>>
>>> the only place where we should _please_ keep those annotations are for
>>> functions that get called from assembly code. This makes life immensely
>>> easier for -pg (CONFIG_FUNCTION_TRACING) kernels.
>>>
>> Should we re-add them for the function pointers in asm-x86/paravirt.h?
>>
>
> yes, yes, yes. :-) It was a nightmare to sort it out in -rt (and still
> is). It's also good documentation - it pinpoints functions that are
> called from assembly.
>
>
>> Andi argued we should remove them since x86 is unconditionally regparm
>> now anyway - and they're pretty ugly syntactically.
>>
>
> Sure, it doesnt make things prettier, but i didnt see any particular
> ugliness.

One thought I had is that "fastcall" doesn't really mean the right
thing. The speed or otherwise of the call is a side-effect, but what we
really mean is something like "regparm". Ie, document the actual
calling convention used, rather than an effect of the calling convention.

I guess "fastcall" has enough history now.

J

2007-10-22 23:56:25

by Jeremy Fitzhardinge

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar wrote:
> * Jeremy Fitzhardinge <[email protected]> wrote:
>
>
>> Ingo Molnar wrote:
>>
>>> we should kill it there too.
>>>
>>> the only place where we should _please_ keep those annotations are for
>>> functions that get called from assembly code. This makes life immensely
>>> easier for -pg (CONFIG_FUNCTION_TRACING) kernels.
>>>
>> Should we re-add them for the function pointers in asm-x86/paravirt.h?
>>
>
> yes, yes, yes. :-) It was a nightmare to sort it out in -rt (and still
> is).

Do you have a patch to do this already?

>> Andi argued we should remove them since x86 is unconditionally regparm
>> now anyway - and they're pretty ugly syntactically.
>>
>
> Sure, it doesnt make things prettier, but i didnt see any particular
> ugliness.

Hm, how can we get gcc to complain about inconsistent use of fastcall?
It doesn't generate any warnings if the function and its pointer are
inconsistent, presumably because everything is regparm(3) anyway...

J

2007-10-23 08:46:38

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Jeremy Fitzhardinge <[email protected]> wrote:

> >> Should we re-add them for the function pointers in
> >> asm-x86/paravirt.h?
> >
> > yes, yes, yes. :-) It was a nightmare to sort it out in -rt (and
> > still is).
>
> Do you have a patch to do this already?

yes, attached. Ack?

Ingo

---------------------------->
Subject: [patch] paravirt: mark assembly dependencies as fastcall
From: Ingo Molnar <[email protected]>

the 'fastcall removal' changes to paravirt.c were over-eager: they
removed fastcall annotations from functions that are (or might be)
implemented in assembly. So if someone changes the compiler model,
such as -pg which disables regparm, the kernel breaks in nasty ways.

so this patch adds back fastcall annotations. This serves as
documentation for assembly calling-convention dependencies as
well.

Signed-off-by: Ingo Molnar <[email protected]>
---
arch/i386/kernel/paravirt.c | 6 -
arch/i386/kernel/smp.c | 7 +
include/asm-i386/desc.h | 18 ++--
include/asm-i386/io.h | 2
include/asm-i386/irqflags.h | 12 +-
include/asm-i386/msr.h | 13 +--
include/asm-i386/page.h | 21 ++---
include/asm-i386/paravirt.h | 156 +++++++++++++++++++-------------------
include/asm-i386/pgtable-2level.h | 10 +-
include/asm-i386/pgtable-3level.h | 18 ++--
include/asm-i386/pgtable.h | 2
include/asm-i386/processor.h | 8 -
include/asm-i386/system.h | 22 ++---
include/asm-i386/time.h | 4
include/asm-i386/tlbflush.h | 4
15 files changed, 154 insertions(+), 149 deletions(-)

Index: linux-2.6.23-rt1/arch/i386/kernel/paravirt.c
===================================================================
--- linux-2.6.23-rt1.orig/arch/i386/kernel/paravirt.c 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/arch/i386/kernel/paravirt.c 2007-10-11 16:00:03.000000000 -0400
@@ -208,7 +208,7 @@ void init_IRQ(void)
paravirt_ops.init_IRQ();
}

-static void native_flush_tlb(void)
+static fastcall void native_flush_tlb(void)
{
__native_flush_tlb();
}
@@ -217,12 +217,12 @@ static void native_flush_tlb(void)
* Global pages have to be flushed a bit differently. Not a real
* performance problem because this does not happen often.
*/
-static void native_flush_tlb_global(void)
+static fastcall void native_flush_tlb_global(void)
{
__native_flush_tlb_global();
}

-static void native_flush_tlb_single(unsigned long addr)
+static fastcall void native_flush_tlb_single(unsigned long addr)
{
__native_flush_tlb_single(addr);
}
Index: linux-2.6.23-rt1/arch/i386/kernel/smp.c
===================================================================
--- linux-2.6.23-rt1.orig/arch/i386/kernel/smp.c 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/arch/i386/kernel/smp.c 2007-10-11 16:00:03.000000000 -0400
@@ -344,8 +344,9 @@ out:
put_cpu_no_resched();
}

-void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
- unsigned long va)
+void fastcall
+native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
+ unsigned long va)
{
cpumask_t cpumask = *cpumaskp;

@@ -470,6 +471,7 @@ void flush_tlb_all(void)
*/
static void native_smp_send_reschedule(int cpu)
{
+ trace_special(cpu, 0, 0);
WARN_ON(cpu_is_offline(cpu));
send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR);
}
@@ -639,6 +641,7 @@ static void native_smp_send_stop(void)
*/
fastcall void smp_reschedule_interrupt(struct pt_regs *regs)
{
+ trace_special(regs->eip, 0, 0);
ack_APIC_irq();
}

Index: linux-2.6.23-rt1/include/asm-i386/desc.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/desc.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/desc.h 2007-10-11 16:00:03.000000000 -0400
@@ -78,14 +78,14 @@ static inline void pack_gate(__u32 *a, _
#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
#endif

-static inline void write_dt_entry(struct desc_struct *dt,
+static inline fastcall void write_dt_entry(struct desc_struct *dt,
int entry, u32 entry_low, u32 entry_high)
{
dt[entry].a = entry_low;
dt[entry].b = entry_high;
}

-static inline void native_set_ldt(const void *addr, unsigned int entries)
+static fastcall inline void native_set_ldt(const void *addr, unsigned int entries)
{
if (likely(entries == 0))
__asm__ __volatile__("lldt %w0"::"q" (0));
@@ -102,39 +102,39 @@ static inline void native_set_ldt(const
}


-static inline void native_load_tr_desc(void)
+static fastcall inline void native_load_tr_desc(void)
{
asm volatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8));
}

-static inline void native_load_gdt(const struct Xgt_desc_struct *dtr)
+static fastcall inline void native_load_gdt(const struct Xgt_desc_struct *dtr)
{
asm volatile("lgdt %0"::"m" (*dtr));
}

-static inline void native_load_idt(const struct Xgt_desc_struct *dtr)
+static fastcall inline void native_load_idt(const struct Xgt_desc_struct *dtr)
{
asm volatile("lidt %0"::"m" (*dtr));
}

-static inline void native_store_gdt(struct Xgt_desc_struct *dtr)
+static fastcall inline void native_store_gdt(struct Xgt_desc_struct *dtr)
{
asm ("sgdt %0":"=m" (*dtr));
}

-static inline void native_store_idt(struct Xgt_desc_struct *dtr)
+static fastcall inline void native_store_idt(struct Xgt_desc_struct *dtr)
{
asm ("sidt %0":"=m" (*dtr));
}

-static inline unsigned long native_store_tr(void)
+static fastcall inline unsigned long native_store_tr(void)
{
unsigned long tr;
asm ("str %0":"=r" (tr));
return tr;
}

-static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
+static fastcall inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
{
unsigned int i;
struct desc_struct *gdt = get_cpu_gdt_table(cpu);
Index: linux-2.6.23-rt1/include/asm-i386/io.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/io.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/io.h 2007-10-11 16:00:03.000000000 -0400
@@ -254,7 +254,7 @@ static inline void flush_write_buffers(v

#endif /* __KERNEL__ */

-static inline void native_io_delay(void)
+static fastcall inline void native_io_delay(void)
{
asm volatile("outb %%al,$0x80" : : : "memory");
}
Index: linux-2.6.23-rt1/include/asm-i386/irqflags.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/irqflags.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/irqflags.h 2007-10-11 16:00:03.000000000 -0400
@@ -12,36 +12,36 @@
#include <asm/processor-flags.h>

#ifndef __ASSEMBLY__
-static inline unsigned long native_save_fl(void)
+static fastcall inline unsigned long native_save_fl(void)
{
unsigned long f;
asm volatile("pushfl ; popl %0":"=g" (f): /* no input */);
return f;
}

-static inline void native_restore_fl(unsigned long f)
+static fastcall inline void native_restore_fl(unsigned long f)
{
asm volatile("pushl %0 ; popfl": /* no output */
:"g" (f)
:"memory", "cc");
}

-static inline void native_irq_disable(void)
+static fastcall inline void native_irq_disable(void)
{
asm volatile("cli": : :"memory");
}

-static inline void native_irq_enable(void)
+static fastcall inline void native_irq_enable(void)
{
asm volatile("sti": : :"memory");
}

-static inline void native_safe_halt(void)
+static fastcall inline void native_safe_halt(void)
{
asm volatile("sti; hlt": : :"memory");
}

-static inline void native_halt(void)
+static fastcall inline void native_halt(void)
{
asm volatile("hlt": : :"memory");
}
Index: linux-2.6.23-rt1/include/asm-i386/msr.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/msr.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/msr.h 2007-10-11 16:00:03.000000000 -0400
@@ -1,6 +1,7 @@
#ifndef __ASM_MSR_H
#define __ASM_MSR_H

+#include <linux/compiler.h>
#include <asm/msr-index.h>

#ifdef __KERNEL__
@@ -8,7 +9,7 @@

#include <asm/errno.h>

-static inline unsigned long long native_read_msr(unsigned int msr)
+static fastcall inline unsigned long long native_read_msr(unsigned int msr)
{
unsigned long long val;

@@ -16,7 +17,7 @@ static inline unsigned long long native_
return val;
}

-static inline unsigned long long native_read_msr_safe(unsigned int msr,
+static fastcall inline unsigned long long native_read_msr_safe(unsigned int msr,
int *err)
{
unsigned long long val;
@@ -36,12 +37,12 @@ static inline unsigned long long native_
return val;
}

-static inline void native_write_msr(unsigned int msr, unsigned long long val)
+static fastcall inline void native_write_msr(unsigned int msr, unsigned long long val)
{
asm volatile("wrmsr" : : "c" (msr), "A"(val));
}

-static inline int native_write_msr_safe(unsigned int msr,
+static fastcall inline int native_write_msr_safe(unsigned int msr,
unsigned long long val)
{
int err;
@@ -60,14 +61,14 @@ static inline int native_write_msr_safe(
return err;
}

-static inline unsigned long long native_read_tsc(void)
+static fastcall inline unsigned long long native_read_tsc(void)
{
unsigned long long val;
asm volatile("rdtsc" : "=A" (val));
return val;
}

-static inline unsigned long long native_read_pmc(void)
+static fastcall inline unsigned long long native_read_pmc(void)
{
unsigned long long val;
asm volatile("rdpmc" : "=A" (val));
Index: linux-2.6.23-rt1/include/asm-i386/page.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/page.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/page.h 2007-10-11 16:00:03.000000000 -0400
@@ -11,6 +11,7 @@

#ifdef __KERNEL__
#ifndef __ASSEMBLY__
+#include <linux/linkage.h>

#ifdef CONFIG_X86_USE_3DNOW

@@ -49,32 +50,32 @@ typedef struct { unsigned long long pmd;
typedef struct { unsigned long long pgd; } pgd_t;
typedef struct { unsigned long long pgprot; } pgprot_t;

-static inline unsigned long long native_pgd_val(pgd_t pgd)
+static fastcall inline unsigned long long native_pgd_val(pgd_t pgd)
{
return pgd.pgd;
}

-static inline unsigned long long native_pmd_val(pmd_t pmd)
+static fastcall inline unsigned long long native_pmd_val(pmd_t pmd)
{
return pmd.pmd;
}

-static inline unsigned long long native_pte_val(pte_t pte)
+static fastcall inline unsigned long long native_pte_val(pte_t pte)
{
return pte.pte_low | ((unsigned long long)pte.pte_high << 32);
}

-static inline pgd_t native_make_pgd(unsigned long long val)
+static fastcall inline pgd_t native_make_pgd(unsigned long long val)
{
return (pgd_t) { val };
}

-static inline pmd_t native_make_pmd(unsigned long long val)
+static fastcall inline pmd_t native_make_pmd(unsigned long long val)
{
return (pmd_t) { val };
}

-static inline pte_t native_make_pte(unsigned long long val)
+static fastcall inline pte_t native_make_pte(unsigned long long val)
{
return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ;
}
@@ -92,22 +93,22 @@ typedef struct { unsigned long pgd; } pg
typedef struct { unsigned long pgprot; } pgprot_t;
#define boot_pte_t pte_t /* or would you rather have a typedef */

-static inline unsigned long native_pgd_val(pgd_t pgd)
+static fastcall inline unsigned long native_pgd_val(pgd_t pgd)
{
return pgd.pgd;
}

-static inline unsigned long native_pte_val(pte_t pte)
+static fastcall inline unsigned long native_pte_val(pte_t pte)
{
return pte.pte_low;
}

-static inline pgd_t native_make_pgd(unsigned long val)
+static fastcall inline pgd_t native_make_pgd(unsigned long val)
{
return (pgd_t) { val };
}

-static inline pte_t native_make_pte(unsigned long val)
+static fastcall inline pte_t native_make_pte(unsigned long val)
{
return (pte_t) { .pte_low = val };
}
Index: linux-2.6.23-rt1/include/asm-i386/paravirt.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/paravirt.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/paravirt.h 2007-10-11 16:00:03.000000000 -0400
@@ -71,31 +71,31 @@ struct paravirt_ops
void (*banner)(void);

/* Set and set time of day */
- unsigned long (*get_wallclock)(void);
- int (*set_wallclock)(unsigned long);
+ unsigned long (fastcall *get_wallclock)(void);
+ int (fastcall *set_wallclock)(unsigned long);

/* cpuid emulation, mostly so that caps bits can be disabled */
- void (*cpuid)(unsigned int *eax, unsigned int *ebx,
+ void (fastcall *cpuid)(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx);

/* hooks for various privileged instructions */
- unsigned long (*get_debugreg)(int regno);
- void (*set_debugreg)(int regno, unsigned long value);
+ unsigned long (fastcall *get_debugreg)(int regno);
+ void (fastcall *set_debugreg)(int regno, unsigned long value);

- void (*clts)(void);
+ void (fastcall *clts)(void);

- unsigned long (*read_cr0)(void);
- void (*write_cr0)(unsigned long);
+ unsigned long (fastcall *read_cr0)(void);
+ void (fastcall *write_cr0)(unsigned long);

- unsigned long (*read_cr2)(void);
- void (*write_cr2)(unsigned long);
+ unsigned long (fastcall *read_cr2)(void);
+ void (fastcall *write_cr2)(unsigned long);

- unsigned long (*read_cr3)(void);
- void (*write_cr3)(unsigned long);
+ unsigned long (fastcall *read_cr3)(void);
+ void (fastcall *write_cr3)(unsigned long);

- unsigned long (*read_cr4_safe)(void);
- unsigned long (*read_cr4)(void);
- void (*write_cr4)(unsigned long);
+ unsigned long (fastcall *read_cr4_safe)(void);
+ unsigned long (fastcall *read_cr4)(void);
+ void (fastcall *write_cr4)(unsigned long);

/*
* Get/set interrupt state. save_fl and restore_fl are only
@@ -103,44 +103,44 @@ struct paravirt_ops
* returned from save_fl are undefined, and may be ignored by
* restore_fl.
*/
- unsigned long (*save_fl)(void);
- void (*restore_fl)(unsigned long);
- void (*irq_disable)(void);
- void (*irq_enable)(void);
- void (*safe_halt)(void);
- void (*halt)(void);
+ unsigned long (fastcall *save_fl)(void);
+ void (fastcall *restore_fl)(unsigned long);
+ void (fastcall *irq_disable)(void);
+ void (fastcall *irq_enable)(void);
+ void (fastcall *safe_halt)(void);
+ void (fastcall *halt)(void);

- void (*wbinvd)(void);
+ void (fastcall *wbinvd)(void);

/* MSR, PMC and TSR operations.
err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
- u64 (*read_msr)(unsigned int msr, int *err);
- int (*write_msr)(unsigned int msr, u64 val);
+ u64 (fastcall *read_msr)(unsigned int msr, int *err);
+ int (fastcall *write_msr)(unsigned int msr, u64 val);

- u64 (*read_tsc)(void);
- u64 (*read_pmc)(void);
+ u64 (fastcall *read_tsc)(void);
+ u64 (fastcall *read_pmc)(void);
unsigned long long (*sched_clock)(void);
unsigned long (*get_cpu_khz)(void);

/* Segment descriptor handling */
- void (*load_tr_desc)(void);
- void (*load_gdt)(const struct Xgt_desc_struct *);
- void (*load_idt)(const struct Xgt_desc_struct *);
- void (*store_gdt)(struct Xgt_desc_struct *);
- void (*store_idt)(struct Xgt_desc_struct *);
- void (*set_ldt)(const void *desc, unsigned entries);
- unsigned long (*store_tr)(void);
- void (*load_tls)(struct thread_struct *t, unsigned int cpu);
- void (*write_ldt_entry)(struct desc_struct *,
+ void (fastcall *load_tr_desc)(void);
+ void (fastcall *load_gdt)(const struct Xgt_desc_struct *);
+ void (fastcall *load_idt)(const struct Xgt_desc_struct *);
+ void (fastcall *store_gdt)(struct Xgt_desc_struct *);
+ void (fastcall *store_idt)(struct Xgt_desc_struct *);
+ void (fastcall *set_ldt)(const void *desc, unsigned entries);
+ unsigned long (fastcall *store_tr)(void);
+ void (fastcall *load_tls)(struct thread_struct *t, unsigned int cpu);
+ void (fastcall *write_ldt_entry)(struct desc_struct *,
int entrynum, u32 low, u32 high);
- void (*write_gdt_entry)(struct desc_struct *,
+ void (fastcall *write_gdt_entry)(struct desc_struct *,
int entrynum, u32 low, u32 high);
- void (*write_idt_entry)(struct desc_struct *,
+ void (fastcall *write_idt_entry)(struct desc_struct *,
int entrynum, u32 low, u32 high);
- void (*load_esp0)(struct tss_struct *tss, struct thread_struct *t);
+ void (fastcall *load_esp0)(struct tss_struct *tss, struct thread_struct *t);

- void (*set_iopl_mask)(unsigned mask);
- void (*io_delay)(void);
+ void (fastcall *set_iopl_mask)(unsigned mask);
+ void (fastcall *io_delay)(void);

/*
* Hooks for intercepting the creation/use/destruction of an
@@ -157,9 +157,9 @@ struct paravirt_ops
* Direct APIC operations, principally for VMI. Ideally
* these shouldn't be in this interface.
*/
- void (*apic_write)(unsigned long reg, unsigned long v);
- void (*apic_write_atomic)(unsigned long reg, unsigned long v);
- unsigned long (*apic_read)(unsigned long reg);
+ void (fastcall *apic_write)(unsigned long reg, unsigned long v);
+ void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v);
+ unsigned long (fastcall *apic_read)(unsigned long reg);
void (*setup_boot_clock)(void);
void (*setup_secondary_clock)(void);

@@ -169,56 +169,56 @@ struct paravirt_ops
#endif

/* TLB operations */
- void (*flush_tlb_user)(void);
- void (*flush_tlb_kernel)(void);
- void (*flush_tlb_single)(unsigned long addr);
- void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
+ void (fastcall *flush_tlb_user)(void);
+ void (fastcall *flush_tlb_kernel)(void);
+ void (fastcall *flush_tlb_single)(unsigned long addr);
+ void (fastcall *flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
unsigned long va);

/* Hooks for allocating/releasing pagetable pages */
- void (*alloc_pt)(struct mm_struct *mm, u32 pfn);
- void (*alloc_pd)(u32 pfn);
- void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
- void (*release_pt)(u32 pfn);
- void (*release_pd)(u32 pfn);
+ void (fastcall *alloc_pt)(struct mm_struct *mm, u32 pfn);
+ void (fastcall *alloc_pd)(u32 pfn);
+ void (fastcall *alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
+ void (fastcall *release_pt)(u32 pfn);
+ void (fastcall *release_pd)(u32 pfn);

/* Pagetable manipulation functions */
- void (*set_pte)(pte_t *ptep, pte_t pteval);
- void (*set_pte_at)(struct mm_struct *mm, unsigned long addr,
+ void (fastcall *set_pte)(pte_t *ptep, pte_t pteval);
+ void (fastcall *set_pte_at)(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pteval);
- void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
- void (*pte_update)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
- void (*pte_update_defer)(struct mm_struct *mm,
+ void (fastcall *set_pmd)(pmd_t *pmdp, pmd_t pmdval);
+ void (fastcall *pte_update)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
+ void (fastcall *pte_update_defer)(struct mm_struct *mm,
unsigned long addr, pte_t *ptep);

#ifdef CONFIG_HIGHPTE
- void *(*kmap_atomic_pte)(struct page *page, enum km_type type);
+ void *(fastcall *kmap_atomic_pte)(struct page *page, enum km_type type);
#endif

#ifdef CONFIG_X86_PAE
- void (*set_pte_atomic)(pte_t *ptep, pte_t pteval);
- void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
- void (*set_pud)(pud_t *pudp, pud_t pudval);
- void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
- void (*pmd_clear)(pmd_t *pmdp);
-
- unsigned long long (*pte_val)(pte_t);
- unsigned long long (*pmd_val)(pmd_t);
- unsigned long long (*pgd_val)(pgd_t);
-
- pte_t (*make_pte)(unsigned long long pte);
- pmd_t (*make_pmd)(unsigned long long pmd);
- pgd_t (*make_pgd)(unsigned long long pgd);
+ void (fastcall *set_pte_atomic)(pte_t *ptep, pte_t pteval);
+ void (fastcall *set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
+ void (fastcall *set_pud)(pud_t *pudp, pud_t pudval);
+ void (fastcall *pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
+ void (fastcall *pmd_clear)(pmd_t *pmdp);
+
+ unsigned long long (fastcall *pte_val)(pte_t);
+ unsigned long long (fastcall *pmd_val)(pmd_t);
+ unsigned long long (fastcall *pgd_val)(pgd_t);
+
+ pte_t (fastcall *make_pte)(unsigned long long pte);
+ pmd_t (fastcall *make_pmd)(unsigned long long pmd);
+ pgd_t (fastcall *make_pgd)(unsigned long long pgd);
#else
- unsigned long (*pte_val)(pte_t);
- unsigned long (*pgd_val)(pgd_t);
+ unsigned long (fastcall *pte_val)(pte_t);
+ unsigned long (fastcall *pgd_val)(pgd_t);

- pte_t (*make_pte)(unsigned long pte);
- pgd_t (*make_pgd)(unsigned long pgd);
+ pte_t (fastcall *make_pte)(unsigned long pte);
+ pgd_t (fastcall *make_pgd)(unsigned long pgd);
#endif

/* Set deferred update mode, used for batching operations. */
- void (*set_lazy_mode)(enum paravirt_lazy_mode mode);
+ void (fastcall *set_lazy_mode)(enum paravirt_lazy_mode mode);

/* These two are jmp to, not actually called. */
void (*irq_enable_sysexit)(void);
@@ -419,12 +419,12 @@ static inline void load_esp0(struct tss_
}

#define ARCH_SETUP paravirt_ops.arch_setup();
-static inline unsigned long get_wallclock(void)
+static fastcall inline unsigned long get_wallclock(void)
{
return PVOP_CALL0(unsigned long, get_wallclock);
}

-static inline int set_wallclock(unsigned long nowtime)
+static fastcall inline int set_wallclock(unsigned long nowtime)
{
return PVOP_CALL1(int, set_wallclock, nowtime);
}
Index: linux-2.6.23-rt1/include/asm-i386/pgtable-2level.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/pgtable-2level.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/pgtable-2level.h 2007-10-11 16:00:03.000000000 -0400
@@ -11,16 +11,16 @@
* within a page table are directly modified. Thus, the following
* hook is made available.
*/
-static inline void native_set_pte(pte_t *ptep , pte_t pte)
+static fastcall inline void native_set_pte(pte_t *ptep , pte_t pte)
{
*ptep = pte;
}
-static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
+static fastcall inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep , pte_t pte)
{
native_set_pte(ptep, pte);
}
-static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
+static fastcall inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
{
*pmdp = pmd;
}
@@ -36,13 +36,13 @@ static inline void native_set_pmd(pmd_t
#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)

-static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *xp)
+static fastcall inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *xp)
{
*xp = __pte(0);
}

#ifdef CONFIG_SMP
-static inline pte_t native_ptep_get_and_clear(pte_t *xp)
+static fastcall inline pte_t native_ptep_get_and_clear(pte_t *xp)
{
return __pte(xchg(&xp->pte_low, 0));
}
Index: linux-2.6.23-rt1/include/asm-i386/pgtable-3level.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/pgtable-3level.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/pgtable-3level.h 2007-10-11 16:00:03.000000000 -0400
@@ -33,13 +33,13 @@ static inline int pte_exec_kernel(pte_t
* not possible, use pte_get_and_clear to obtain the old pte
* value and then use set_pte to update it. -ben
*/
-static inline void native_set_pte(pte_t *ptep, pte_t pte)
+static fastcall inline void native_set_pte(pte_t *ptep, pte_t pte)
{
ptep->pte_high = pte.pte_high;
smp_wmb();
ptep->pte_low = pte.pte_low;
}
-static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
+static fastcall inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep , pte_t pte)
{
native_set_pte(ptep, pte);
@@ -51,7 +51,7 @@ static inline void native_set_pte_at(str
* we are justified in merely clearing the PTE present bit, followed
* by a set. The ordering here is important.
*/
-static inline void native_set_pte_present(struct mm_struct *mm, unsigned long addr,
+static fastcall inline void native_set_pte_present(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{
ptep->pte_low = 0;
@@ -61,15 +61,15 @@ static inline void native_set_pte_presen
ptep->pte_low = pte.pte_low;
}

-static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
+static fastcall inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
{
set_64bit((unsigned long long *)(ptep),native_pte_val(pte));
}
-static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
+static fastcall inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
{
set_64bit((unsigned long long *)(pmdp),native_pmd_val(pmd));
}
-static inline void native_set_pud(pud_t *pudp, pud_t pud)
+static fastcall inline void native_set_pud(pud_t *pudp, pud_t pud)
{
*pudp = pud;
}
@@ -79,14 +79,14 @@ static inline void native_set_pud(pud_t
* entry, so clear the bottom half first and enforce ordering with a compiler
* barrier.
*/
-static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+static fastcall inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
{
ptep->pte_low = 0;
smp_wmb();
ptep->pte_high = 0;
}

-static inline void native_pmd_clear(pmd_t *pmd)
+static fastcall inline void native_pmd_clear(pmd_t *pmd)
{
u32 *tmp = (u32 *)pmd;
*tmp = 0;
@@ -125,7 +125,7 @@ static inline void pud_clear (pud_t * pu
pmd_index(address))

#ifdef CONFIG_SMP
-static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
+static fastcall inline pte_t native_ptep_get_and_clear(pte_t *ptep)
{
pte_t res;

Index: linux-2.6.23-rt1/include/asm-i386/pgtable.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/pgtable.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/pgtable.h 2007-10-11 16:00:03.000000000 -0400
@@ -261,7 +261,7 @@ static inline pte_t pte_mkhuge(pte_t pte
#endif

/* local pte updates need not use xchg for locking */
-static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
+static fastcall inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
{
pte_t res = *ptep;

Index: linux-2.6.23-rt1/include/asm-i386/processor.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/processor.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/processor.h 2007-10-11 16:00:03.000000000 -0400
@@ -492,7 +492,7 @@ static inline void rep_nop(void)

#define cpu_relax() rep_nop()

-static inline void native_load_esp0(struct tss_struct *tss, struct thread_struct *thread)
+static inline void fastcall native_load_esp0(struct tss_struct *tss, struct thread_struct *thread)
{
tss->x86_tss.esp0 = thread->esp0;
/* This can only happen when SEP is enabled, no need to test "SEP"arately */
@@ -503,7 +503,7 @@ static inline void native_load_esp0(stru
}


-static inline unsigned long native_get_debugreg(int regno)
+static inline unsigned long fastcall native_get_debugreg(int regno)
{
unsigned long val = 0; /* Damn you, gcc! */

@@ -526,7 +526,7 @@ static inline unsigned long native_get_d
return val;
}

-static inline void native_set_debugreg(int regno, unsigned long value)
+static inline void fastcall native_set_debugreg(int regno, unsigned long value)
{
switch (regno) {
case 0:
@@ -555,7 +555,7 @@ static inline void native_set_debugreg(i
/*
* Set IOPL bits in EFLAGS from given mask
*/
-static inline void native_set_iopl_mask(unsigned mask)
+static inline void fastcall native_set_iopl_mask(unsigned mask)
{
unsigned int reg;
__asm__ __volatile__ ("pushfl;"
Index: linux-2.6.23-rt1/include/asm-i386/system.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/system.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/system.h 2007-10-11 16:00:03.000000000 -0400
@@ -89,55 +89,55 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t"
asm volatile("mov %%" #seg ",%0":"=rm" (value))


-static inline void native_clts(void)
+static fastcall inline void native_clts(void)
{
asm volatile ("clts");
}

-static inline unsigned long native_read_cr0(void)
+static fastcall inline unsigned long native_read_cr0(void)
{
unsigned long val;
asm volatile("movl %%cr0,%0\n\t" :"=r" (val));
return val;
}

-static inline void native_write_cr0(unsigned long val)
+static fastcall inline void native_write_cr0(unsigned long val)
{
asm volatile("movl %0,%%cr0": :"r" (val));
}

-static inline unsigned long native_read_cr2(void)
+static fastcall inline unsigned long native_read_cr2(void)
{
unsigned long val;
asm volatile("movl %%cr2,%0\n\t" :"=r" (val));
return val;
}

-static inline void native_write_cr2(unsigned long val)
+static fastcall inline void native_write_cr2(unsigned long val)
{
asm volatile("movl %0,%%cr2": :"r" (val));
}

-static inline unsigned long native_read_cr3(void)
+static fastcall inline unsigned long native_read_cr3(void)
{
unsigned long val;
asm volatile("movl %%cr3,%0\n\t" :"=r" (val));
return val;
}

-static inline void native_write_cr3(unsigned long val)
+static fastcall inline void native_write_cr3(unsigned long val)
{
asm volatile("movl %0,%%cr3": :"r" (val));
}

-static inline unsigned long native_read_cr4(void)
+static fastcall inline unsigned long native_read_cr4(void)
{
unsigned long val;
asm volatile("movl %%cr4,%0\n\t" :"=r" (val));
return val;
}

-static inline unsigned long native_read_cr4_safe(void)
+static fastcall inline unsigned long native_read_cr4_safe(void)
{
unsigned long val;
/* This could fault if %cr4 does not exist */
@@ -150,12 +150,12 @@ static inline unsigned long native_read_
return val;
}

-static inline void native_write_cr4(unsigned long val)
+static fastcall inline void native_write_cr4(unsigned long val)
{
asm volatile("movl %0,%%cr4": :"r" (val));
}

-static inline void native_wbinvd(void)
+static fastcall inline void native_wbinvd(void)
{
asm volatile("wbinvd": : :"memory");
}
Index: linux-2.6.23-rt1/include/asm-i386/time.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/time.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/time.h 2007-10-11 16:00:03.000000000 -0400
@@ -4,7 +4,7 @@
#include <linux/efi.h>
#include "mach_time.h"

-static inline unsigned long native_get_wallclock(void)
+static fastcall inline unsigned long native_get_wallclock(void)
{
unsigned long retval;

@@ -16,7 +16,7 @@ static inline unsigned long native_get_w
return retval;
}

-static inline int native_set_wallclock(unsigned long nowtime)
+static fastcall inline int native_set_wallclock(unsigned long nowtime)
{
int retval;

Index: linux-2.6.23-rt1/include/asm-i386/tlbflush.h
===================================================================
--- linux-2.6.23-rt1.orig/include/asm-i386/tlbflush.h 2007-10-11 15:58:08.000000000 -0400
+++ linux-2.6.23-rt1/include/asm-i386/tlbflush.h 2007-10-11 16:00:03.000000000 -0400
@@ -116,7 +116,7 @@ static inline void flush_tlb_range(struc
__flush_tlb();
}

-static inline void native_flush_tlb_others(const cpumask_t *cpumask,
+static fastcall inline void native_flush_tlb_others(const cpumask_t *cpumask,
struct mm_struct *mm, unsigned long va)
{
}
@@ -140,7 +140,7 @@ static inline void flush_tlb_range(struc
flush_tlb_mm(vma->vm_mm);
}

-void native_flush_tlb_others(const cpumask_t *cpumask, struct mm_struct *mm,
+void fastcall native_flush_tlb_others(const cpumask_t *cpumask, struct mm_struct *mm,
unsigned long va);

#define TLBSTATE_OK 1

2007-10-23 12:55:46

by Andi Kleen

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar <[email protected]> writes:
>
> the 'fastcall removal' changes to paravirt.c were over-eager: they
> removed fastcall annotations from functions that are (or might be)
> implemented in assembly. So if someone changes the compiler model,
> such as -pg which disables regparm, the kernel breaks in nasty ways.

It would be probably better to just not disable -mregparms. I don't
think the compiler forces this. And e.g. on x86-64 regparms & -pg
work just fine, why should it not on i386?

> so this patch adds back fastcall annotations. This serves as
> documentation for assembly calling-convention dependencies as
> well.

You should rename it then to "asmcall" or something.

-Andi

2007-10-23 13:10:39

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Andi Kleen <[email protected]> wrote:

> > so this patch adds back fastcall annotations. This serves as
> > documentation for assembly calling-convention dependencies as well.
>
> You should rename it then to "asmcall" or something.

if then that should be a separate renaming patch.

Ingo

2007-10-23 13:24:40

by Adrian Bunk

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Tue, Oct 23, 2007 at 10:45:46AM +0200, Ingo Molnar wrote:
>
> * Jeremy Fitzhardinge <[email protected]> wrote:
>
> > >> Should we re-add them for the function pointers in
> > >> asm-x86/paravirt.h?
> > >
> > > yes, yes, yes. :-) It was a nightmare to sort it out in -rt (and
> > > still is).
> >
> > Do you have a patch to do this already?
>
> yes, attached. Ack?
>
> Ingo
>
> ---------------------------->
> Subject: [patch] paravirt: mark assembly dependencies as fastcall
> From: Ingo Molnar <[email protected]>
>
> the 'fastcall removal' changes to paravirt.c were over-eager: they
> removed fastcall annotations from functions that are (or might be)
> implemented in assembly. So if someone changes the compiler model,
> such as -pg which disables regparm, the kernel breaks in nasty ways.
>
> so this patch adds back fastcall annotations. This serves as
> documentation for assembly calling-convention dependencies as
> well.
>...

I see a point in annotating all C code called from assembler code with
either fastcall or asmlinkage, but how will these annotations be
maintained?

Without anything giving at least a warning these annotations will simply
bitrot.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2007-10-23 14:01:55

by Andi Kleen

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar <[email protected]> writes:

> * Andi Kleen <[email protected]> wrote:
>
>> > so this patch adds back fastcall annotations. This serves as
>> > documentation for assembly calling-convention dependencies as well.
>>
>> You should rename it then to "asmcall" or something.
>
> if then that should be a separate renaming patch.

Well you're asking for the ugly hacks for out of tree code. Any clean
ups needed should be your duty (and it's still unclear why exactly
regparm should not work with -pg anyways -- before readding ugly
stuff perhaps that should be clarified too)

-Andi

2007-10-23 14:20:40

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Andi Kleen <[email protected]> wrote:

> >> You should rename it then to "asmcall" or something.
> >
> > if then that should be a separate renaming patch.
>
> Well you're asking for the ugly hacks for out of tree code. [...]

nice word-bending there. I'm asking for pre-existing annotations to
survive. It hurts you _nothing_ and it was a world of pain for us to
recover those lost annotations. Anyway, if Jeremy does not object to the
patch we'll push it in and then rename fastcall to asmcall. Much ado
about nothing.

Ingo

2007-10-23 14:21:18

by Jeremy Fitzhardinge

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar wrote:
> * Jeremy Fitzhardinge <[email protected]> wrote:
>
>
>>>> Should we re-add them for the function pointers in
>>>> asm-x86/paravirt.h?
>>>>
>>> yes, yes, yes. :-) It was a nightmare to sort it out in -rt (and
>>> still is).
>>>
>> Do you have a patch to do this already?
>>
>
> yes, attached. Ack?
>
> Ingo
>
> ---------------------------->
> Subject: [patch] paravirt: mark assembly dependencies as fastcall
> From: Ingo Molnar <[email protected]>
>
> the 'fastcall removal' changes to paravirt.c were over-eager: they
> removed fastcall annotations from functions that are (or might be)
> implemented in assembly. So if someone changes the compiler model,
> such as -pg which disables regparm, the kernel breaks in nasty ways.
>
> so this patch adds back fastcall annotations. This serves as
> documentation for assembly calling-convention dependencies as
> well.
>

It would be really nice if we could get the compiler to warn about
whether mismatches in fastcall use. Without at least a compiler warning
about mismatches between the function pointer type in paravirt_ops and
the actual function, it will almost certainly rot and fail if you
actually need to depend on the annotations.

What's the issue with regparm and -pg?

> Signed-off-by: Ingo Molnar <[email protected]>
> ---
> arch/i386/kernel/paravirt.c | 6 -
> arch/i386/kernel/smp.c | 7 +
> include/asm-i386/desc.h | 18 ++--
> include/asm-i386/io.h | 2
> include/asm-i386/irqflags.h | 12 +-
> include/asm-i386/msr.h | 13 +--
> include/asm-i386/page.h | 21 ++---
> include/asm-i386/paravirt.h | 156 +++++++++++++++++++-------------------
> include/asm-i386/pgtable-2level.h | 10 +-
> include/asm-i386/pgtable-3level.h | 18 ++--
> include/asm-i386/pgtable.h | 2
> include/asm-i386/processor.h | 8 -
> include/asm-i386/system.h | 22 ++---
> include/asm-i386/time.h | 4
> include/asm-i386/tlbflush.h | 4
> 15 files changed, 154 insertions(+), 149 deletions(-)
>

Hm, so it will still need a fair amount of work to update to the
current kernel and add all the lguest/vmi/xen functions (and presumably
the out of tree kvm stuff too).

> Index: linux-2.6.23-rt1/arch/i386/kernel/paravirt.c
> ===================================================================
> --- linux-2.6.23-rt1.orig/arch/i386/kernel/paravirt.c 2007-10-11 15:58:08.000000000 -0400
> +++ linux-2.6.23-rt1/arch/i386/kernel/paravirt.c 2007-10-11 16:00:03.000000000 -0400
> @@ -208,7 +208,7 @@ void init_IRQ(void)
> paravirt_ops.init_IRQ();
> }
>
> -static void native_flush_tlb(void)
> +static fastcall void native_flush_tlb(void)
> {
> __native_flush_tlb();
> }
> @@ -217,12 +217,12 @@ static void native_flush_tlb(void)
> * Global pages have to be flushed a bit differently. Not a real
> * performance problem because this does not happen often.
> */
> -static void native_flush_tlb_global(void)
> +static fastcall void native_flush_tlb_global(void)
> {
> __native_flush_tlb_global();
> }
>
> -static void native_flush_tlb_single(unsigned long addr)
> +static fastcall void native_flush_tlb_single(unsigned long addr)
> {
> __native_flush_tlb_single(addr);
> }
> Index: linux-2.6.23-rt1/arch/i386/kernel/smp.c
> ===================================================================
> --- linux-2.6.23-rt1.orig/arch/i386/kernel/smp.c 2007-10-11 15:58:08.000000000 -0400
> +++ linux-2.6.23-rt1/arch/i386/kernel/smp.c 2007-10-11 16:00:03.000000000 -0400
> @@ -344,8 +344,9 @@ out:
> put_cpu_no_resched();
> }
>
> -void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
> - unsigned long va)
> +void fastcall
> +native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm,
> + unsigned long va)
> {
> cpumask_t cpumask = *cpumaskp;
>
> @@ -470,6 +471,7 @@ void flush_tlb_all(void)
> */
> static void native_smp_send_reschedule(int cpu)
> {
> + trace_special(cpu, 0, 0);
> WARN_ON(cpu_is_offline(cpu));
> send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR);
> }
> @@ -639,6 +641,7 @@ static void native_smp_send_stop(void)
> */
> fastcall void smp_reschedule_interrupt(struct pt_regs *regs)
> {
> + trace_special(regs->eip, 0, 0);
> ack_APIC_irq();
> }
>

What's trace_special()? Has this escaped from another patch?

J

2007-10-23 14:31:41

by Jeremy Fitzhardinge

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Ingo Molnar wrote:
> * Andi Kleen <[email protected]> wrote:
>
>
>>>> You should rename it then to "asmcall" or something.
>>>>
>>> if then that should be a separate renaming patch.
>>>
>> Well you're asking for the ugly hacks for out of tree code. [...]
>>
>
> nice word-bending there. I'm asking for pre-existing annotations to
> survive. It hurts you _nothing_ and it was a world of pain for us to
> recover those lost annotations. Anyway, if Jeremy does not object to the
> patch

I don't have any objections to the idea of the patch, but I'm still
concerned about the practical aspects of it. Maintaining these kinds of
annotations is hard/fragile/etc when the compiler doesn't warn when you
get it wrong, and only a very specific use-case will reveal the problem
(and do so in a fairly obscure way).

> we'll push it in and then rename fastcall to asmcall. Much ado
> about nothing.

Hm, "asmcall" is confusingly close to "asmlinkage" - and they have
exactly the same intent (can be called from asm), but with exactly the
opposite effect. How about something which actually says what we mean.
How about just "regparm"?

J

2007-10-23 14:47:43

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Jeremy Fitzhardinge <[email protected]> wrote:

> Ingo Molnar wrote:
> > * Andi Kleen <[email protected]> wrote:
> >
> >
> >>>> You should rename it then to "asmcall" or something.
> >>>>
> >>> if then that should be a separate renaming patch.
> >>>
> >> Well you're asking for the ugly hacks for out of tree code. [...]
> >>
> >
> > nice word-bending there. I'm asking for pre-existing annotations to
> > survive. It hurts you _nothing_ and it was a world of pain for us to
> > recover those lost annotations. Anyway, if Jeremy does not object to the
> > patch
>
> I don't have any objections to the idea of the patch, but I'm still
> concerned about the practical aspects of it. Maintaining these kinds
> of annotations is hard/fragile/etc when the compiler doesn't warn when
> you get it wrong, and only a very specific use-case will reveal the
> problem (and do so in a fairly obscure way).

it wont be any different from the situation before - we had no such
warnings there either. Anyway, this shouldnt really bother you as at the
moment it's only used for -rt. The issue is to keep something we had
before (but which was stupidly/carelessly removed). If it breaks we'll
fix it up.

> > we'll push it in and then rename fastcall to asmcall. Much ado about
> > nothing.
>
> Hm, "asmcall" is confusingly close to "asmlinkage" - and they have
> exactly the same intent (can be called from asm), but with exactly the
> opposite effect. How about something which actually says what we
> mean. How about just "regparm"?

yeah, regparm is fine.

Ingo

2007-10-23 14:49:07

by Andi Kleen

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Tue, Oct 23, 2007 at 04:20:06PM +0200, Ingo Molnar wrote:
>
> * Andi Kleen <[email protected]> wrote:
>
> > >> You should rename it then to "asmcall" or something.
> > >
> > > if then that should be a separate renaming patch.
> >
> > Well you're asking for the ugly hacks for out of tree code. [...]
>
> nice word-bending there. I'm asking for pre-existing annotations to
> survive.

What I'm objecting to is that you ask for this for your out of
tree code without any justification on why exactly -- -pg should
in theory work with -mregparms.

It's standard policy to require very good reasons for changes
that are only useful for out of tree code. People get flamed
for this all the time so I'm doing this thankless job here too.

Is it just because you didn't want to adapt the tracer for i386 regparm?
(that would be an invalid reason in my opinion ;-)
The correct fix would be to adapt the tracer then.

Or is it because gcc miscompiles something on i386 with -mregparm -pg?
(if yes that would be a valid reason, but it should be clearly stated)

-Andi

2007-10-23 15:10:39

by Adrian Bunk

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Tue, Oct 23, 2007 at 04:47:10PM +0200, Ingo Molnar wrote:
>
> * Jeremy Fitzhardinge <[email protected]> wrote:
>
> > Ingo Molnar wrote:
> > > * Andi Kleen <[email protected]> wrote:
> > >
> > >
> > >>>> You should rename it then to "asmcall" or something.
> > >>>>
> > >>> if then that should be a separate renaming patch.
> > >>>
> > >> Well you're asking for the ugly hacks for out of tree code. [...]
> > >>
> > >
> > > nice word-bending there. I'm asking for pre-existing annotations to
> > > survive. It hurts you _nothing_ and it was a world of pain for us to
> > > recover those lost annotations. Anyway, if Jeremy does not object to the
> > > patch
> >
> > I don't have any objections to the idea of the patch, but I'm still
> > concerned about the practical aspects of it. Maintaining these kinds
> > of annotations is hard/fragile/etc when the compiler doesn't warn when
> > you get it wrong, and only a very specific use-case will reveal the
> > problem (and do so in a fairly obscure way).
>
> it wont be any different from the situation before - we had no such
> warnings there either. Anyway, this shouldnt really bother you as at the
> moment it's only used for -rt. The issue is to keep something we had
> before (but which was stupidly/carelessly removed). If it breaks we'll
> fix it up.
>...

Until recently (read: before 2.6.20) fastcall had a semantics on i386
that resulted in compile errors if you got it wrong.

> Ingo

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2007-10-23 15:13:43

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Andi Kleen <[email protected]> wrote:

> On Tue, Oct 23, 2007 at 04:20:06PM +0200, Ingo Molnar wrote:
> >
> > * Andi Kleen <[email protected]> wrote:
> >
> > > >> You should rename it then to "asmcall" or something.
> > > >
> > > > if then that should be a separate renaming patch.
> > >
> > > Well you're asking for the ugly hacks for out of tree code. [...]
> >
> > nice word-bending there. I'm asking for pre-existing annotations to
> > survive.
>
> What I'm objecting to is that you ask for this for your out of tree
> code without any justification on why exactly -- -pg should in theory
> work with -mregparms.

last i checked it didnt work - i'll re-check that.

but even taking the latency tracer completely out of the picture,
maintaining this information is useful - at least for some time.

> It's standard policy to require very good reasons for changes that are
> only useful for out of tree code. [...]

it's not just for out of tree code - it's to keep the information of the
calling convention maintained - we could need it in the future.

> Is it just because you didn't want to adapt the tracer for i386
> regparm? [...]

uhm, thank you for such accusations and personal attacks :-( How did i
deserve that?

Ingo

2007-10-23 15:44:50

by Ingo Molnar

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.


* Ingo Molnar <[email protected]> wrote:

> > [...] -pg should in theory work with -mregparms.
>
> last i checked it didnt work - i'll re-check that.

earlier gcc versions had problems with -mregparm and with -pg. I just
did a quick test with latest gcc and at a quick glance it seems to work
better - i'll propagate that throught he whole latency tracer to see
whether it's indeed working throughout. Anyway, this means that there's
no urgent need for this patch and we've dropped it from the x86 queue
for now. As long as it only affects older gcc's it's probably not worth
force-keeping the annotations for that purpose alone.

Ingo

2007-10-23 16:58:14

by Andi Kleen

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Tue, Oct 23, 2007 at 05:44:17PM +0200, Ingo Molnar wrote:
>
> * Ingo Molnar <[email protected]> wrote:
>
> > > [...] -pg should in theory work with -mregparms.
> >
> > last i checked it didnt work - i'll re-check that.
>
> earlier gcc versions had problems with -mregparm and with -pg. I just

Which version was that?

> did a quick test with latest gcc and at a quick glance it seems to work
> better - i'll propagate that throught he whole latency tracer to see
> whether it's indeed working throughout. Anyway, this means that there's
> no urgent need for this patch and we've dropped it from the x86 queue
> for now. As long as it only affects older gcc's it's probably not worth
> force-keeping the annotations for that purpose alone.

Great.

-Andi

2007-10-24 15:23:17

by Jeff Dike

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Thu, Oct 11, 2007 at 05:54:46PM -0500, Rob Landley wrote:
> Guess what? I still need this patch to build the final 2.6.23, months later.
>
> I know it may not be the right fix, but the build breaks for me without this
> patch. The .config that breaks is attached. ARCH=um.

Can I get a Signed-off-by: on that?

It's not the right fix - the base of the problem is in swap.h, which
has this comment:
/* only sparc can not include linux/pagemap.h in this file
* so leave page_cache_release and release_pages undeclared... */

I poked around a bit for a sparc cross-toolchain, didn't find one, so
I couldn't see what exactly the problem was.

So, I'll take this fix.

Jeff

--
Work email - jdike at linux dot intel dot com

2007-10-24 16:13:24

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

Hi Jeff.

On Wed, Oct 24, 2007 at 11:22:40AM -0400, Jeff Dike wrote:
> On Thu, Oct 11, 2007 at 05:54:46PM -0500, Rob Landley wrote:
> > Guess what? I still need this patch to build the final 2.6.23, months later.
> >
> > I know it may not be the right fix, but the build breaks for me without this
> > patch. The .config that breaks is attached. ARCH=um.
>
> Can I get a Signed-off-by: on that?
>
> It's not the right fix - the base of the problem is in swap.h, which
> has this comment:
> /* only sparc can not include linux/pagemap.h in this file
> * so leave page_cache_release and release_pages undeclared... */
>
> I poked around a bit for a sparc cross-toolchain, didn't find one, so
> I couldn't see what exactly the problem was.
>
> So, I'll take this fix.

Dan Kegel's crosstool builds sparc just fine.
And for sparc issues I recommend cc:ing the sparc ML.

[Original mail (with patch) is here: http://lkml.org/lkml/2007/10/11/288]

Sam

2007-10-24 20:47:51

by Rob Landley

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Wednesday 24 October 2007 10:22:40 am Jeff Dike wrote:
> I poked around a bit for a sparc cross-toolchain, didn't find one, so
> I couldn't see what exactly the problem was.

Prebuilt for Ubuntu 7.04:
http://landley.net/code/firmware/downloads/cross-compiler/host-i686/cross-compiler-sparc.tar.bz2

Source code:
Or http://landley.net/code/firmware/downloads/firmware-0.2.2.tar.bz2

For the second one, extract it, cd into it, "./build.sh sparc", and when it
finishes your sparc-gcc should be in "build/cross-compiler-sparc/bin".

You can move the cross-compiler-sparc directory anywhere you want in the
filesystem, and it should still work. Just add the "bin" subdirectory of it
to $PATH and CROSS_COMPILE=sparc-

Rob
--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.

2007-10-25 00:43:57

by Jeff Dike

[permalink] [raw]
Subject: Re: [uml-devel] User Mode Linux still doesn't build in 2.6.23-final.

On Wed, Oct 24, 2007 at 04:46:54PM -0500, Rob Landley wrote:
> Prebuilt for Ubuntu 7.04:
> http://landley.net/code/firmware/downloads/cross-compiler/host-i686/cross-compiler-sparc.tar.bz2
>
> Source code:
> Or http://landley.net/code/firmware/downloads/firmware-0.2.2.tar.bz2

Thanks - I already got Dan Kegel's crosstools, and they did the trick.

What I'd like to do is have linux/swap.h include linux/pagemap.h, but
there's this scary comment about that not working on sparc.

When I fix this bug "correctly", sparc expodes into a mess of
interconnected headers which seem to boil down to sparc including
swap.h in pgtable.h when no one else does.

The thing is, sparc looks like it's doing things more correctly than
anyone else. asm/pgtable.h (i386 and UML, and probably everyone
else except sparc) refers to swp_entry_t, which is defined in
linux/swap.h, without including swap.h and that's somehow OK.

So, from a quick look, it seems like this is a case of our headers
being too interconnected and sparc had to opt out in order to do
things more correctly.

Jeff

--
Work email - jdike at linux dot intel dot com