linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
       [not found] <alpine.LFD.2.01.0910041727310.3432@localhost.localdomain>
@ 2009-10-07 10:41 ` Andreas Mohr
  2009-10-07 14:23   ` Arjan van de Ven
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Mohr @ 2009-10-07 10:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven, Adam Belay, linux-acpi

Hi,

didn't find any report about this, so...

  LD      .tmp_vmlinux1
drivers/built-in.o(.text+0xd85a1): In function `menu_select':
drivers/cpuidle/governors/menu.c:212: undefined reference to `__udivdi3'
make: *** [.tmp_vmlinux1] Error 1


The symbol being __udivdi3 sounds to me like it's illegal FP use here.

This is not necessarily a -rc3 regression, though (currently running
2.6.29-rc7 on this box).


# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)

(yes, I know... ;)

Andreas Mohr

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-07 10:41 ` 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor) Andreas Mohr
@ 2009-10-07 14:23   ` Arjan van de Ven
  2009-10-07 17:34     ` Andreas Mohr
  0 siblings, 1 reply; 9+ messages in thread
From: Arjan van de Ven @ 2009-10-07 14:23 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: linux-kernel, Adam Belay, linux-acpi

Andreas Mohr wrote:
> Hi,
> 
> didn't find any report about this, so...
> 
>   LD      .tmp_vmlinux1
> drivers/built-in.o(.text+0xd85a1): In function `menu_select':
> drivers/cpuidle/governors/menu.c:212: undefined reference to `__udivdi3'
> make: *** [.tmp_vmlinux1] Error 1
> 
> # gcc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
> Thread model: posix
> gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)

seems you're the only user of this left.

it's not floating point but a 64 bit division.
The only one I can imagine is the one on line 213

looking at it, can you try sticking (u32) at the end of line 212; that multiply is not very likely to exceed 32 bits



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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-07 14:23   ` Arjan van de Ven
@ 2009-10-07 17:34     ` Andreas Mohr
  2009-10-07 17:45       ` Arjan van de Ven
  2009-10-07 17:45       ` Kyle McMartin
  0 siblings, 2 replies; 9+ messages in thread
From: Andreas Mohr @ 2009-10-07 17:34 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Andreas Mohr, linux-kernel, linux-acpi

Hi,

On Wed, Oct 07, 2009 at 07:23:07AM -0700, Arjan van de Ven wrote:
> Andreas Mohr wrote:
>> Hi,
>>
>> didn't find any report about this, so...
>>
>>   LD      .tmp_vmlinux1
>> drivers/built-in.o(.text+0xd85a1): In function `menu_select':
>> drivers/cpuidle/governors/menu.c:212: undefined reference to `__udivdi3'
>> make: *** [.tmp_vmlinux1] Error 1
>>
>> # gcc -v
>> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
>> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
>> Thread model: posix
>> gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-49)
>
> seems you're the only user of this left.

Oh my...

> it's not floating point but a 64 bit division.
> The only one I can imagine is the one on line 213
>
> looking at it, can you try sticking (u32) at the end of line 212; that multiply is not very likely to exceed 32 bits

Nopeee.

        data->predicted_us = DIV_ROUND_CLOSEST((u32)
                data->expected_us * data->correction_factor[data->bucket],
                (u32)RESOLUTION * DECAY);

It did properly rebuild drivers/cpuidle/governors/menu.o.
Still happening.
IOW it must be somewhere inside the DIV_ROUND_CLOSEST macro or so.

Andreas Mohr

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-07 17:34     ` Andreas Mohr
@ 2009-10-07 17:45       ` Arjan van de Ven
  2009-10-07 17:45       ` Kyle McMartin
  1 sibling, 0 replies; 9+ messages in thread
From: Arjan van de Ven @ 2009-10-07 17:45 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: linux-kernel, linux-acpi

Andreas Mohr wrote:
> Hi,
>> looking at it, can you try sticking (u32) at the end of line 212; that multiply is not very likely to exceed 32 bits
> 
> Nopeee.
> 
>         data->predicted_us = DIV_ROUND_CLOSEST((u32)
>                 data->expected_us * data->correction_factor[data->bucket],
>                 (u32)RESOLUTION * DECAY);
> 
> It did properly rebuild drivers/cpuidle/governors/menu.o.
> Still happening.
> IOW it must be somewhere inside the DIV_ROUND_CLOSEST macro or so.

