From nobody Tue Feb 28 03:00:30 2023 X-Original-To: dev-commits-src-branches@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 4PQhv256WGz3tp17; Tue, 28 Feb 2023 03:00:30 +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 4PQhv23lNvz4Nl7; Tue, 28 Feb 2023 03:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677553230; 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=88NjhhiV5cs5Alt0U5H9M0pw0wlE1O/inp6a9QsuWmY=; b=t3t/aXtvO3rsk9Tp4tFbCPyaG5WhnBMpFI+KkPmsFFbFK7Qy+gJG9Fh0SI5mvA5OHjDZkr 2IPTJpLhwAA69Of7ujxPNQYDq4TChP9iqCuftzvZxqoKNjKhyPBKYg3vn44oguIy3diV5/ uQ4Hz3a3L9pjk7BQaWf/RZPTY7+A2qQ7yFfaJrM2nA5Utjjw4Mj3cDZTXfG/kvjlaMmlWE X5bSx7TS/MVSLMnczCHwNL1MwmfhPYSlyRCcIxJ3m/B8zGEZsVT12HXDcyBcSTOR84FT7X S2agxKt/1cQzM87QyxsrxvLcp9N2WmHB7j6lYzc1kBchxW9nzTOuvuhHgiaCng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677553230; 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=88NjhhiV5cs5Alt0U5H9M0pw0wlE1O/inp6a9QsuWmY=; b=cf2pQD0QSeLHdMLIPCuwhtIoYsU8FQj4BXL1e9mHVk/k3wHdIgJiO54YXCFKUKbucqpKfc WLgRFcjLxRLQEuCOxn1HiDn0DVGrdadb8K46zDtdwrusz0xHQxymeLRutH63vzoCZZhU4c 4YbkCwGdT03mFEFgwvWABMA41rOvt01loSiOdNNtvJTSf3SMXe7FavEshyD1bUWwkUmj28 65G4pCdZjKjVu8V4m3Dzw3wZC5uA26XPzNdiGxjGTDKcPT0VBb6tsg19M6CDeJ6u7oqfsr 9nABDpNM9hUfUHb7d36zTK9YCS+iVhQfMoSUlk5e6xOrEOCxsSR8HX0Kjrlmew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677553230; a=rsa-sha256; cv=none; b=V5vvkGcjwde8RyTVuVo7iRfBeU3m9rU3XQin+HNaHqYVddyzOaZXIqJVzsbcvVaERaWbPC oagS3m6CXy+GQq7M5/I0z6AFwD/41m85BQh0apttsCEMoh+MUlqLzGq0cF3OiXcxwhxi/a pcDhAgCUN1kCAgebxzYXOnlBuOeE51xO8+Dz12RmIzVM898LDtTwSLYaDbsuYwpvnWf8EJ IsKqK4cMi7IfL/XT4DCuRl0S3dEsy8smlwvSDixtGNnZ7qPbu+ZW7Oed6ifjxmAdZRJi3G MlGUb26cI4sdIU8BuRIwKMT3Rc8VHsL3zQxkveOMuoQhb5AcUx5THio+leqyZg== 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 4PQhv22WsGzr9B; Tue, 28 Feb 2023 03:00:30 +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 31S30UKR098635; Tue, 28 Feb 2023 03:00:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31S30UrQ098634; Tue, 28 Feb 2023 03:00:30 GMT (envelope-from git) Date: Tue, 28 Feb 2023 03:00:30 GMT Message-Id: <202302280300.31S30UrQ098634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a1c63b8e29e8 - stable/13 - apic: prevent divide by zero in CPU frequency init List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a1c63b8e29e832d9ada7c252e7e80ce8b94aeb41 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a1c63b8e29e832d9ada7c252e7e80ce8b94aeb41 commit a1c63b8e29e832d9ada7c252e7e80ce8b94aeb41 Author: Mina Galić AuthorDate: 2023-02-28 02:58:45 +0000 Commit: Warner Losh CommitDate: 2023-02-28 02:58:45 +0000 apic: prevent divide by zero in CPU frequency init If a CPU for some reason returns 0 as CPU frequency, we currently panic on the resulting divide by zero when trying to initialize the CPU(s) via APIC. When this happens, we'll fallback to measuring the frequency instead. PR: 269767 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/664 (cherry picked from commit 499171a98c8813e4dc6e085461d5c47750efa555) --- sys/x86/x86/local_apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 4ab4e78f20e7..482b0ebd81bc 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -1027,7 +1027,7 @@ lapic_calibrate_initcount_cpuid_vm(void) /* Record divided frequency. */ count_freq = freq / lapic_timer_divisor; - return (true); + return (count_freq != 0); } static uint64_t