LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* (regression) kernel/timeconst.h bugs with HZ=128
@ 2008-02-26 18:32 David Brownell
  2008-02-27  0:09 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: David Brownell @ 2008-02-26 18:32 UTC (permalink / raw)
  To: linux-kernel

I see these warnings on 32 bit ARM systems:

  CC      kernel/time.o
kernel/time.c: In function 'msecs_to_jiffies':
kernel/time.c:472: warning: integer constant is too large for 'long' type
kernel/time.c: In function 'usecs_to_jiffies':
kernel/time.c:487: warning: integer constant is too large for 'long' type

Line 472: 
	return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
line 487:
	return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32)

The problem seems to be that these constants from kernel/timeconst.h
have too many digits:

#define ONLY_THIRTYTWO_BITS	0x01234567

#define MSEC_TO_HZ_ADJ32        0x3f7ced916
#define USEC_TO_HZ_ADJ32        0xfffbce4217d

Those *_ADJ32 constants should have "ULL" suffixes, yes?
Adding that by hand resolves the problem, but only until
the next time that header file gets regenerated.

Someone with observable Perl-fu should fix this ...

- Dave


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

* Re: (regression) kernel/timeconst.h bugs with HZ=128
  2008-02-26 18:32 (regression) kernel/timeconst.h bugs with HZ=128 David Brownell
@ 2008-02-27  0:09 ` Andrew Morton
  2008-02-27  0:34   ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-02-27  0:09 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-kernel, H. Peter Anvin, linux-arm-kernel

On Tue, 26 Feb 2008 10:32:24 -0800 David Brownell <david-b@pacbell.net> wrote:

> I see these warnings on 32 bit ARM systems:
> 
>   CC      kernel/time.o
> kernel/time.c: In function 'msecs_to_jiffies':
> kernel/time.c:472: warning: integer constant is too large for 'long' type
> kernel/time.c: In function 'usecs_to_jiffies':
> kernel/time.c:487: warning: integer constant is too large for 'long' type
> 
> Line 472: 
> 	return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
> line 487:
> 	return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32)
> 
> The problem seems to be that these constants from kernel/timeconst.h
> have too many digits:
> 
> #define ONLY_THIRTYTWO_BITS	0x01234567
> 
> #define MSEC_TO_HZ_ADJ32        0x3f7ced916
> #define USEC_TO_HZ_ADJ32        0xfffbce4217d
> 
> Those *_ADJ32 constants should have "ULL" suffixes, yes?
> Adding that by hand resolves the problem, but only until
> the next time that header file gets regenerated.
> 
> Someone with observable Perl-fu should fix this ...
> 

(cc's added)

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

* Re: (regression) kernel/timeconst.h bugs with HZ=128
  2008-02-27  0:09 ` Andrew Morton
@ 2008-02-27  0:34   ` H. Peter Anvin
  0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2008-02-27  0:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Brownell, linux-kernel, linux-arm-kernel

Andrew Morton wrote:
> On Tue, 26 Feb 2008 10:32:24 -0800 David Brownell <david-b@pacbell.net> wrote:
> 
>> I see these warnings on 32 bit ARM systems:
>>
>>   CC      kernel/time.o
>> kernel/time.c: In function 'msecs_to_jiffies':
>> kernel/time.c:472: warning: integer constant is too large for 'long' type
>> kernel/time.c: In function 'usecs_to_jiffies':
>> kernel/time.c:487: warning: integer constant is too large for 'long' type
>>
>> Line 472: 
>> 	return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
>> line 487:
>> 	return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32)
>>
>> The problem seems to be that these constants from kernel/timeconst.h
>> have too many digits:
>>
>> #define ONLY_THIRTYTWO_BITS	0x01234567
>>
>> #define MSEC_TO_HZ_ADJ32        0x3f7ced916
>> #define USEC_TO_HZ_ADJ32        0xfffbce4217d
>>
>> Those *_ADJ32 constants should have "ULL" suffixes, yes?
>> Adding that by hand resolves the problem, but only until
>> the next time that header file gets regenerated.
>>
>> Someone with observable Perl-fu should fix this ...
>>
> 

<barf>

The real issue is that we don't have any equivalent to the UINTxx_C() 
creation macros in Linux, and even though we're using a cast -- which is 
totally correct -- makes gcc issue a (spurious) warning.

The right thing would be to create _C() macros and use those in the C 
code, i.e. UINT64_C(MSEC_TO_HZ_MUL32).

I'll write up a patch, but probably not today.

	-hpa

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

* Re: (regression) kernel/timeconst.h bugs with HZ=128
  2008-04-06  7:29   ` (regression) kernel/timeconst.h bugs with HZ=128 David Brownell