it looks like your GCC has a problem dividing by a power of two though;
both DECAY and RESOLUTION are powers of two...

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-07 17:34     ` Andreas Mohr
  2009-10-07 17:45       ` Arjan van de Ven
@ 2009-10-07 17:45       ` Kyle McMartin
  2009-10-09 16:01         ` Andreas Mohr
  1 sibling, 1 reply; 9+ messages in thread
From: Kyle McMartin @ 2009-10-07 17:45 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: Arjan van de Ven, linux-kernel, linux-acpi

On Wed, Oct 07, 2009 at 07:34:58PM +0200, Andreas Mohr wrote:
> Nopeee.
> 
>         data->predicted_us = DIV_ROUND_CLOSEST((u32)
>                 data->expected_us * data->correction_factor[data->bucket],
>                 (u32)RESOLUTION * DECAY);
> 
> It did properly rebuild drivers/cpuidle/governors/menu.o.
> Still happening.
> IOW it must be somewhere inside the DIV_ROUND_CLOSEST macro or so.
> 

It's being a jerk and not realizing that RESOLUTION * DECAY is a power
of 2, so it can just do a shift...

I don't recall if gcc 3 had these magic builtins, but if it does,
something like this might help since it's the u64 case that's
problematic.

I probably noviced this in some trivial way, but it's a thought.
And in the most-annoying case (most of these u64 divisions are power of
2, that I've seen...) would sort things out.

regards, Kyle

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d3cd23f..4936eb6 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -51,6 +51,9 @@ extern const char linux_proc_banner[];
 #define DIV_ROUND_CLOSEST(x, divisor)(			\
 {							\
 	typeof(divisor) __divisor = divisor;		\
+	if (__builtin_types_compatible_p(typeof(divisor), unsigned long long) &&	\
+		__builtin_popcountll(__divisor) == 1)			\
+		(((x) + ((__divisor) / 2) << __builtin_ffsll(__divisor)));	\
 	(((x) + ((__divisor) / 2)) / (__divisor));	\
 }							\
 )

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-07 17:45       ` Kyle McMartin
@ 2009-10-09 16:01         ` Andreas Mohr
  2009-10-09 16:32           ` Arjan van de Ven
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Mohr @ 2009-10-09 16:01 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Andreas Mohr, Arjan van de Ven, linux-kernel, linux-acpi

Hi,

On Wed, Oct 07, 2009 at 01:45:54PM -0400, Kyle McMartin wrote:
> On Wed, Oct 07, 2009 at 07:34:58PM +0200, Andreas Mohr wrote:
> > Still happening.
> > IOW it must be somewhere inside the DIV_ROUND_CLOSEST macro or so.
> > 
> 
> It's being a jerk and not realizing that RESOLUTION * DECAY is a power
> of 2, so it can just do a shift...
> 
> I don't recall if gcc 3 had these magic builtins, but if it does,
> something like this might help since it's the u64 case that's
> problematic.

Uh... nope:

In file included from kernel/sched.c:1818:
kernel/sched_fair.c: In function `select_task_rq_fair':
kernel/sched_fair.c:1366: implicit declaration of function `__builtin_popcountll'
kernel/sched_fair.c:1366: implicit declaration of function `__builtin_ffsll'
kernel/sched_fair.c:1366: warning: suggest parentheses around + or - inside shift
kernel/sched.c: In function `update_sg_lb_stats':
kernel/sched.c:3755: warning: suggest parentheses around + or - inside shift
kernel/sched.c: In function `find_busiest_queue':
kernel/sched.c:4050: warning: suggest parentheses around + or - inside shift
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel] Error 2


Hmpf. Rather stuck now, ain'tcha, given that gcc 3.2.3 doesn't even have those?

Thanks,

