2003-05-13 13:54:22

by Helge Hafting

[permalink] [raw]
Subject: [PATCH] Re: 2.5.69-mm4 undefined active_load_balance

Andrew Morton wrote:
> Helge Hafting <[email protected]> wrote:
>
>>>: undefined reference to `active_load_balance'
>>
>> I got this one too
>
>
> I don't think so. Please do a `make clean' and try again.
>
You don't think so? How come?
Note that this was a clean install, I unpacked
the 2.5.69 tarball, applied 2.5.69-mm3, copied a
.config file, and ran "make oldconfig; make bzImage"

I tried make clean, and still get
kernel/built-in.o(.text+0x102a): In function `schedule':
: undefined reference to `active_load_balance'
drivers/built-in.o(.text+0x7d534): In function `fb_prepare_logo':
: undefined reference to `find_logo'
make: *** [.tmp_vmlinux1] Error 1

During compile, I got a warning that active_load_balance
was implicitly declared or some such.

Looking at sched.c I see that
active_load_balance is declared if CONFIG_SHARE_RUNQUEUE
is not set.

Later, if we have CONFIG_SMP _and_ CONFIG_SHARE_RUNQUEUE
we get a longer version of active_load_balance

So, active_load_balance doesn't exist if
CONFIG_SHARE_RUNQUEUE is set on a non-smp machine.

but schedule() later do a call to active_load_balance
that isn't masked by any #ifdef. This machine isn't SMP,
and CONFIG_SHARE_RUNQUEUE gets set - so it goes wrong.

The problem seems to be in sched.h, which says:
/*
* Is there a way to do this via Kconfig?
*/
#ifdef CONFIG_NR_SIBLINGS_2
# define CONFIG_NR_SIBLINGS 2
#elif defined(CONFIG_NR_SIBLINGS_4)
# define CONFIG_NR_SIBLINGS 4
#else
# define CONFIG_NR_SIBLINGS 0
#endif

#ifdef CONFIG_NR_SIBLINGS
# define CONFIG_SHARE_RUNQUEUE 1
#else
# define CONFIG_SHARE_RUNQUEUE 0
#endif

I get
# define CONFIG_NR_SIBLINGS 0
and the #ifdef CONFIG_NR_SIBLINGS
test triggers because something #defined
to 0 is #defined. I guess this is the problem,
and if so, changing the #ifdef CONFIG_NR_SIBLINGS
to #if CONFIG_NR_SIBLINGS should do the trick.

A patch for this is at the end of the message.

>
>>, as well as:
>> drivers/built-in.o(.text+0x7d534): In function `fb_prepare_logo':
>> : undefined reference to `find_logo'
>
>
> Is that thing _still_ there?
>
> Does this fix?
[...]
Yes, thanks!

Patch for the active_load_balance problem.
It is not yet tested, it is compiling right now
and that takes time.

Helge Hafting

--- sched.h.orig 2003-05-13 15:45:17.000000000 +0200
+++ sched.h 2003-05-13 15:45:43.000000000 +0200
@@ -158,7 +158,7 @@
# define CONFIG_NR_SIBLINGS 0
#endif

-#ifdef CONFIG_NR_SIBLINGS
+#if CONFIG_NR_SIBLINGS
# define CONFIG_SHARE_RUNQUEUE 1
#else
# define CONFIG_SHARE_RUNQUEUE 0



2003-05-13 16:29:19

by Helge Hafting

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.69-mm4 undefined active_load_balance

The active_load_balance patch in the previous mail
seems to work, the test machine rebooted
and came up just fine.

Helge Hafting

2003-05-13 16:16:06

by Helge Hafting

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.69-mm4 undefined active_load_balance

On Tue, May 13, 2003 at 04:05:18PM +0200, Helge Hafting wrote:

> Patch for the active_load_balance problem.
> It is not yet tested, it is compiling right now
> and that takes time.

Of course I missed something. Here is a patch
that compiles and links too, when also using Andrew's
fb-logo patch. I haven't tried booting it yet, as
it is a remote machine.

Helge Hafting


--- sched.h.orig 2003-05-13 15:45:17.000000000 +0200
+++ sched.h 2003-05-13 18:07:01.000000000 +0200
@@ -158,10 +158,8 @@
# define CONFIG_NR_SIBLINGS 0
#endif

