From nobody Wed Dec 08 17:35:27 2021 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 5DE6E18D8EF9; Wed, 8 Dec 2021 17:35:28 +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 4J8PSv6wggz4p6M; Wed, 8 Dec 2021 17:35:27 +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 CDC9017713; Wed, 8 Dec 2021 17:35:27 +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 1B8HZRjo017133; Wed, 8 Dec 2021 17:35:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B8HZRaB017132; Wed, 8 Dec 2021 17:35:27 GMT (envelope-from git) Date: Wed, 8 Dec 2021 17:35:27 GMT Message-Id: <202112081735.1B8HZRaB017132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 9a128e1678d1 - main - mca: Switch to using taskqueue_enqueue_timeout_sbt(). 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: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a128e1678d1d22a2d4855784b511c0cb370189e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638984928; 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=OsVC5l1tTEerS1vyrlH+It4tGKHq2PumdXqrmmGz/uQ=; b=dK5/bZlrWZuElqYNJhSSTjto1JilRy+YY3OrmoOSCs1h5raFmsPgTnmR/3eQVzUa1XyiTq iSZP9lkQyOlSp1nraPGiSurkBgNjSPYZITTI3N6Hal8QOEam3kbK9crHP/kT9gGc0F/YS1 NR15inHzTPqbQ94uA/306XrIHHU7nh70FxnUshwqxkCe0VqpMtdjLNGSGBiLmbQcg3Tg9S zycQ0bRW18zx8n/6lXwdEMMoN+r71TKu3I3ZUIPlDs3bk5GRNAyGb/3yOOeqrzWgZ95xvy x8Ki/L3EezGQ4ttZ3wBU8hHrurn2O4ySYCec6XzZ6tUaItL1cq7VYsWewHcW3w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638984928; a=rsa-sha256; cv=none; b=A2kaOSeE9g4DkQ34MDxPw+8malucJVrDCk42w+CBh6PahT6H9/CsUx6ziq6lyzVBChgMWe FGLitPRngWPW9yDcwBmdSIQcZNs2hfc0YhwQZVc0EYi1J2xFseLqjxoDLl5jn2Bmh8YPnO Gor73dIppkF2KBpOrqDCrE53PZ+/A69iNIpdDwlCKdYFjQnG12pp6p/y36UqmLUzV7V/zM GkuNJRPdZGw3qcuJCAy/+UdyjmOsXw0kn0t6yQhX8CcX6Qw1IKYk3Ou2E2WkjAW7C7Fos0 SY035VeQ14UtRtayEOrJqPvvCagYnvIsfzqETROMRDuOrIkuqz9Pm4qE5xRxCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9a128e1678d1d22a2d4855784b511c0cb370189e commit 9a128e1678d1d22a2d4855784b511c0cb370189e Author: Alexander Motin AuthorDate: 2021-12-08 17:29:15 +0000 Commit: Alexander Motin CommitDate: 2021-12-08 17:29:15 +0000 mca: Switch to using taskqueue_enqueue_timeout_sbt(). Previously it was not allowed on fast taskqueues. It was fixed in 4730a8972b1f. This should make no functional change, just a bit cleaner and efficient code. MFC after: 1 week --- sys/x86/x86/mca.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c index 2f4fca0ca062..c3befa46615b 100644 --- a/sys/x86/x86/mca.c +++ b/sys/x86/x86/mca.c @@ -126,10 +126,10 @@ static STAILQ_HEAD(, mca_internal) mca_freelist; static int mca_freecount; static STAILQ_HEAD(, mca_internal) mca_records; static STAILQ_HEAD(, mca_internal) mca_pending; -static struct callout mca_timer; static int mca_ticks = 3600; /* Check hourly by default. */ static struct taskqueue *mca_tq; -static struct task mca_resize_task, mca_scan_task; +static struct task mca_resize_task; +static struct timeout_task mca_scan_task; static struct mtx mca_lock; static unsigned int @@ -978,14 +978,8 @@ mca_scan_cpus(void *context, int pending) thread_unlock(td); if (count != 0) mca_process_records(POLLED); -} - -static void -mca_periodic_scan(void *arg) -{ - - taskqueue_enqueue(mca_tq, &mca_scan_task); - callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL); + taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, + mca_ticks * SBT_1S, 0, C_PREL(1)); } static int @@ -998,7 +992,8 @@ sysctl_mca_scan(SYSCTL_HANDLER_ARGS) if (error) return (error); if (i) - taskqueue_enqueue(mca_tq, &mca_scan_task); + taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, + 0, 0, 0); return (0); } @@ -1032,28 +1027,18 @@ sysctl_mca_maxcount(SYSCTL_HANDLER_ARGS) } static void -mca_createtq(void *dummy) +mca_startup(void *dummy) { + if (mca_banks <= 0) return; - mca_tq = taskqueue_create_fast("mca", M_WAITOK, - taskqueue_thread_enqueue, &mca_tq); - taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq"); - /* CMCIs during boot may have claimed items from the freelist. */ mca_resize_freelist(); -} -SYSINIT(mca_createtq, SI_SUB_CONFIGURE, SI_ORDER_ANY, mca_createtq, NULL); - -static void -mca_startup(void *dummy) -{ - if (mca_banks <= 0) - return; - - callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan, NULL); + taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq"); + taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, + mca_ticks * SBT_1S, 0, C_PREL(1)); } #ifdef EARLY_AP_STARTUP SYSINIT(mca_startup, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, mca_startup, NULL); @@ -1112,8 +1097,9 @@ mca_setup(uint64_t mcg_cap) mtx_init(&mca_lock, "mca", NULL, MTX_SPIN); STAILQ_INIT(&mca_records); STAILQ_INIT(&mca_pending); - TASK_INIT(&mca_scan_task, 0, mca_scan_cpus, NULL); - callout_init(&mca_timer, 1); + mca_tq = taskqueue_create_fast("mca", M_WAITOK, + taskqueue_thread_enqueue, &mca_tq); + TIMEOUT_TASK_INIT(mca_tq, &mca_scan_task, 0, mca_scan_cpus, NULL); STAILQ_INIT(&mca_freelist); TASK_INIT(&mca_resize_task, 0, mca_resize, NULL); mca_resize_freelist();