Andreas Mohr

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-09 16:01         ` Andreas Mohr
@ 2009-10-09 16:32           ` Arjan van de Ven
  2009-10-09 17:08             ` Kyle McMartin
  0 siblings, 1 reply; 9+ messages in thread
From: Arjan van de Ven @ 2009-10-09 16:32 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: Kyle McMartin, linux-kernel, linux-acpi

Andreas Mohr wrote:
> Hi,
> 
> On Wed, Oct 07, 2009 at 01:45:54PM -0400, Kyle McMartin wrote:
>> On Wed, Oct 07, 2009 at 07:34:58PM +0200, Andreas Mohr wrote:
>>> Still happening.
>>> IOW it must be somewhere inside the DIV_ROUND_CLOSEST macro or so.
>>>
>> It's being a jerk and not realizing that RESOLUTION * DECAY is a power
>> of 2, so it can just do a shift...
>>
>> I don't recall if gcc 3 had these magic builtins, but if it does,
>> something like this might help since it's the u64 case that's
>> problematic.
> 
> Uh... nope:
> 
> In file included from kernel/sched.c:1818:
> kernel/sched_fair.c: In function `select_task_rq_fair':
> kernel/sched_fair.c:1366: implicit declaration of function `__builtin_popcountll'
> kernel/sched_fair.c:1366: implicit declaration of function `__builtin_ffsll'
> kernel/sched_fair.c:1366: warning: suggest parentheses around + or - inside shift
> kernel/sched.c: In function `update_sg_lb_stats':
> kernel/sched.c:3755: warning: suggest parentheses around + or - inside shift
> kernel/sched.c: In function `find_busiest_queue':
> kernel/sched.c:4050: warning: suggest parentheses around + or - inside shift
> make[1]: *** [kernel/sched.o] Error 1
> make: *** [kernel] Error 2
> 
> 
> Hmpf. Rather stuck now, ain'tcha, given that gcc 3.2.3 doesn't even have those?
> 

wonder if making a new define with the value of RESOLUTION * DECAY
(the actual value obviously) convinces your gcc that it really is a power of two ?

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-09 16:32           ` Arjan van de Ven
@ 2009-10-09 17:08             ` Kyle McMartin
  2009-10-09 17:12               ` Arjan van de Ven
  0 siblings, 1 reply; 9+ messages in thread
From: Kyle McMartin @ 2009-10-09 17:08 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Andreas Mohr, Kyle McMartin, linux-kernel, linux-acpi

On Fri, Oct 09, 2009 at 09:32:13AM -0700, Arjan van de Ven wrote:
>> Hmpf. Rather stuck now, ain'tcha, given that gcc 3.2.3 doesn't even have those?
>>
>
> wonder if making a new define with the value of RESOLUTION * DECAY
> (the actual value obviously) convinces your gcc that it really is a power of two ?
>

It shouldn't. Maybe just add a BUILD_BUG_ON and change the divide to a
shift directly. How expected are these values to ever change, really?

-Kyle

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

* Re: 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor)
  2009-10-09 17:08             ` Kyle McMartin
@ 2009-10-09 17:12               ` Arjan van de Ven
  0 siblings, 0 replies; 9+ messages in thread
From: Arjan van de Ven @ 2009-10-09 17:12 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: Andreas Mohr, linux-kernel, linux-acpi

Kyle McMartin wrote:
> On Fri, Oct 09, 2009 at 09:32:13AM -0700, Arjan van de Ven wrote:
>>> Hmpf. Rather stuck now, ain'tcha, given that gcc 3.2.3 doesn't even have those?
>>>
>> wonder if making a new define with the value of RESOLUTION * DECAY
>> (the actual value obviously) convinces your gcc that it really is a power of two ?
>>
> 
> It shouldn't. Maybe just add a BUILD_BUG_ON and change the divide to a
> shift directly. How expected are these values to ever change, really?
> 

so far... they haven't. I don't really expect these to change much.
maybe once a year or so... to other powers of two


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

end of thread, other threads:[~2009-10-09 17:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <alpine.LFD.2.01.0910041727310.3432@localhost.localdomain>
2009-10-07 10:41 ` 2.6.32-rc3: floating-point build failure (undefined reference to `__udivdi3' in menu governor) Andreas Mohr
2009-10-07 14:23   ` Arjan van de Ven
2009-10-07 17:34     ` Andreas Mohr
2009-10-07 17:45       ` Arjan van de Ven
2009-10-07 17:45       ` Kyle McMartin
2009-10-09 16:01         ` Andreas Mohr
2009-10-09 16:32           ` Arjan van de Ven
2009-10-09 17:08             ` Kyle McMartin
2009-10-09 17:12               ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).