From owner-svn-src-all@FreeBSD.ORG Wed Apr 13 22:29:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 561BC106564A; Wed, 13 Apr 2011 22:29:04 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-px0-f172.google.com (mail-px0-f172.google.com [209.85.212.172]) by mx1.freebsd.org (Postfix) with ESMTP id 1CE4E8FC13; Wed, 13 Apr 2011 22:29:03 +0000 (UTC) Received: by pxi6 with SMTP id 6so933330pxi.17 for ; Wed, 13 Apr 2011 15:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=iFLJ0H//R6pe2C45KOIjUcAC7KSBLESztwI/5Ar/e98=; b=RmmeKxmQWuCMuxi+mvkc5aTJz7E1r79iWfpz2wRb0l8j9Tdg2HhkEFZsjYWCCKLeFl krsHpiV/tu6VXxta3lCOt1q78FKEy5HvEUPIyTFbEGE9hHito/H1W57UQqndnygxjYgu zNNM5JDIYoZTLbEDlJKyVTPTKx7YVe5liTl78= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wno9B2WdDMvgWKbM22ZxjggB4aqfuqlR7T8hSsnldivVP2IZcswNsvwz0XWy7JxJ6C HhVYwoCfhyXhd3cmqHA/2D4SY3QkqqBG9ga1hI3EiNVywPs8MGjmtZ/FdHdbjuM+j/ot E0/jHbdS3v2qSjrteZYXRAyopwAdkgPhgynMQ= MIME-Version: 1.0 Received: by 10.142.237.20 with SMTP id k20mr23713wfh.170.1302733743579; Wed, 13 Apr 2011 15:29:03 -0700 (PDT) Received: by 10.68.42.3 with HTTP; Wed, 13 Apr 2011 15:29:03 -0700 (PDT) In-Reply-To: <4DA61A70.8040609@FreeBSD.org> References: <201104122349.p3CNn7kK039179@svn.freebsd.org> <4DA6189A.5040200@FreeBSD.org> <4DA61A70.8040609@FreeBSD.org> Date: Wed, 13 Apr 2011 15:29:03 -0700 Message-ID: From: Garrett Cooper To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jung-uk Kim Subject: Re: svn commit: r220584 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2011 22:29:04 -0000 On Wed, Apr 13, 2011 at 2:49 PM, Dimitry Andric wrote: > On 2011-04-13 23:41, Dimitry Andric wrote: > ... >> >> But I don't really see why, yet. :) =A0With r220532, it worked fine. > > Ah, I failed to notice the commit that came before, r220583. > Apparently, it can happen (at least in a VM environment) that the > DELAY(1000) in this fragment from cpu_est_clockrate(): > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0wrmsr(MSR_MPERF, 0); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0wrmsr(MSR_APERF, 0); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tsc1 =3D rdtsc(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DELAY(1000); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mcnt =3D rdmsr(MSR_MPERF); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acnt =3D rdmsr(MSR_APERF); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tsc2 =3D rdtsc(); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0intr_restore(reg); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0perf =3D 1000 * acnt / mcnt; > > will still read 0 from MSR_MPERF, leading to a division by zero. =A0Maybe > just fallback to the second method in the 'else' branch then? Yeah, it kind of peeves me that this kind of rinky dink stuff is done with VMware ESXi, etc (fake RAM returning 0MHz in the SMBIOS table in certain scenarios). Thanks, -Garrett