From nobody Mon Jan 03 18:01:20 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7647C193F258; Mon, 3 Jan 2022 18:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JSNpn0s0dz4t5M; Mon, 3 Jan 2022 18:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFDB01B9E; Mon, 3 Jan 2022 18:01:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 203I1KgB094969; Mon, 3 Jan 2022 18:01:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 203I1KZI094968; Mon, 3 Jan 2022 18:01:20 GMT (envelope-from git) Date: Mon, 3 Jan 2022 18:01:20 GMT Message-Id: <202201031801.203I1KZI094968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0e494a9e3fd8 - main - x86: Skip late calibration if our reference timer has low quality List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e494a9e3fd86ef54899dcbe0268866629096c1e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641232881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E4LIw8gmfUvROyV/4jxxb3Qr2WLXTqPS+dbocJQopMI=; b=WrIQjM0Ume+GBIYXRMW9CkRe8aMBdu+1S9XtsbxaaHYnKhaUPCE/jBQ3K97EjrHrCxUpn6 mFc0X8D3Wx5Gi4glYzr0nqrYlVvp38A89UyBg1i04FanTA8rWLl1BpoOBu/+bbEFxRatdE H7CmJE9TpWuS8/jT2/WhZDBBBIVvNrREyUQiGcw8gn9CG26enk3nw0kai4sfOyiBDtNPWn J0H+PFcNFqoMvBCRZgaKkVNs3XHOGEK6R8DInXJ7gATV2Ml4C+d5BVIERk5lRwBMqI+31q HUtv4jfWcwqZBeOUE5eglvJZWtmmXqVLaJuaMsFUhhx5IzLAW+3O/fURV6KUQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641232881; a=rsa-sha256; cv=none; b=ng8vko1FryxSejbURoi4SJjvHVkdA9PWt4cRdY24n2aMDjf9ulpwPvPR637HHOjzE72YXW 0TE+3fY471kQIsXQv9fWSODp57IfM9Ct1SSjOx9Ex79i8+NYjsKp5ZnXLqEx/nptOSJH2P eekwYbUEcPS6pC8Ba3mRyG/FDG1rC1tfbfdMV2Lj891WuTyOHirY3fgaFfHkpD/uRBQegg 8wTMAVIEAvXgFE5JFiQqQg2L8COpXUgQ7tENmusiJmbPiCexyt8vYjRegvFPNhnioUslQs v0SEzO1HBYMmiRBKTU7ZH30nz/+fkrmSl69g0i1QkWbx5JWM35HQVL9JBxy1Fw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0e494a9e3fd86ef54899dcbe0268866629096c1e commit 0e494a9e3fd86ef54899dcbe0268866629096c1e Author: Mark Johnston AuthorDate: 2022-01-03 15:14:41 +0000 Commit: Mark Johnston CommitDate: 2022-01-03 18:00:50 +0000 x86: Skip late calibration if our reference timer has low quality Some AMD Geode-based systems end up using the 8254 PIT to calibrate the TSC during late calibration, which doesn't work because that timecounter's mask (65535) is much smaller than its frequency (1193182). Moreover, early calibration is done against the 8254 timer anyway. Work around the problem by simply using early calibration results if no high-quality timecounters exist. PR: 260868 Fixes: 22875f88799e ("x86: Implement deferred TSC calibration") Reported and tested by: mike@sentex.net, Stefan Hegnauer Reviewed by: imp, kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33730 --- sys/x86/x86/tsc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 29da37ca6874..3b2e044573f1 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -714,7 +714,14 @@ tsc_calibrate(void) if (tsc_early_calib_exact) goto calibrated; + /* + * Avoid using a low-quality timecounter to re-calibrate. In + * particular, old 32-bit platforms might only have the 8254 timer to + * calibrate against. + */ tc = atomic_load_ptr(&timecounter); + if (tc->tc_quality <= 0) + goto calibrated; flags = intr_disable(); cpu = curcpu;