From nobody Mon Jul 11 19:59:02 2022 X-Original-To: dev-commits-src-main@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 DD4FB12AEA17; Mon, 11 Jul 2022 19:59:02 +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 4LhZTL5m9Nz3h3d; Mon, 11 Jul 2022 19:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657569542; 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=JXw5PPQlwZpB/diW/SPs7EhMDanS0SwyrxS77W4Z0oI=; b=kvQ/QoOK4coakz2KtR3/aTRArxAgbmJpNBYC7YIyLqzx9N0bw9HM7Y3dQFuBg1bZta46Za ap6+axIpxKTqAwQ5YrWnGES94Up2ZIDhK8BJih2VvvSQGpj4wTwPesm2bQmDvszDL2lTKQ mDjYxpgPbuNpkheEB9zGDH8lUMD5fUGn+2WnbcBG0awRcTF1pMtc2YX36HiUXTTpDh2Vt7 ECxFWHjb4tKS+zsWOSPU1ihjc0DfIIfbv3G9Pk+NI0ALRWSFhmwtJmTkSGAQ7RV8u2CTFM tvuo8lYbvqAqYYWmEOVJBG//J/HyAG62vAObJxPZRi/QVgSdfU6ISu5bYMf05w== 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 4LhZTL4smxzGV6; Mon, 11 Jul 2022 19:59:02 +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 26BJx2YE003263; Mon, 11 Jul 2022 19:59:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26BJx2wL003262; Mon, 11 Jul 2022 19:59:02 GMT (envelope-from git) Date: Mon, 11 Jul 2022 19:59:02 GMT Message-Id: <202207111959.26BJx2wL003262@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: ebb3cb61958d - main - eventtimer: Pass a pcpu state pointer to getnext(cpu)event() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: ebb3cb61958da8bcc3c28ec3b20dc3a6b8168952 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657569542; 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=JXw5PPQlwZpB/diW/SPs7EhMDanS0SwyrxS77W4Z0oI=; b=bh6wI2b6d5ukOW5ivyQjcZOFJ726AhCRrrYde9QO9FcQ6IcoS9yNyj4B46QbuokOyU3WJY LnrLc3WWuZmk+P+mBPSJmFHCzH0fMS95EY/901kEqhA5ckKay6vKGeDJ5UfXocvXMsDRvU RjazfeFYxzz/3bvX7xNN3RBtcaLzxFsMKYlrqfkAo/u4nMSJtTx9HfCJ0YiFAZ6h6q8zi7 1bQVykvaJ6MVBENmD6+P0B9N9+UC9arX/UlmnOV+W+tFcONWyJ8vy5+j9kxLWL3FMMxNjd AUSWPDzxEWMOhajF+UZHDwRbnfCkM3FufFQvIMIyxxdMRS6YkbN8YfDLmZyOHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657569542; a=rsa-sha256; cv=none; b=IQCidrw3yHlLvIVDqZsoWqXqbohv2EDjoDUlfcr495lpae3YW9wxFwDtavnh1MKTO5Gxxb oe2TnaT5zHqv/TzEyc1jlSEDh+5H4lJrFF0uiuSCGM1Ay39VUAztzVnSJ6KVpgMClYfswP wr+DSCayhcbfL18ccVDyTZqGtw1Iy2jZ5wiL7jkbrWd10MGmJeTIripzFyjyy5AylE5//k 1e9PidzUgKoVfWBLoM5t1RFmM/l6wWL1FRhq2il//A207UkB6QDN+NPtUoutesheEg/EBe aAicXYhc/qfdJY9nnDwb5P0ECT1tbtMWU4cOcKDgO9VJBhLneNoz2HmF6FFHtw== 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=ebb3cb61958da8bcc3c28ec3b20dc3a6b8168952 commit ebb3cb61958da8bcc3c28ec3b20dc3a6b8168952 Author: Mark Johnston AuthorDate: 2022-07-11 19:38:43 +0000 Commit: Mark Johnston CommitDate: 2022-07-11 19:58:43 +0000 eventtimer: Pass a pcpu state pointer to getnext(cpu)event() Callers have already loaded the pointer, so these functions don't need to fetch it again. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_clocksource.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index 48e06ee082fc..9d53d1242482 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -65,8 +65,9 @@ static int doconfigtimer(void); static void configtimer(int start); static int round_freq(struct eventtimer *et, int freq); -static sbintime_t getnextcpuevent(int idle); -static sbintime_t getnextevent(void); +struct pcpu_state; +static sbintime_t getnextcpuevent(struct pcpu_state *state, int idle); +static sbintime_t getnextevent(struct pcpu_state *state); static int handleevents(sbintime_t now, int fake); static struct mtx et_hw_mtx; @@ -213,7 +214,7 @@ handleevents(sbintime_t now, int fake) callout_process(now); } - t = getnextcpuevent(0); + t = getnextcpuevent(state, 0); ET_HW_LOCK(state); if (!busy) { state->idle = 0; @@ -229,13 +230,11 @@ handleevents(sbintime_t now, int fake) * Schedule binuptime of the next event on current CPU. */ static sbintime_t -getnextcpuevent(int idle) +getnextcpuevent(struct pcpu_state *state, int idle) { sbintime_t event; - struct pcpu_state *state; u_int hardfreq; - state = DPCPU_PTR(timerstate); /* Handle hardclock() events, skipping some if CPU is idle. */ event = state->nexthard; if (idle) { @@ -266,9 +265,8 @@ getnextcpuevent(int idle) * Schedule binuptime of the next event on all CPUs. */ static sbintime_t -getnextevent(void) +getnextevent(struct pcpu_state *state) { - struct pcpu_state *state; sbintime_t event; #ifdef SMP int cpu; @@ -278,7 +276,6 @@ getnextevent(void) c = -1; #endif - state = DPCPU_PTR(timerstate); event = state->nextevent; #ifdef SMP if ((timer->et_flags & ET_FLAGS_PERCPU) == 0) { @@ -385,10 +382,10 @@ loadtimer(sbintime_t now, int start) uint64_t tmp; int eq; - if (timer->et_flags & ET_FLAGS_PERCPU) { - state = DPCPU_PTR(timerstate); + state = DPCPU_PTR(timerstate); + if (timer->et_flags & ET_FLAGS_PERCPU) next = &state->nexttick; - } else + else next = &nexttick; if (periodic) { if (start) { @@ -407,7 +404,7 @@ loadtimer(sbintime_t now, int start) et_start(timer, new, timerperiod); } } else { - new = getnextevent(); + new = getnextevent(state); eq = (new == *next); CTR4(KTR_SPARE2, "load at %d: next %d.%08x eq %d", curcpu, (int)(new >> 32), (u_int)(new & 0xffffffff), eq); @@ -778,7 +775,7 @@ cpu_idleclock(void) now = sbinuptime(); CTR3(KTR_SPARE2, "idle at %d: now %d.%08x", curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); - t = getnextcpuevent(1); + t = getnextcpuevent(state, 1); ET_HW_LOCK(state); state->idle = 1; state->nextevent = t;