From nobody Mon Nov 22 13:46:23 2021 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 4A49E18A1300; Mon, 22 Nov 2021 13:46:24 +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 4HyT7z5Ztfz3lTC; Mon, 22 Nov 2021 13:46:23 +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 71D54235F7; Mon, 22 Nov 2021 13:46:23 +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 1AMDkNYf037557; Mon, 22 Nov 2021 13:46:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AMDkNFk037556; Mon, 22 Nov 2021 13:46:23 GMT (envelope-from git) Date: Mon, 22 Nov 2021 13:46:23 GMT Message-Id: <202111221346.1AMDkNFk037556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 686b143f37c5 - stable/13 - timecounter: Initialize tc_lock earlier 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 686b143f37c501c79c0ddbbcb55ce852cc0bc846 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=686b143f37c501c79c0ddbbcb55ce852cc0bc846 commit 686b143f37c501c79c0ddbbcb55ce852cc0bc846 Author: Mark Johnston AuthorDate: 2021-11-19 22:29:28 +0000 Commit: Mark Johnston CommitDate: 2021-11-22 13:44:49 +0000 timecounter: Initialize tc_lock earlier Hyper-V wants to register its MSR-based timecounter during SI_SUB_HYPERVISOR, before SI_SUB_LOCK, since an emulated 8254 may not be available for DELAY(). So we cannot use MTX_SYSINIT to initialize the timecounter lock. PR: 259878 Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 3339950117bedb5f880f6c08982dcc5dd43f9c34) --- sys/kern/kern_tc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 135279d48a22..989457b82434 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -100,7 +100,6 @@ static struct timecounter *timecounters = &dummy_timecounter; /* Mutex to protect the timecounter list. */ static struct mtx tc_lock; -MTX_SYSINIT(tc_lock, &tc_lock, "tc", MTX_DEF); int tc_min_ticktock_freq = 1; @@ -1982,6 +1981,8 @@ inittimehands(void *dummy) TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable, sizeof(tc_from_tunable)); + + mtx_init(&tc_lock, "tc", NULL, MTX_DEF); } SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);