From: David Miller <davem@davemloft.net>
To: tglx@linutronix.de
Cc: johnstul@us.ibm.com, linux-kernel@vger.kernel.org, peter.keilty@hp.com
Subject: Re: [PATCH]: tick-sched.c build fix
Date: Mon, 26 Feb 2007 11:22:39 -0800 (PST) [thread overview]
Message-ID: <20070226.112239.112290727.davem@davemloft.net> (raw)
In-Reply-To: <1172394281.25076.361.camel@localhost.localdomain>
From: Thomas Gleixner <tglx@linutronix.de>
Date: Sun, 25 Feb 2007 10:04:41 +0100
> On Sat, 2007-02-24 at 21:42 -0800, David Miller wrote:
> > While getting dynticks/hrtimers up on sparc64 I ran into
> > the following build problem. If you use get_irq_regs() you
> > need to include asm/irq_regs.h
> >
> > Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Thanks for reviewing Thomas, I'll push the two bug fixes I
posted, with your ACKs, to Linus.
Two things remaining:
1) The change of clocksource_done_booting() to an fs_initcall()
really is necessary. Could you please push that to Linus?
2) I got bit by shifting problems (again) on sparc64.
Let me elaborate about #2. Nobody writing these timer drivers
should be concerned by all of these details, I think, they will
get it wrong just as I did.
In my case a shift of 32 was too high for TSC based clockevent
on Niagara.
What we really should do is provide a clockevent_init_multshift()
or whatever that takes ticks_per_sec as an argument and this
function figured out an appropriate shift and multiplier to use.
It could be as simple as:
void clockevent_set_multshift(struct clock_event_device *edev, unsigned long hz)
{
u64 mult;
int shift = 32;
while (1) {
mult = div_sc(hz, NSEC_PER_SEC, shift);
if (mult && (mult >> 32UL) == 0UL)
break;
shift--;
}
edev->shift = shift;
edev->mult = (u32) mult;
}
With this, nobody will get bit by problems again. We should
provide something similar, if not identical, for clocksources
too. Perhaps we could even start trying at initial shift values
larger than 32.
What do you think?
Another thing I noticed is that clock_event_device->mult is
declared as an unsigned long, but it is clearly limited to
being a u32 as it is used as the second argument to do_div().
BTW, that's how I hit the Niagara shift issue, divide by zero
in clockevent_delta2ns() :-)
next prev parent reply other threads:[~2007-02-26 19:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-25 5:42 David Miller
2007-02-25 9:04 ` Thomas Gleixner
2007-02-26 19:22 ` David Miller [this message]
2007-02-26 23:32 ` David Miller
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=20070226.112239.112290727.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.keilty@hp.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®