-#ifdef CONFIG_NR_SIBLINGS
+#if CONFIG_NR_SIBLINGS
# define CONFIG_SHARE_RUNQUEUE 1
-#else
-# define CONFIG_SHARE_RUNQUEUE 0
#endif
extern void sched_map_runqueue(int cpu1, int cpu2);


2003-05-13 19:26:09

by William Lee Irwin III

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.69-mm4 undefined active_load_balance

On Tue, May 13, 2003 at 06:27:11PM +0200, Helge Hafting wrote:
> --- sched.h.orig 2003-05-13 15:45:17.000000000 +0200
> +++ sched.h 2003-05-13 18:07:01.000000000 +0200
> @@ -158,10 +158,8 @@
> # define CONFIG_NR_SIBLINGS 0
> #endif
> -#ifdef CONFIG_NR_SIBLINGS
> +#if CONFIG_NR_SIBLINGS
> # define CONFIG_SHARE_RUNQUEUE 1
> -#else
> -# define CONFIG_SHARE_RUNQUEUE 0
> #endif
> extern void sched_map_runqueue(int cpu1, int cpu2);

Linus just committed a patch to eliminate such offenders.

Do you mean #if CONFIG_NR_SIBLINGS != 0 or #ifdef CONFIG_NR_SIBLINGS?


-- wli

2003-05-13 21:24:26

by William Lee Irwin III

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.69-mm4 undefined active_load_balance

On Tue, May 13, 2003 at 12:38:47PM -0700, William Lee Irwin III wrote:
>> Linus just committed a patch to eliminate such offenders.
>> Do you mean #if CONFIG_NR_SIBLINGS != 0 or #ifdef CONFIG_NR_SIBLINGS?

On Tue, May 13, 2003 at 11:31:10PM +0200, Helge Hafting wrote:
> I don't know this code well, I'm just guessing the rigth way
> to make it compile. I don't know what's the "clean" way
> to do #if/#ifdefs either - I could probably do better if I knew.
> The problem was that CONFIG_SHARE_RUNQUEUE gets set even with
> configs where it doesn't make sense, (i.e. uniprocessor without HT)
> so I guessed it was some sort of misunderstanding about
> how #ifdef works. I hope whoever wrote that code will
> take a look and either say "yes - that's what I meant"
> or fix it in a better way.

Your fix was correct (the alternative is some rearrangment of those
#defines) and I carried it out with some additional #ifdef -> #if
conversions to cover the rest of the cases visible in my config and
sent it to akpm in another patch.


-- wli

2003-05-13 21:20:02

by Helge Hafting

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.69-mm4 undefined active_load_balance

On Tue, May 13, 2003 at 12:38:47PM -0700, William Lee Irwin III wrote:
> On Tue, May 13, 2003 at 06:27:11PM +0200, Helge Hafting wrote:
> > --- sched.h.orig 2003-05-13 15:45:17.000000000 +0200
> > +++ sched.h 2003-05-13 18:07:01.000000000 +0200
> > @@ -158,10 +158,8 @@
> > # define CONFIG_NR_SIBLINGS 0
> > #endif
> > -#ifdef CONFIG_NR_SIBLINGS
> > +#if CONFIG_NR_SIBLINGS
> > # define CONFIG_SHARE_RUNQUEUE 1
> > -#else
> > -# define CONFIG_SHARE_RUNQUEUE 0
> > #endif
> > extern void sched_map_runqueue(int cpu1, int cpu2);
>
> Linus just committed a patch to eliminate such offenders.
>
> Do you mean #if CONFIG_NR_SIBLINGS != 0 or #ifdef CONFIG_NR_SIBLINGS?

I don't know this code well, I'm just guessing the rigth way
to make it compile. I don't know what's the "clean" way
to do #if/#ifdefs either - I could probably do better if I knew.

The problem was that CONFIG_SHARE_RUNQUEUE gets set even with
configs where it doesn't make sense, (i.e. uniprocessor without HT)
so I guessed it was some sort of misunderstanding about
how #ifdef works. I hope whoever wrote that code will
take a look and either say "yes - that's what I meant"
or fix it in a better way.

Helge Hafting