From nobody Tue Jul 19 14:09:30 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 4LnLLL37WFz4XNwh; Tue, 19 Jul 2022 14:09: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 4LnLLL2TrLz3ZGk; Tue, 19 Jul 2022 14:09:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658239770; 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=kEHqSKi1QM8IY5FQhrBek2tyDY8n3zCgQI3LGS7kizA=; b=VIsc3lgh2ZEZRt0btI7VDaaZIvUpGIiyJq6QHT0Neq5zjnGF4ylLEEQzYgy/OE/XitsCZR WlY6UkONCTpklWIPc3NdPPzALb2t7QPuY/N+4BAqlgcJbtAFNqlUZEQPFUQadIcPPFoeZR MGWDIjlFqW8j7QCqGdj5YL+jxxxMhM0rybJvqQHZ09/tLDvDFIToQjRdoESE2qUcyCVkfi mdeCTwm3nfvSC11TsXZbhPdqi47wJgN/C2sTeWYppfycILK1qqIF3/xADN7VL47E3MQU22 b2kwuatBfetTjI+9pvsl+vuvt6UeMXRCOIfxcV6zRf2X2gNwBjmemVEXevVNLQ== 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 4LnLLL1bdCzLxq; Tue, 19 Jul 2022 14:09: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 26JE9Ud6052068; Tue, 19 Jul 2022 14:09:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26JE9UhC052067; Tue, 19 Jul 2022 14:09:30 GMT (envelope-from git) Date: Tue, 19 Jul 2022 14:09:30 GMT Message-Id: <202207191409.26JE9UhC052067@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: e6d31b4b70f0 - stable/13 - timecounter: Load the currently selected tc once in tc_windup() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e6d31b4b70f039f85420dd9ddf67e07651b72358 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658239770; 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=kEHqSKi1QM8IY5FQhrBek2tyDY8n3zCgQI3LGS7kizA=; b=bKP6Xj8SgYYa9OdYCBeHAro30XSjiNHwZPNOoF3DK9ygXf/5V+cFZku018ETscnLm68akW ee2HKyQWzLA10XChYvoj7CvoUI6cYhB7bPF30waO7OdBqf63EJjPqMjzYDcxb1RzKgRsnS tREEInrZO4BXLiOACnwA3Kpi/mKnBoEXDd8fTseXBBhOmIqqEo0gNgFincxHfFXvWnR7SE ejBueBKhnH7zVtACOKr1vwuZxvw8nY8UIDg6/lw/c2m1orCKjbdqDWN4c2CIaMqIS5Hv9P ocUnWhs2iIO14DCrfJn5peDzpAsHMekrIeNObyH9gMkaZtcg8HwedyjtZAywFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658239770; a=rsa-sha256; cv=none; b=kPxszrKUSC5bRGC+OsS82g8H5sibv7HAhuzUTPtsKxzaJ9xMHlubZOeNtlbD4CQ0dvtDlw 6vYcjSE1fARIiNP0SYksv8uJDTyGAPOXymD74gjotOfCuSCLAMOeH6WKnPKZLK9aT+vmR2 xp/fHNuS2kcAiG5Zx0M1JUKUeHJtvMYU1JbEmip6nyu4EibUuynp/ifhMqHwGZt8ZSRSmS hNx5bK+ri8BWuaGGQEjDI6+mk5pKUO+AeU3QN1hsKsC0weHK1UHDZw3M5eRM+OC2PMHW4k vpd0ehHwybjj4PcDJeXwEl2SN2QoXF1S7TH/ZckVlUyuHpMy/acrmx6kWF8zJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6d31b4b70f039f85420dd9ddf67e07651b72358 commit e6d31b4b70f039f85420dd9ddf67e07651b72358 Author: Mark Johnston AuthorDate: 2021-10-29 18:29:22 +0000 Commit: Mark Johnston CommitDate: 2022-07-19 13:59:14 +0000 timecounter: Load the currently selected tc once in tc_windup() Reported by: Sebastian Huber Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 26f76aea2d276aacb69a1f9d78558d6107155aed) --- sys/kern/kern_tc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index f06665a69488..469c5fa12c82 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1355,6 +1355,7 @@ static void tc_windup(struct bintime *new_boottimebin) { struct bintime bt; + struct timecounter *tc; struct timehands *th, *tho; u_int delta, ncount, ogen; int i; @@ -1383,9 +1384,10 @@ tc_windup(struct bintime *new_boottimebin) * changing timecounters, a counter value from the new timecounter. * Update the offset fields accordingly. */ + tc = atomic_load_ptr(&timecounter); delta = tc_delta(th); - if (th->th_counter != timecounter) - ncount = timecounter->tc_get_timecount(timecounter); + if (th->th_counter != tc) + ncount = tc->tc_get_timecount(tc); else ncount = 0; #ifdef FFCLOCK @@ -1440,17 +1442,17 @@ tc_windup(struct bintime *new_boottimebin) bintime2timespec(&bt, &th->th_nanotime); /* Now is a good time to change timecounters. */ - if (th->th_counter != timecounter) { + if (th->th_counter != tc) { #ifndef __arm__ - if ((timecounter->tc_flags & TC_FLAGS_C2STOP) != 0) + if ((tc->tc_flags & TC_FLAGS_C2STOP) != 0) cpu_disable_c2_sleep++; if ((th->th_counter->tc_flags & TC_FLAGS_C2STOP) != 0) cpu_disable_c2_sleep--; #endif - th->th_counter = timecounter; + th->th_counter = tc; th->th_offset_count = ncount; - tc_min_ticktock_freq = max(1, timecounter->tc_frequency / - (((uint64_t)timecounter->tc_counter_mask + 1) / 3)); + tc_min_ticktock_freq = max(1, tc->tc_frequency / + (((uint64_t)tc->tc_counter_mask + 1) / 3)); recalculate_scaling_factor_and_large_delta(th); #ifdef FFCLOCK ffclock_change_tc(th);