svn commit: r184293 - in head/sys: amd64/amd64 i386/i386
John Baldwin
jhb at freebsd.org
Mon Oct 27 12:21:26 PDT 2008
On Sunday 26 October 2008 02:58:04 pm Maxim Sobolev wrote:
> Author: sobomax
> Date: Sun Oct 26 18:58:04 2008
> New Revision: 184293
> URL: http://svn.freebsd.org/changeset/base/184293
>
> Log:
> Fix division by zero panic if kern.hz less than 32.
>
> MFC after: 1 day
This is wrong. In the case you are worried about here, lapic_timer_hz is less
than 128. There is no way you are going to fire stathz 128 times per second
from a timer running at < 128 hz. You are effectively running stathz at
lapic_timer_hz, so I would just set stathz = lapic_timer_hz in this case.
Also, I would drop the extra {}'s to match style(9) as well as the existing
style of the file.
> Modified:
> head/sys/amd64/amd64/local_apic.c
> head/sys/i386/i386/local_apic.c
>
> Modified: head/sys/amd64/amd64/local_apic.c
>
==============================================================================
> --- head/sys/amd64/amd64/local_apic.c Sun Oct 26 17:20:37 2008 (r184292)
> +++ head/sys/amd64/amd64/local_apic.c Sun Oct 26 18:58:04 2008 (r184293)
> @@ -401,7 +401,11 @@ lapic_setup_clock(void)
> lapic_timer_hz = hz * 2;
> else
> lapic_timer_hz = hz * 4;
> - stathz = lapic_timer_hz / (lapic_timer_hz / 128);
> + if (lapic_timer_hz < 128) {
> + stathz = 128;
> + } else {
> + stathz = lapic_timer_hz / (lapic_timer_hz / 128);
> + }
> profhz = lapic_timer_hz;
> lapic_timer_period = value / lapic_timer_hz;
--
John Baldwin
More information about the svn-src-all
mailing list