@ 2008-04-06 17:58     ` H. Peter Anvin
  0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2008-04-06 17:58 UTC (permalink / raw)
  To: David Brownell; +Cc: Rafael J. Wysocki, Linux Kernel Mailing List

David Brownell wrote:
> 
> The (new) compiler warnings are still being issued, yes.
> 

I have a cleaner patchset prepared than the one that got bikeshed 
painted out of existence, but I want to wait until post-2.6.25 for it.

The nice thing is that it deletes a lot more code than it adds:

  include/asm-alpha/types.h      |   36 --------------
  include/asm-arm/types.h        |   33 -------------
  include/asm-avr32/types.h      |   32 -------------
  include/asm-blackfin/types.h   |   34 -------------
  include/asm-cris/types.h       |   33 -------------
  include/asm-frv/types.h        |   34 -------------
  include/asm-generic/Kbuild     |    2
  include/asm-generic/int-l64.h  |   71 ++++++++++++++++++++++++++++
  include/asm-generic/int-ll64.h |   76 +++++++++++++++++++++++++++++++
  include/asm-h8300/types.h      |   33 -------------
  include/asm-ia64/types.h       |   31 ------------
  include/asm-m32r/types.h       |   32 -------------
  include/asm-m68k/types.h       |   32 -------------
  include/asm-mips/types.h       |   56 ++--------------------
  include/asm-mn10300/types.h    |   33 -------------
  include/asm-parisc/types.h     |   33 -------------
  include/asm-powerpc/types.h    |   48 ++-----------------
  include/asm-s390/types.h       |   48 ++-----------------
  include/asm-sh/types.h         |   34 -------------
  include/asm-sparc/types.h      |   30 ------------
  include/asm-sparc64/types.h    |   30 ------------
  include/asm-v850/types.h       |   32 -------------
  include/asm-x86/types.h        |   38 ---------------
  include/asm-xtensa/types.h     |   33 -------------
  kernel/time.c                  |    8 +--
  25 files changed, 201 insertions(+), 701 deletions(-)

See:

git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-inttypes.git

	-hpa


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

* Re: (regression) kernel/timeconst.h bugs with HZ=128
       [not found] ` <pdYe6zNQVl.A.-CB.KGW9HB@albercik>
@ 2008-04-06  7:29   ` David Brownell
  2008-04-06 17:58     ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: David Brownell @ 2008-04-06  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux Kernel Mailing List, H. Peter Anvin

On Thursday 03 April 2008, Rafael J. Wysocki wrote:
> The following report is on the current list of known regressions
> from 2.6.24.  Please verify if the issue is still present in the
> mainline.
> 
> 
> Bug-Entry	: http://bugzilla.kernel.org/show_bug.cgi?id=10153
> Subject		: (regression) kernel/timeconst.h bugs with HZ=128

The (new) compiler warnings are still being issued, yes.


> Submitter	: David Brownell <david-b@pacbell.net>
> Date		: 2008-02-26 19:32 (38 days old)
> References	: http://lkml.org/lkml/2008/2/26/294
> Handled-By	: H. Peter Anvin <hpa@zytor.com>
> Patch		: http://bugzilla.kernel.org/attachment.cgi?id=15114&amp;action=view
> 		  http://bugzilla.kernel.org/attachment.cgi?id=15115&amp;action=view
> 
> 



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

end of thread, other threads:[~2008-04-06 17:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 18:32 (regression) kernel/timeconst.h bugs with HZ=128 David Brownell
2008-02-27  0:09 ` Andrew Morton
2008-02-27  0:34   ` H. Peter Anvin
2008-04-03 22:49 2.6.25-rc8-git2: Reported regressions from 2.6.24 Rafael J. Wysocki
     [not found] ` <pdYe6zNQVl.A.-CB.KGW9HB@albercik>
2008-04-06  7:29   ` (regression) kernel/timeconst.h bugs with HZ=128 David Brownell
2008-04-06 17:58     ` H. Peter Anvin

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).