linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Brownell <david-b@pacbell.net>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.arm.linux.org.uk
Subject: Re: (regression) kernel/timeconst.h bugs with HZ=128
Date: Tue, 26 Feb 2008 16:34:04 -0800	[thread overview]
Message-ID: <47C4AFFC.7090500@zytor.com> (raw)
In-Reply-To: <20080226160958.3f58a5c1.akpm@linux-foundation.org>

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

  reply	other threads:[~2008-02-27  0:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C4AFFC.7090500@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=david-b@pacbell.net \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).