Date: Mon, 27 Oct 2008 14:11:11 -0400 From: John Baldwin <jhb@freebsd.org> To: Maxim Sobolev <sobomax@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184293 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200810271411.11813.jhb@freebsd.org> In-Reply-To: <200810261858.m9QIw4YV091893@svn.freebsd.org> References: <200810261858.m9QIw4YV091893@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810271411.11813.jhb>